@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --bg: #1a1a1a;
  --surface: #242424;
  --surface-elevated: #2d2d2d;
  --border: #363636;
  --text-primary: #e8e4e0;
  --text-secondary: #9c948a;
  --text-muted: #6b6560;
  --accent: #c8a45c;
  --accent-soft: rgba(200, 164, 92, 0.12);
  --accent-glow: rgba(200, 164, 92, 0.25);
  --green: #6a9b7a;
  --green-soft: rgba(106, 155, 122, 0.15);
  --red: #b85c5c;
  --blue: #7a8fa6;
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.45);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

.bg-pattern {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  position: relative;
  z-index: 1;
}

/* Headings */
h1, h2, h3 {
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  font-weight: 600;
  letter-spacing: -0.3px;
}

h1 {
  text-align: center;
  font-size: 2.6rem;
  color: var(--text-primary);
  margin: 0 0 8px;
}

h1::after {
  content: '';
  display: block;
  width: 60px;
  height: 2px;
  background: var(--accent);
  margin: 16px auto 0;
  border-radius: 1px;
}

/* Start Date Picker */
.start-date-picker {
  text-align: center;
  margin: 28px 0 32px;
}

.start-date-picker label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-right: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 0.75rem;
}

.start-date-picker input[type="date"] {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition);
}

.start-date-picker input[type="date"]:hover,
.start-date-picker input[type="date"]:focus {
  border-color: var(--accent);
  outline: none;
}

/* Panel Controls */
.panel-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  justify-content: center;
}

/* Buttons */
.btn {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #1a1a1a;
}

.btn-primary:hover {
  background: #d4b368;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-success {
  background: var(--surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-success:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-import {
  background: var(--surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-import:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* Map Container */
.map-container {
  height: 520px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin-bottom: 32px;
  border: 1px solid var(--border);
}

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

/* Addresses Section */
.addresses {
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.addresses h2 {
  margin-top: 0;
  color: var(--text-primary);
  font-size: 1.6rem;
}

.city-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.city-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.city-section h3 {
  color: var(--accent);
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.city-section ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.city-section li {
  margin-bottom: 6px;
  padding-left: 24px;
  position: relative;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.city-section li::before {
  content: "—";
  color: var(--accent);
  position: absolute;
  left: 0;
}

/* Legend */
.legend {
  background: rgba(36, 36, 36, 0.92);
  backdrop-filter: blur(8px);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* Edit Panel */
.edit-panel {
  background: var(--surface);
  padding: 28px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.edit-panel h2 {
  margin-top: 0;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

/* Recap Panel */
.recap-panel {
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 32px;
  border: 1px solid var(--border);
  transition: box-shadow var(--transition);
}

.recap-panel:hover {
  box-shadow: var(--shadow-lg);
}

.recap-panel h2 {
  margin-top: 0;
  color: var(--text-primary);
  font-size: 1.5rem;
  margin-bottom: 24px;
}

.recap-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface-elevated);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.stat-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  line-height: 1;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 500;
}

/* Table styles */
.cities-table-container {
  overflow-x: auto;
}

#citiesTable {
  width: 100%;
  border-collapse: collapse;
}

#citiesTable th,
#citiesTable td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

#citiesTable th {
  background: var(--surface-elevated);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 0.72rem;
}

#citiesTable tr:hover {
  background: var(--accent-soft);
}

.city-row {
  transition: background-color var(--transition);
}

.city-row input[type="text"],
.city-row input[type="number"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-primary);
}

.city-row input[type="number"] {
  width: 80px;
}

.city-row .delete-btn {
  background: var(--red);
  color: white;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity var(--transition);
}

.city-row .delete-btn:hover {
  opacity: 0.85;
}

.city-row .move-btn {
  background: var(--blue);
  color: white;
  padding: 6px 12px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin: 0 2px;
}

.city-row .move-btn:hover {
  opacity: 0.85;
}

.city-row .move-btn:disabled {
  background: var(--surface-elevated);
  color: var(--text-muted);
  cursor: not-allowed;
}

.find-price-btn {
  background: var(--green);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px 10px;
  transition: opacity var(--transition);
}

.find-price-btn:hover {
  opacity: 0.85;
}

/* ==========================================
   JOURNEY TIMELINE
   ========================================== */
.itinerary-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  margin: 24px 0;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.itinerary-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.itinerary-title {
  text-align: center;
  margin: 0 0 28px;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.itinerary-icon {
  margin-right: 10px;
  opacity: 0.7;
}

.journey-timeline {
  position: relative;
  max-width: 580px;
  margin: 0 auto;
  padding-left: 28px;
  min-height: 60px;
}

.journey-timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: 24px;
  width: 1px;
  background: var(--border);
  z-index: 1;
}

/* City Node */
.city-node {
  position: relative;
  padding: 6px 0 6px 48px;
  margin-bottom: 12px;
  z-index: 2;
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.city-dot {
  position: absolute;
  left: 11px;
  top: 16px;
  width: 12px;
  height: 12px;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 50%;
  transform: translateX(-50%);
  z-index: 3;
  transition: all var(--transition);
}

.city-node:hover .city-dot {
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  transform: translateX(-50%) scale(1.2);
}

/* City Card */
.city-card {
  background: var(--surface-elevated);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  transition: all var(--transition);
}

.city-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateX(2px);
}

.city-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.city-info {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.city-dates {
  font-weight: 500;
  color: var(--accent);
}

.city-country {
  color: var(--text-muted);
}

.city-info span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.city-days {
  color: var(--green);
  font-weight: 500;
}

/* City Card Buttons */
.city-card-buttons {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.city-card-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.city-card-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* City Edit Panel */
.city-edit-panel {
  background: var(--surface-elevated);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 340px;
  margin: 10px 0 10px 40px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  animation: slideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  position: relative;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.edit-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.edit-panel-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.edit-panel-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.city-edit-panel .form-group input[type="text"],
.city-edit-panel .form-group input[type="number"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  width: 100%;
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color var(--transition);
}

.form-group input:focus,
.city-edit-panel .form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.edit-panel-dates {
  padding: 8px 12px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--accent);
}

.update-days-btn {
  background: var(--accent);
  color: #1a1a1a;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition);
  margin-top: 4px;
}

.update-days-btn:hover {
  background: #d4b368;
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* Trip Edit Panel */
.trip-edit-panel {
  background: var(--surface-elevated);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px 40px;
  border: 1px solid var(--border);
  animation: fadeIn 0.2s ease;
  position: relative;
  z-index: 20;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.euro-symbol {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

.trip-edit-panel input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  width: 72px;
  background: var(--surface);
  color: var(--text-primary);
}

.trip-edit-panel input:focus {
  outline: none;
  border-color: var(--accent);
}

.trip-edit-panel .update-days-btn {
  padding: 6px 12px;
  font-size: 0.78rem;
  margin: 0;
}

/* Trip Connector */
.trip-connector {
  position: relative;
  min-height: 30px;
  padding: 10px 0 0 20px;
  margin-bottom: 0;
  z-index: 5;
}

.trip-connector::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
  z-index: 1;
}

.trip-info {
  display: inline-block;
  margin-left: 20px;
  padding: 4px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all var(--transition);
}

.trip-info:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.edit-trip-btn {
  display: inline-block;
  margin-left: 10px;
  padding: 3px 8px;
  font-size: 0.75rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.edit-trip-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Drag & Drop */
.draggable-city {
  cursor: move;
}

.sortable-ghost {
  opacity: 0.5;
  background: var(--accent-soft);
  border-radius: var(--radius);
  border: 1px dashed var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.city-node.sortable-chosen {
  opacity: 0.8;
  background: var(--accent-soft);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.add-city-timeline-btn {
  margin-bottom: 20px;
  text-align: center;
}

.add-city-timeline-btn button {
  padding: 8px 20px;
  font-size: 0.85rem;
}

/* Edit panel delete button */
.edit-panel-header .delete-btn {
  background: transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition);
}

.edit-panel-header .delete-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ==========================================
   DETAILS MODAL
   ========================================== */
.details-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.details-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 650px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border);
  animation: slideUpModal 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUpModal {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.details-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
}

.details-modal-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.3rem;
}

.details-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
  transition: color var(--transition);
}

.details-modal-close:hover {
  color: var(--red);
}

.details-modal-body {
  padding: 24px 28px;
  flex: 1;
  overflow-y: auto;
}

.details-modal-body textarea {
  width: 100%;
  min-height: 280px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  line-height: 1.7;
  resize: vertical;
  background: var(--bg);
  color: var(--text-primary);
  transition: border-color var(--transition);
}

.details-modal-body textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.details-modal-body textarea::placeholder {
  color: var(--text-muted);
}

.details-modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Keyframes */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.city-node:nth-child(1) { animation-delay: 0.04s; }
.city-node:nth-child(2) { animation-delay: 0.08s; }
.city-node:nth-child(3) { animation-delay: 0.12s; }
.city-node:nth-child(4) { animation-delay: 0.16s; }
.city-node:nth-child(5) { animation-delay: 0.2s; }
.city-node:nth-child(6) { animation-delay: 0.24s; }
.city-node:nth-child(7) { animation-delay: 0.28s; }
.city-node:nth-child(8) { animation-delay: 0.32s; }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
  .container {
    padding: 20px 16px 60px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .map-container {
    height: 360px;
    border-radius: var(--radius);
  }

  .panel-controls {
    flex-direction: column;
    gap: 8px;
  }

  .btn {
    width: 100%;
  }

  .recap-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-value {
    font-size: 1.8rem;
  }

  .city-card {
    max-width: 100%;
  }

  .itinerary-container {
    padding: 20px 12px;
  }

  .journey-timeline {
    max-width: 100%;
    padding-left: 20px;
  }
}
