/* ===========================================
   IRELAND TRIP - STYLES
   Color palette: earthy greens, warm cream,
   copper accents, slate
   =========================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --green-dark: #1E3A2B;
  --green-primary: #2D5A3D;
  --green-mid: #4A7C59;
  --green-light: #8FB996;
  --green-pale: #D4E6D9;
  --cream: #F5F0E8;
  --cream-warm: #EDE5D8;
  --cream-dark: #D9CEBD;
  --copper: #C4956A;
  --copper-light: #D4AE8A;
  --copper-dark: #A07A52;
  --slate: #4A6274;
  --text-dark: #2C2C2C;
  --text-mid: #5A5A5A;
  --text-light: #8A8A8A;
  --white: #FAFAF8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--text-dark);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-weight: 700;
  line-height: 1.3;
}

/* --- Layout --- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-header {
  background: var(--green-dark);
  color: var(--cream);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.app-header h1 {
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  color: var(--cream);
}

.app-header .subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--green-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-header .header-route {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--copper-light);
  opacity: 0.9;
}

.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* --- Timeline Panel (Left) --- */
.timeline-panel {
  width: 42%;
  min-width: 380px;
  max-width: 560px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--cream);
  border-right: 1px solid var(--cream-dark);
  scroll-behavior: smooth;
}

.timeline-panel::-webkit-scrollbar {
  width: 6px;
}

.timeline-panel::-webkit-scrollbar-track {
  background: transparent;
}

.timeline-panel::-webkit-scrollbar-thumb {
  background: var(--cream-dark);
  border-radius: 3px;
}

.timeline-panel::-webkit-scrollbar-thumb:hover {
  background: var(--green-light);
}

.timeline {
  position: relative;
  padding: 32px 24px 80px 48px;
}

/* Vertical line */
.timeline::before {
  content: '';
  position: absolute;
  left: 34px;
  top: 32px;
  bottom: 80px;
  width: 2px;
  background: linear-gradient(to bottom, var(--green-light), var(--copper-light), var(--green-light));
  opacity: 0.5;
}

/* --- Stop Card --- */
.stop-card {
  position: relative;
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.stop-card:last-child {
  margin-bottom: 0;
}

/* Timeline dot */
.stop-dot {
  position: absolute;
  left: -22px;
  top: 20px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--cream);
  border: 3px solid var(--green-light);
  transition: var(--transition);
  z-index: 2;
}

.stop-card.active .stop-dot,
.stop-card:hover .stop-dot {
  background: var(--green-primary);
  border-color: var(--green-primary);
  transform: scale(1.3);
  box-shadow: 0 0 0 4px rgba(45,90,61,0.15);
}

/* Card container */
.stop-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.stop-card:hover .stop-header {
  border-color: var(--green-pale);
  box-shadow: var(--shadow-md);
}

.stop-card.active .stop-header {
  border-color: var(--green-mid);
  box-shadow: var(--shadow-md);
  background: var(--white);
}

.stop-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--white);
  margin-top: 2px;
}

.stop-info {
  flex: 1;
  min-width: 0;
}

.stop-dates {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--copper-dark);
  margin-bottom: 2px;
}

.stop-name {
  font-size: 1.15rem;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.stop-hotel {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
}

.stop-nights {
  font-size: 0.7rem;
  color: var(--text-light);
  background: var(--cream);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.stop-expand-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  transition: var(--transition);
  margin-top: 4px;
  font-size: 0.7rem;
}

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

/* --- Expanded Content --- */
.stop-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease;
  opacity: 0;
}

.stop-card.expanded .stop-content {
  max-height: 3000px;
  opacity: 1;
}

.stop-content-inner {
  padding: 0 18px 18px 18px;
  background: var(--white);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  margin-top: -12px;
  padding-top: 20px;
  border: 1px solid var(--green-pale);
  border-top: none;
}

/* --- Cover Image / Placeholder --- */
.stop-cover {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  margin-bottom: 16px;
}

.stop-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.9);
  text-align: center;
  padding: 20px;
  position: relative;
}

.stop-cover-placeholder .region-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 4px;
}

.stop-cover-placeholder .cover-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.stop-cover-placeholder .cover-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
  opacity: 0.6;
}

.stop-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stop-cover-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 32px 16px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.55), transparent);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.stop-cover-overlay .region-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 2px;
}

.stop-cover-overlay .cover-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* Placeholder gradients per stop */
.placeholder-1 { background: linear-gradient(135deg, #4A6274, #6B8A9E, #4A6274); }
.placeholder-2 { background: linear-gradient(135deg, #8B4A3A, #B06B58, #8B4A3A); }
.placeholder-3 { background: linear-gradient(135deg, #2D5A3D, #4A8C5E, #2D5A3D); }
.placeholder-4 { background: linear-gradient(135deg, #2A6B7C, #4A9CAD, #2A6B7C); }
.placeholder-5 { background: linear-gradient(135deg, #6B4E7A, #9370A8, #6B4E7A); }
.placeholder-6 { background: linear-gradient(135deg, #B8860B, #D4A843, #B8860B); }

/* --- Highlights --- */
.stop-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.highlight-tag {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--green-pale);
  color: var(--green-dark);
  white-space: nowrap;
}

/* --- Photo Gallery --- */
.stop-gallery {
  margin-bottom: 16px;
}

.stop-gallery h4 {
  font-size: 0.85rem;
  color: var(--text-mid);
  margin-bottom: 10px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.gallery-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.gallery-thumb:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-add-btn {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--cream-dark);
  background: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-light);
  font-size: 0.65rem;
  gap: 4px;
}

.gallery-add-btn:hover {
  border-color: var(--green-mid);
  color: var(--green-mid);
  background: var(--green-pale);
}

.gallery-add-btn .add-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.gallery-add-btn .add-label {
  font-weight: 500;
}

.gallery-count {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 6px;
}

/* --- Notes --- */
.stop-notes {
  border-top: 1px solid var(--cream-dark);
  padding-top: 16px;
}

.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.notes-header h4 {
  font-size: 0.85rem;
  color: var(--text-mid);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  margin: 0;
}

.notes-saved-indicator {
  font-size: 0.7rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  transition: var(--transition);
}

.notes-saved-indicator.editing {
  color: var(--copper);
}

.notes-saved-indicator.saved {
  color: var(--green-mid);
}

.notes-editor {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-mid);
  outline: none;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--cream);
  transition: var(--transition);
  cursor: text;
  min-height: 120px;
}

.notes-editor:hover {
  border-color: var(--cream-dark);
}

.notes-editor:focus {
  border-color: var(--green-light);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(45,90,61,0.08);
}

.notes-editor p {
  margin-bottom: 12px;
}

.notes-editor p:last-child {
  margin-bottom: 0;
}

/* --- Map Panel (Right) --- */
.map-panel {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

/* Custom Leaflet marker */
.custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--white);
  font-family: 'Playfair Display', serif;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: var(--transition);
  border: 3px solid var(--white);
}

.custom-marker.active {
  transform: scale(1.4);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 1000 !important;
}

.custom-marker.active::after {
  content: '';
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0.3;
  animation: markerPulse 2s ease-in-out infinite;
}

@keyframes markerPulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.3); opacity: 0; }
}

/* Map overlay info */
.map-stop-label {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  padding: 10px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 800;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: var(--transition);
}

.map-stop-label.visible {
  opacity: 1;
}

.map-stop-label .label-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
}

.map-stop-label .label-dates {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* --- Lightbox --- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  pointer-events: all;
}

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

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

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

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

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

.lightbox-nav.prev { left: 20px; }
.lightbox-nav.next { right: 20px; }

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
}

/* Gallery thumb delete button */
.gallery-thumb .delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 0.65rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.gallery-thumb:hover .delete-btn {
  display: flex;
}

.gallery-thumb .delete-btn:hover {
  background: #c0392b;
}

/* --- Leaflet overrides --- */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow-md) !important;
}

.leaflet-control-zoom a {
  background: var(--white) !important;
  color: var(--text-dark) !important;
  border: none !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 16px !important;
}

.leaflet-control-zoom a:hover {
  background: var(--cream) !important;
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 14px 18px !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 0.85rem !important;
  line-height: 1.5 !important;
}

.leaflet-popup-content .popup-name {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.leaflet-popup-content .popup-dates {
  font-size: 0.75rem;
  color: var(--text-light);
}

.leaflet-popup-content .popup-hotel {
  font-size: 0.75rem;
  color: var(--copper-dark);
  font-style: italic;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .main-container {
    flex-direction: column;
  }

  .timeline-panel {
    width: 100%;
    min-width: unset;
    max-width: unset;
    height: 50vh;
    border-right: none;
    border-bottom: 1px solid var(--cream-dark);
  }

  .map-panel {
    height: 50vh;
  }

  .timeline {
    padding: 24px 20px 40px 40px;
  }

  .timeline::before {
    left: 26px;
  }

  .stop-dot {
    left: -22px;
  }

  .app-header {
    padding: 12px 20px;
  }

  .app-header h1 {
    font-size: 1.15rem;
  }

  .app-header .header-route {
    display: none;
  }
}

@media (max-width: 600px) {
  .timeline-panel {
    height: 55vh;
  }

  .map-panel {
    height: 45vh;
  }

  .stop-header {
    padding: 12px 14px;
  }

  .stop-name {
    font-size: 1rem;
  }

  .stop-cover {
    height: 160px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  }
}

/* --- Loading state --- */
.loading-map {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-light);
  font-size: 0.9rem;
}

/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stop-card {
  animation: fadeInUp 0.4s ease forwards;
}

.stop-card:nth-child(1) { animation-delay: 0.05s; }
.stop-card:nth-child(2) { animation-delay: 0.1s; }
.stop-card:nth-child(3) { animation-delay: 0.15s; }
.stop-card:nth-child(4) { animation-delay: 0.2s; }
.stop-card:nth-child(5) { animation-delay: 0.25s; }
.stop-card:nth-child(6) { animation-delay: 0.3s; }
