/**
 * Application Styles - PlayTimeRX Branding
 * Primary: Orange #F47920, Blue #2490CC, White #FFFFFF
 * Secondary: Light Blue #3AADE8, Cool Gray #A7A8A9, Aged Brass #D7D2C4
 * Typography: Roboto, Roboto Slab (Google Fonts)
 */

:root {
  --westwood-red: #F47920;
  --westwood-maroon: #2490cc;
  --westwood-white: #FFFFFF;
  --westwood-black: #000000;
  --westwood-cool-gray: #A7A8A9;
  --westwood-aged-brass: #D7D2C4;
  --font-primary: 'Roboto', Calibri, sans-serif;
  --font-heading: 'Roboto Slab', Georgia, serif;
}

/* Side Panel */
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  height: 100vh;
  background: #ffffff;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
}

/* Panel Header - Westwood Branding */
.panel-header {
  padding: 20px;
  background: var(--westwood-white);
  border-bottom: 1px solid var(--westwood-aged-brass);
}

.brand-header {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.brand-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-logo {
  max-width: 100%;
  max-height: 110px;
  object-fit: contain;
  display: block;
}

.panel-header .subtitle {
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--westwood-maroon);
  text-align: center;
}

/* Route Info Panel */
.route-info {
  padding: 15px 20px;
  background: var(--westwood-aged-brass);
  border-bottom: 1px solid var(--westwood-cool-gray);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.info-row:last-child {
  margin-bottom: 0;
}

.info-label {
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--westwood-maroon);
  font-weight: 500;
}

.info-value {
  font-family: var(--font-heading);
  font-size: 16px;
  color: var(--westwood-red);
  font-weight: 600;
}

/* Action Buttons - Westwood UI Design */
.action-buttons {
  padding: 15px 20px;
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--westwood-aged-brass);
}

.btn {
  flex: 1;
  padding: 10px 15px;
  border: none;
  border-radius: 6px;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

/* Primary buttons - Westwood Red with white text */
.btn-primary {
  background: var(--westwood-red);
  color: var(--westwood-white);
}

.btn-primary:hover {
  background: var(--westwood-maroon);
}

/* Secondary buttons - Westwood Maroon */
.btn-secondary {
  background: var(--westwood-maroon);
  color: var(--westwood-white);
}

.btn-secondary:hover {
  background: #1a6a8a;
}

.btn:active {
  transform: scale(0.98);
}

.btn-icon {
  font-size: 16px;
}

/* Panel Sections */
.panel-section {
  padding: 20px;
  border-bottom: 1px solid var(--westwood-aged-brass);
}

.section-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  color: var(--westwood-maroon);
  margin-bottom: 5px;
}

.section-subtitle {
  font-family: var(--font-primary);
  font-size: 12px;
  color: var(--westwood-cool-gray);
  margin-bottom: 15px;
}

/* Route Sequence */
.route-sequence {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}

.route-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #f8f9fa;
  border: 1px solid var(--westwood-aged-brass);
  border-radius: 6px;
  cursor: move;
  transition: all 0.2s ease;
}

.route-item:hover {
  background: #fef5f4;
  border-color: var(--westwood-red);
}

.route-item.dragging {
  opacity: 0.5;
}

.route-item-drag {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drag-handle {
  color: var(--westwood-cool-gray);
  cursor: grab;
  font-size: 16px;
  user-select: none;
}

.route-item:active .drag-handle {
  cursor: grabbing;
}

.route-sequence-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--westwood-red);
  color: var(--westwood-white);
  border-radius: 50%;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
}

.route-item-info {
  flex: 1;
}

.route-item-name {
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--westwood-maroon);
  font-weight: 500;
}

.route-item-remove {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--westwood-maroon);
  color: var(--westwood-white);
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.route-item-remove:hover {
  background: var(--westwood-red);
  transform: scale(1.1);
}

/* Search Box */
.search-box {
  margin-bottom: 15px;
}

.search-box input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--westwood-aged-brass);
  border-radius: 6px;
  font-family: var(--font-primary);
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--westwood-red);
}

/* Feature List */
.feature-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.feature-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: #f8f9fa;
  border: 1px solid var(--westwood-aged-brass);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.feature-item:hover {
  background: #fef5f4;
  border-color: var(--westwood-red);
}

.feature-thumbnail {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  margin-right: 8px;
}

.feature-info {
  flex: 1;
}

.feature-name {
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--westwood-maroon);
  font-weight: 500;
  margin-bottom: 3px;
}

.feature-category {
  font-family: var(--font-primary);
  font-size: 12px;
  color: var(--westwood-cool-gray);
}

.feature-action-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Primary button - add to route */
.feature-action-btn.add {
  background: var(--westwood-red);
  color: var(--westwood-white);
}

.feature-action-btn.add:hover {
  background: var(--westwood-maroon);
  transform: scale(1.1);
}

/* In-route indicator — stays orange, shows ✓ or ×N count */
.feature-action-btn.in-route {
  background: var(--westwood-red);
  color: var(--westwood-white);
  font-size: 11px;
}

.feature-action-btn.in-route:hover {
  background: var(--westwood-maroon);
  transform: scale(1.1);
}

/* "Add Again (N in route)" sub-label in info panel button */
.btn-count {
  font-size: 0.75em;
  opacity: 0.85;
  font-weight: 400;
}

/* Empty State */
.empty-state {
  font-family: var(--font-primary);
  text-align: center;
  padding: 30px 20px;
  color: var(--westwood-cool-gray);
  font-size: 14px;
  line-height: 1.6;
}

/* Loading Text */
.loading-text {
  font-family: var(--font-primary);
  text-align: center;
  padding: 30px 20px;
  color: var(--westwood-maroon);
  font-size: 14px;
}

/* Error Text */
.error-text {
  font-family: var(--font-primary);
  text-align: center;
  padding: 30px 20px;
  color: var(--westwood-red);
  font-size: 14px;
}

/* Toast Notification - Westwood Branding */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 25px;
  background: var(--westwood-maroon);
  color: var(--westwood-white);
  border-radius: 8px;
  font-family: var(--font-primary);
  font-size: 14px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast.show {
  opacity: 1;
  visibility: visible;
}

.toast-success {
  background: var(--westwood-red);
}

.toast-error {
  background: var(--westwood-maroon);
}

.toast-info {
  background: var(--westwood-red);
}

/* Scrollbar Styles */
.feature-list::-webkit-scrollbar,
.side-panel::-webkit-scrollbar {
  width: 8px;
}

.feature-list::-webkit-scrollbar-track,
.side-panel::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.feature-list::-webkit-scrollbar-thumb,
.side-panel::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.feature-list::-webkit-scrollbar-thumb:hover,
.side-panel::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* Responsive Design */
@media (max-width: 768px) {
  .side-panel {
    width: 100%;
    height: 50vh;
    top: 50vh;
  }

  #viewDiv {
    right: 0;
    bottom: 50vh;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

/* Modal Styles for Child Share */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--westwood-white);
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  background: linear-gradient(135deg, var(--westwood-red) 0%, var(--westwood-maroon) 100%);
  color: var(--westwood-white);
  padding: 20px;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--westwood-white);
  font-size: 32px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}

.modal-close:hover {
  opacity: 0.7;
}

.modal-body {
  padding: 30px;
}

.qr-section,
.link-section {
  margin-bottom: 30px;
}

.qr-section:last-child,
.link-section:last-child {
  margin-bottom: 0;
}

.qr-section h3,
.link-section h3 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  color: var(--westwood-maroon);
  margin-bottom: 15px;
}

.qr-section canvas {
  display: block;
  margin: 0 auto 15px;
  border: 2px solid var(--westwood-aged-brass);
  border-radius: 8px;
  padding: 10px;
  background: var(--westwood-white);
}

.qr-section p,
.link-section p {
  text-align: center;
  color: var(--westwood-cool-gray);
  font-size: 14px;
  margin-top: 10px;
}

.link-copy-box {
  display: flex;
  gap: 10px;
  align-items: center;
}

.link-copy-box input {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--westwood-aged-brass);
  border-radius: 6px;
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--westwood-maroon);
  background: #f8f8f8;
}

.link-copy-box input:focus {
  outline: none;
  border-color: var(--westwood-red);
}

.link-copy-box button {
  white-space: nowrap;
}

/* Filters Container */
.filters-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px 0;
  border-bottom: 1px solid var(--westwood-aged-brass);
  margin-bottom: 15px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-label {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  color: var(--westwood-maroon);
}

.filter-select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--westwood-aged-brass);
  border-radius: 6px;
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--westwood-maroon);
  background: var(--westwood-white);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.filter-select:hover {
  border-color: var(--westwood-cool-gray);
}

.filter-select:focus {
  outline: none;
  border-color: var(--westwood-red);
}

.btn-clear-filters {
  padding: 8px 16px;
  border: 1px solid var(--westwood-cool-gray);
  border-radius: 6px;
  background: var(--westwood-white);
  color: var(--westwood-maroon);
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  align-self: flex-start;
}

.btn-clear-filters:hover {
  background: var(--westwood-aged-brass);
  border-color: var(--westwood-maroon);
}

.btn-clear-filters:active {
  transform: scale(0.98);
}

/* Feature Meta Information */
.feature-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.feature-age {
  font-size: 12px;
  color: var(--westwood-cool-gray);
  font-weight: 500;
}

/* Equipment Info Panel */
.info-panel {
  position: fixed;
  left: 0;
  top: 0;
  width: 400px;
  height: 100vh;
  background: var(--westwood-white);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
  border-radius: 0;
  z-index: 950;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.info-panel.visible {
  transform: translateX(0);
}

.info-panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: var(--westwood-white);
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background 0.2s ease;
}

.info-panel-close:hover {
  background: rgba(0, 0, 0, 0.65);
}

.info-panel-photo-wrap {
  position: relative;
  width: 100%;
  height: 260px;
  background: var(--westwood-aged-brass);
  flex-shrink: 0;
  overflow: hidden;
}

.info-panel-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.info-panel-no-photo {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--westwood-cool-gray);
}

.info-panel-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.info-panel-name {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 600;
  color: var(--westwood-maroon);
  margin: 0;
  line-height: 1.3;
}

.info-panel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.info-panel-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 600;
  background: var(--westwood-aged-brass);
  color: var(--westwood-maroon);
}

.info-panel-badge--skill {
  background: var(--westwood-maroon);
  color: var(--westwood-white);
}

.info-panel-description {
  font-family: var(--font-primary);
  font-size: 14px;
  color: #444;
  line-height: 1.6;
  margin: 0;
}

.info-panel-add-btn {
  width: 100%;
  margin-top: 4px;
}

/* Expand photo button overlaid on photo */
.info-panel-expand-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: var(--westwood-white);
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.info-panel-photo-wrap:hover .info-panel-expand-btn {
  display: flex;
}

.info-panel-expand-btn:hover {
  background: rgba(0, 0, 0, 0.75);
}

/* Image Lightbox */
.image-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 20000;
  align-items: center;
  justify-content: center;
}

.image-lightbox.visible {
  display: flex;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: var(--westwood-white);
  border-radius: 50%;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Clickable feature items */
.feature-item {
  cursor: pointer;
}

/* Basemap Switcher Styling */
.esri-expand {
  background-color: var(--westwood-white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.esri-expand__icon {
  color: var(--westwood-maroon);
}

.esri-basemap-gallery__item {
  border-radius: 8px;
  overflow: hidden;
}

.esri-basemap-gallery__item-title {
  font-family: var(--font-primary);
  font-weight: 600;
}

.esri-basemap-gallery__item--selected {
  border-color: var(--westwood-red);
}

/* Responsive basemap gallery */
@media (max-width: 768px) {
  .esri-expand {
    width: auto;
  }

  .esri-basemap-gallery {
    max-width: 90vw;
  }
}
