/* ============================================================================
   CHARGER DETAIL PANEL - Complete Component Styles
   ============================================================================

   All styles for the charger detail panel, including:
   - Main panel container (#chargerDetailPanel)
   - Panel header, title, close button
   - Street View container & overlays
   - Info cards, price comparison, EVSE lists
   - Amenities section
   - EVSE component

   Merged from:
   - components/styles/charger-detail-panel.css
   - components/styles/evse.css
   - components/styles/amenities.css

   Duplicate :root declarations REMOVED (now in 01-tokens/variables.css).
   Duplicate @keyframes REMOVED (now in 05-utilities/animations.css).
   ============================================================================ */

/* ============================================================================
   MAIN PANEL CONTAINER
   ============================================================================ */

#chargerDetailPanel {
  display: none;
  position: absolute;
  max-height: calc(100vh - 120px);
  width: 360px;
  background: var(--panel-bg);
  color: var(--cdp-color-white);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 0;
  z-index: 1200;
  overflow: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease;
  backdrop-filter: blur(var(--panel-backdrop-blur));
  -webkit-backdrop-filter: blur(var(--panel-backdrop-blur));
}
  background: linear-gradient(to right, var(--cdp-color-dark-bg), #1f1f1f);
  padding: 16px 20px;
  position: relative;
  z-index: 2;
}

/* Panel Title */
#chargerDetailTitle {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--cdp-color-white);
  letter-spacing: -0.3px;
  padding-right: 30px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Close Button */
#closeChargerDetailPanel {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: none;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#closeChargerDetailPanel:focus-visible {
  outline: 2px solid var(--panel-primary);
  outline-offset: 2px;
}

/* Scrollable Container */
.panel-scroll-container {
  overflow-y: auto;
  max-height: calc(100vh - 170px);
  overscroll-behavior: contain;
}

/* Panel Body */
#chargerDetailBody {
  padding: 16px 20px;
  /* Split-scroll: Body is the scrollable area, Street View stays pinned above */
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0; /* Required for flex child to scroll */
}

/* Split-scroll: Remove scroll from .fp-content so Street View stays pinned */
#chargerDetailPanel .fp-content {
  overflow-y: visible;
  overflow-x: visible;
}

/* Panel Body Scrollbar */
#chargerDetailBody::-webkit-scrollbar {
  width: 5px;
}

#chargerDetailBody::-webkit-scrollbar-track {
  background: #1a1a1a;
}

#chargerDetailBody::-webkit-scrollbar-thumb {
  background-color: #333;
  border-radius: 10px;
}

/* Legacy class-based container (kept for compatibility) */
.charger-detail-panel {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 600px;
  background: var(--cdp-color-surface);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px var(--cdp-shadow-light);
  z-index: 1000;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Header Gradient Wrapper
   UPDATED (Priority 6): background gradient moved from inline JS
   (was: style="background: linear-gradient(to right, ${PANEL_COLORS.PRIMARY}, rgba(20,20,20,0.9))")
   Now uses var(--panel-primary) which resolves to #3e6ae1 (same value as PANEL_COLORS.PRIMARY) */
.charger-header-gradient {
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
  position: relative;
  box-shadow: 0 4px 12px var(--cdp-shadow-strong);
  background: linear-gradient(to right, var(--panel-primary), rgba(20, 20, 20, 0.9));
  flex-shrink: 0; /* Prevent Street View from shrinking - keeps it always visible */
}

/* ============================================================================
   PANEL STATE CLASSES
   ============================================================================ */

.charger-detail-panel.show {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%);
}

.charger-detail-panel.hide {
  opacity: 0;
  transform: translate(-50%, -60%);
}

/* ============================================================================
   PANEL LAYOUT - INFO GRIDS & COLUMNS
   ============================================================================ */

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.card-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.info-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

/* ============================================================================
   UTILITY STYLES
   ============================================================================ */

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--cdp-color-white);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

.bolt-count {
  font-size: 10px;
  letter-spacing: -5px;
  margin-right: 4px;
}

.price-text {
  display: inline-flex;
  align-items: center;
  background: var(--cdp-color-dark-surface);
  color: var(--cdp-color-white);
  font-size: 15px;
  font-weight: bold;
  border-radius: 12px;
  padding: 2px 8px;
  box-shadow: 0 1px 4px var(--cdp-shadow-medium);
  border: 2px solid var(--cdp-color-white);
}

/* ============================================================================
   CARD MODIFIER CLASSES (Priority 6 migration — customStyles → CSS)
   Used by Speed/Price grid cards and Error card in charger_details.js.
   These override the base .fp-card / .fp-card__title / .fp-card__description
   values from cards.css.
   ============================================================================ */

/* Compact card — used in the Speed/Price 2-column grid.
   Overrides: padding (15px→16px), margin-bottom (10px→0).
   Was: customStyles.container = "padding: 16px; margin:0;" */
.fp-card--compact {
  padding: 16px;
  margin-bottom: 0;
}

/* Compact card title — smaller font, tighter bottom margin.
   Overrides: font-size (14px→13px), margin-bottom (8px→6px).
   Was: customStyles.title = "font-size: 13px; margin-bottom: 6px;" */
.fp-card--compact .fp-card__title {
  font-size: 13px;
  margin-bottom: 6px;
}

/* Compact card description — slightly larger font.
   Overrides: font-size (13px→14px).
   Was: customStyles.description = "font-size: 14px;" */
.fp-card--compact .fp-card__description {
  font-size: 14px;
}

/* Error description — red text for error state.
   Applied as a container modifier with descendant selector since
   createContentCard only supports extraClasses on the container div.
   Was: customStyles.description = "color:#e74c3c;" */
.fp-card--error .fp-card__description {
  color: #e74c3c;
}

/* ============================================================================
   INFO CARDS & CONTENT
   ============================================================================ */

.info-card {
  background: var(--cdp-color-bg-light);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}

.label {
  color: var(--cdp-color-text-secondary);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.value {
  color: var(--cdp-color-text-primary);
  font-size: 1.1rem;
  font-weight: 500;
}

.ad-hoc-note {
  color: var(--cdp-color-text-secondary);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* ============================================================================
   PRICE COMPARISON
   ============================================================================ */

.price-comparison-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--cdp-color-border-divider);
}

.price-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.price-item-operator {
  font-size: 0.7rem;
}

.price-item-operator.best {
  color: var(--cdp-color-success-primary);
}

.price-item-operator.other {
  color: var(--cdp-color-text-subtle);
}

.price-item-amount {
  font-size: 0.7rem;
}

.price-item-amount.best {
  color: var(--cdp-color-success-primary);
  font-weight: 600;
}

.price-item-amount.other {
  color: var(--cdp-color-text-disabled);
  font-weight: 400;
}

/* Operator Info */
.operator-info {
  color: var(--cdp-color-text-muted);
  font-size: 0.7rem;
  margin-top: 4px;
}

.ad-hoc-payment-note {
  color: var(--cdp-color-text-muted);
  font-size: 0.75rem;
  margin-top: 4px;
}

/* External Link */
.external-link-card {
  display: block;
  color: inherit;
  text-decoration: none;
}

/* ============================================================================
   GROUP ITEMS & LISTS
   ============================================================================ */

.group-container {
  margin-top: 12px;
}

.group-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--cdp-color-border-light);
}

.group-item:last-child {
  border-bottom: none;
}

.group-item-id {
  color: var(--cdp-color-text-primary);
  font-size: 0.85rem;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-item-status {
  color: var(--cdp-color-text-primary);
  font-size: 0.85rem;
  flex-shrink: 0;
  min-width: 80px;
  text-align: right;
}

.available {
  color: var(--cdp-color-success-alt);
}

.unavailable {
  color: var(--cdp-color-error-primary);
}

/* ============================================================================
   EVSE LIST & AVAILABILITY
   ============================================================================ */

.evse-list {
  margin-top: 12px;
}

.availability-status {
  font-weight: 500;
}

.availability-status.available {
  color: var(--cdp-color-success-primary);
}

.availability-status.unavailable {
  color: var(--cdp-color-text-muted);
  font-weight: 400;
}

.evse-last-used {
  color: var(--cdp-color-text-muted);
  font-size: 0.7rem;
  display: block;
  margin-top: 2px;
}

.evse-unavailable-warning {
  color: var(--cdp-color-error-warning);
  font-size: 0.65rem;
  display: block;
  margin-top: 2px;
  line-height: 1.2;
}

/* EVSE Summary Header */
.evse-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.evse-summary-header:hover {
  background: rgba(255, 255, 255, 0.06);
}

.evse-summary-header:focus-visible {
  outline: 2px solid var(--panel-primary);
  outline-offset: -2px;
}

/* ============================================================================
   EVSE ID (merged from evse.css)
   ============================================================================ */

.evse-id {
  color: var(--text-color);
  font-size: var(--font-size-sm);
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================================
   GOOGLE STREET VIEW
   ============================================================================ */

#streetViewContainer {
  width: 100%;
  height: 200px;
  background-color: var(--cdp-color-dark-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  margin-bottom: -1px;
}

#streetViewImage {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.3s ease;
}

#streetViewLoading,
#streetViewError {
  position: absolute;
  color: var(--cdp-color-text-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

#streetViewError {
  display: none;
}

#streetViewLoading svg {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  animation: rotate 1.5s linear infinite;
}

/* Street View State Classes - applied to #streetViewContainer */
#streetViewContainer.sv-state-loading #streetViewLoading { display: flex; }
#streetViewContainer.sv-state-loading #streetViewError   { display: none; }
#streetViewContainer.sv-state-loading #streetViewImage   { opacity: 0.3; }

#streetViewContainer.sv-state-loaded #streetViewLoading  { display: none; }
#streetViewContainer.sv-state-loaded #streetViewError    { display: none; }
#streetViewContainer.sv-state-loaded #streetViewImage    { opacity: 1; }

#streetViewContainer.sv-state-error #streetViewLoading   { display: none; }
#streetViewContainer.sv-state-error #streetViewError     { display: flex; }
#streetViewContainer.sv-state-error #streetViewImage     { opacity: 0.1; }

/* ============================================================================
   EXPAND / COLLAPSE PATTERN
   Reusable for EVSE pricing, amenity details, etc.
   ============================================================================ */

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 10px;
}

.collapsible-content.is-expanded {
  max-height: 600px;
  padding-top: 10px;
  padding-bottom: 10px;
}

/* Pricing-specific max-height (smaller) */
.collapsible-content.is-expanded.pricing-content {
  max-height: 500px;
}

.expand-icon {
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.expand-icon.is-expanded {
  transform: rotate(180deg);
}

/* ============================================================================
   EVSE CARD - Connector items in the availability section
   ============================================================================ */

.evse-card {
  margin-top: 12px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.2s;
}

.evse-content-left {
  flex: 1;
  min-width: 0;
  margin-right: 8px;
}

.evse-id-label {
  font-size: 0.85rem;
  color: #fff;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evse-connector-label {
  font-size: 0.8rem;
  color: var(--text-muted-accessible);
  margin-top: 2px;
}

.evse-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.evse-status {
  font-weight: 500;
  white-space: nowrap;
  font-size: 0.9rem;
}

.evse-status--available {
  color: #3dcc89;
}

.evse-status--unavailable {
  color: var(--text-muted-accessible);
}

/* ============================================================================
   AMENITIES SECTION (merged from amenities.css)
   ============================================================================ */

.amenities-section {
  background: var(--background-dark);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.amenities-label {
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--spacing-xs);
  font-weight: var(--font-weight-normal);
}

.amenities-value {
  color: var(--text-color);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  margin: 0;
}

.amenities-error {
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  margin: 0;
}

.amenities-no-results {
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  margin: 0;
}

.amenities-group-container {
  max-height: 180px;
  overflow-y: auto;
  margin-top: var(--gap-lg);
  scrollbar-width: thin;
}

.amenities-group-item {
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-sm);
  border-bottom: 1px solid var(--background-darker);
  gap: var(--gap-lg);
}

/* ============================================================================
   AMENITY ITEMS - Expandable amenity list items
   ============================================================================ */

.amenity-item {
  margin-top: 12px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.2s;
}

.amenity-toggle {
  display: flex;
  align-items: center;
  padding: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.amenity-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.amenity-toggle:focus-visible {
  outline: 2px solid var(--panel-primary);
  outline-offset: -2px;
}

.amenity-icon {
  margin-right: 10px;
  font-size: 1.3rem;
}

.amenity-text-col {
  flex: 1;
  min-width: 0;
}

.amenity-name {
  font-size: 0.95rem;
  color: #fff;
  font-weight: 500;
}

.amenity-distance {
  font-size: 0.8rem;
  color: var(--text-muted-accessible);
  margin-top: 2px;
}

.amenity-expand-arrow {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
  color: var(--text-muted-accessible);
  margin-left: 8px;
}

.amenity-details-inner {
  padding-bottom: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 10px;
}

.amenity-loading-text {
  color: var(--text-muted-accessible);
  font-size: 0.85rem;
  text-align: center;
}

/* ============================================================================
   PLACE DETAILS - Expanded amenity detail content
   ============================================================================ */

.place-details-wrapper {
  font-size: 0.85rem;
  color: #d0d0d0;
  line-height: 1.6;
}

.place-detail-row {
  margin-bottom: 8px;
}

.place-detail-row-flex {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

.place-detail-row-flex--start {
  align-items: start;
}

.place-stars {
  color: #ffd700;
  font-size: 0.9rem;
}

.place-rating-value {
  color: #fff;
  margin-left: 6px;
  font-weight: 500;
}

.place-review-count {
  color: var(--text-muted-accessible);
  margin-left: 4px;
}

.place-status-open {
  color: #3dcc89;
  font-weight: 500;
}

.place-status-closed {
  color: #e74c3c;
  font-weight: 500;
}

.place-detail-icon {
  margin-right: 6px;
}

.place-link {
  color: #4a9eff;
  text-decoration: none;
}

.place-details-error {
  color: #e74c3c;
  font-size: 0.85rem;
  text-align: center;
}

/* ============================================================================
   PHOTO GRID & VIEWER
   ============================================================================ */

.place-photos-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  transition: opacity 0.3s ease;
}

.place-photo-thumb {
  position: relative;
  padding-bottom: 100%;
  overflow: hidden;
  border-radius: 6px;
  background: #1a1a1a;
  cursor: pointer;
}

.place-photo-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.place-photo-img:hover {
  transform: scale(1.05);
}

.place-photo-expanded {
  display: none;
  transition: opacity 0.3s ease;
  opacity: 0;
}

.place-photo-expanded.is-visible {
  display: block;
  opacity: 1;
}

.place-photo-expanded.is-fading-out {
  opacity: 0;
}

.place-photos-grid.is-dimmed {
  opacity: 0.5;
}

/* Photo Viewer */
.photo-viewer-container {
  position: relative;
  background: #000;
  border-radius: 8px;
  margin-top: 12px;
}

.photo-viewer-img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.2s ease;
}

.photo-viewer-img.is-fading {
  opacity: 0;
}

.photo-viewer-close-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.8);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-viewer-close-btn:focus-visible {
  outline: 2px solid var(--panel-primary);
  outline-offset: 2px;
}

.photo-viewer-close-icon {
  width: 16px;
  height: 16px;
  color: #fff;
}

.photo-viewer-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.8);
  padding: 8px 14px;
  border-radius: 20px;
}

.photo-dot {
  width: 8px;
  height: 8px;
  padding: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  background-clip: content-box;
  cursor: pointer;
  box-sizing: content-box;
}

.photo-dot--active {
  background: #fff;
}

.photo-dot:focus-visible {
  outline: 2px solid var(--panel-primary);
  outline-offset: 2px;
}

/* ============================================================================
   RESPONSIVE - Panel width adjustments for smaller screens
   ============================================================================ */

@media (max-width: 768px) {
  #chargerDetailPanel {
    width: min(360px, calc(100vw - 32px));
  }
}

@media (max-width: 480px) {
  #chargerDetailPanel {
    width: calc(100vw - 32px) !important;
  }
}

/* ============================================================================
   COMMUNITY PRICING STYLES
   Styles for community-submitted prices in the charger detail panel
   ============================================================================ */

/* Community price item - subtle visual distinction */
.price-item--community {
  background: rgba(62, 106, 225, 0.08);
  margin: 2px -4px;
  padding: 2px 4px;
  border-radius: 4px;
}

/* Verified badge - green checkmark */
.verified-badge {
  color: var(--cdp-color-success-primary, #3dcc89);
  font-size: 0.65rem;
  margin-left: 2px;
}

/* Community badge - user icon */
.community-badge {
  font-size: 0.6rem;
  margin-left: 2px;
  opacity: 0.8;
}

/* Community pricing link button */
.community-pricing-link {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.community-pricing-link-btn {
  background: rgba(62, 106, 225, 0.15);
  border: 1px solid rgba(62, 106, 225, 0.3);
  color: #7da3ff;
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-align: center;
}

.community-pricing-link-btn:hover {
  background: rgba(62, 106, 225, 0.25);
  border-color: rgba(62, 106, 225, 0.5);
}

.community-pricing-link-btn:focus-visible {
  outline: 2px solid var(--panel-primary);
  outline-offset: 2px;
}
