/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: 1rem;
}

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --bg-primary:    #0f172a;
  --bg-secondary:  #1e293b;
  --bg-tertiary:   #334155;
  --accent:        #f97316;
  --accent-hover:  #ea580c;
  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;
  --border:        #334155;
  --success:       #22c55e;
  --danger:        #ef4444;
  --radius-sm:     6px;
  --radius-md:     12px;
  --radius-lg:     16px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.6);
  --transition:    0.2s ease;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.text-sm    { font-size: 0.875rem; }
.text-xs    { font-size: 0.75rem; }
.text-accent{ color: var(--accent); }
.text-success{ color: var(--success); }
.text-danger{ color: var(--danger); }
.fw-bold    { font-weight: 700; }

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.container-sm {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.flex-wrap   { flex-wrap: wrap; }
.items-center{ align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1  { gap: 0.25rem; }
.gap-2  { gap: 0.5rem; }
.gap-3  { gap: 0.75rem; }
.gap-4  { gap: 1rem; }
.gap-6  { gap: 1.5rem; }
.mt-1   { margin-top: 0.25rem; }
.mt-2   { margin-top: 0.5rem; }
.mt-3   { margin-top: 0.75rem; }
.mt-4   { margin-top: 1rem; }
.mt-6   { margin-top: 1.5rem; }
.mt-8   { margin-top: 2rem; }
.mb-1   { margin-bottom: 0.25rem; }
.mb-2   { margin-bottom: 0.5rem; }
.mb-3   { margin-bottom: 0.75rem; }
.mb-4   { margin-bottom: 1rem; }
.mb-6   { margin-bottom: 1.5rem; }
.mb-8   { margin-bottom: 2rem; }
.ml-auto{ margin-left: auto; }
.w-full { width: 100%; }

/* Split layout for trip view */
.split-layout {
  display: flex;
  height: calc(100vh - 64px);
  overflow: hidden;
}

.split-map {
  width: 40%;
  flex-shrink: 0;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
}

.split-content {
  width: 60%;
  overflow-y: auto;
  padding: 2rem 1.5rem;
}

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

/* ============================================================
   NAV BAR
   ============================================================ */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.navbar-logo {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -1px;
}

.navbar-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.navbar-title span {
  color: var(--accent);
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.navbar-user strong {
  color: var(--text-primary);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

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

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

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  box-shadow: 0 4px 12px rgba(249,115,22,0.35);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #3d5068;
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.75rem 1.75rem;
  font-size: 1rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.15);
}

.form-control::placeholder {
  color: var(--text-muted);
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  border-color: var(--bg-tertiary);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================================
   TRIP CARDS (Dashboard)
   ============================================================ */
.trips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.trip-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.trip-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.trip-card-cover {
  position: relative;
  height: 180px;
  overflow: hidden;
  background: linear-gradient(135deg, #1e3a5f 0%, #312e81 50%, #1e293b 100%);
}

.trip-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.trip-card:hover .trip-card-cover img {
  transform: scale(1.05);
}

.trip-card-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.trip-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15,23,42,0.9) 0%, transparent 60%);
}

.trip-card-body {
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.trip-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.trip-card-dates {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.trip-card-stats {
  display: flex;
  gap: 1rem;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.trip-stat {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.trip-stat strong {
  color: var(--text-primary);
}

.trip-card-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.25rem 1.1rem;
}

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline {
  position: relative;
  padding-left: 3rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 1.1rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--bg-tertiary));
  border-radius: 2px;
}

.step-card {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.step-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(249,115,22,0.15), var(--shadow-md);
}

.step-card.highlighted {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.2), var(--shadow-md);
}

/* Accordion toggle */
.step-toggle {
  cursor: pointer;
  user-select: none;
}

.step-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.step-chevron {
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1rem;
  transition: transform 0.25s ease, color 0.2s;
  transform: rotate(0deg);
  margin-top: 0.15rem;
}

.step-card.active .step-chevron {
  transform: rotate(90deg);
  color: var(--accent);
}

/* Collapsible body */
.step-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
  overflow: hidden;
}

.step-card.active .step-body {
  grid-template-rows: 1fr;
}

.step-body-inner {
  overflow: hidden;
  padding-top: 0;
  transition: padding-top 0.3s ease;
}

.step-card.active .step-body-inner {
  padding-top: 1rem;
}

/* Inline map inside step cards — only shown on mobile */
.step-inline-map {
  display: none;
  height: 220px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 1rem;
}

.step-number {
  position: absolute;
  left: -2.35rem;
  top: 1.5rem;
  width: 2rem;
  height: 2rem;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  border: 3px solid var(--bg-primary);
  z-index: 1;
  flex-shrink: 0;
}

.step-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.step-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.step-location {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

.step-date-badge {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.step-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.step-content {
  color: var(--text-secondary);
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.step-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ============================================================
   PHOTO GRID
   ============================================================ */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 1rem 0;
}

.photo-thumb-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  cursor: pointer;
}

.photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.photo-thumb-wrap:hover .photo-thumb {
  transform: scale(1.08);
}

.photo-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  opacity: 0;
}

.photo-thumb-wrap:hover .photo-thumb-overlay {
  background: rgba(0,0,0,0.35);
  opacity: 1;
}

.photo-delete-btn {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  background: rgba(239,68,68,0.85);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 2;
}

.photo-thumb-wrap:hover .photo-delete-btn {
  opacity: 1;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.95);
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.lightbox.active {
  display: flex;
}

.lightbox-img-wrap {
  max-width: 90vw;
  max-height: 85vh;
  position: relative;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

.lightbox-close {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: var(--bg-tertiary);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  z-index: 10000;
}

.lightbox-close:hover {
  background: var(--danger);
}

.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(30,41,59,0.8);
  border: none;
  color: white;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  z-index: 10000;
}

.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }

.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--accent);
}

.lightbox-caption {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15,23,42,0.8);
  color: var(--text-primary);
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  font-size: 0.9rem;
  max-width: 80vw;
  text-align: center;
  backdrop-filter: blur(8px);
}

/* ============================================================
   COMMENTS
   ============================================================ */
.comments-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.comments-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.comment {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  animation: slideUp 0.2s ease;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.comment-author {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

.comment-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.comment-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.comment-form input,
.comment-form textarea {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

.comment-form input:focus,
.comment-form textarea:focus {
  border-color: var(--accent);
}

.comment-form textarea {
  min-height: 70px;
  resize: none;
}

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideUp 0.3s ease;
}

.flash-success {
  background: rgba(34,197,94,0.15);
  border: 1px solid rgba(34,197,94,0.35);
  color: var(--success);
}

.flash-error {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.35);
  color: var(--danger);
}

.flash-info {
  background: rgba(249,115,22,0.15);
  border: 1px solid rgba(249,115,22,0.35);
  color: var(--accent);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: slideUp 0.3s ease;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-left: 4px solid var(--accent);
}

.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast.fade-out { opacity: 0; transition: opacity 0.4s ease; }

/* ============================================================
   TRIP HEADER & STATS
   ============================================================ */
.trip-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.trip-header h1 {
  font-size: 1.75rem;
  margin-bottom: 0.4rem;
}

.trip-description {
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-wrap;
}

.stats-bar {
  display: flex;
  gap: 2rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================================
   UPLOAD ZONE
   ============================================================ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--bg-tertiary);
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(249,115,22,0.05);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.upload-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.upload-text strong {
  color: var(--accent);
}

.upload-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.upload-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-tertiary);
}

.upload-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-preview-remove {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  background: rgba(239,68,68,0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
}

/* ============================================================
   LOCATION SEARCH
   ============================================================ */
.location-search-wrap {
  position: relative;
}

.location-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  z-index: 500;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.location-result-item {
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

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

.location-result-item:hover {
  background: var(--bg-tertiary);
  color: var(--accent);
}

#location-map-picker {
  height: 280px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: 0.5rem;
}

/* ============================================================
   PAGE LAYOUTS
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: radial-gradient(ellipse at top center, #1e3a5f 0%, var(--bg-primary) 70%);
}

.auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.4s ease;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo .logo-mark {
  width: 60px;
  height: 60px;
  background: var(--accent);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 8px 24px rgba(249,115,22,0.35);
}

.auth-logo h1 {
  font-size: 1.75rem;
  color: var(--text-primary);
}

.auth-logo h1 span {
  color: var(--accent);
}

.auth-logo p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2rem 0 1.5rem;
}

.dashboard-header h1 {
  font-size: 1.75rem;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  grid-column: 1 / -1;
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  line-height: 1;
}

.empty-state h2 {
  font-size: 1.4rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto 1.5rem;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-top: 2rem;
}

.page-header-left h1 {
  font-size: 1.75rem;
}

.page-header-left .breadcrumb {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.page-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

/* ============================================================
   SHARE LINK BOX
   ============================================================ */
.share-box {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.share-url {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-family: 'SFMono-Regular', Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}

/* ============================================================
   CONFIRMATION DIALOG
   ============================================================ */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.dialog h3 {
  margin-bottom: 0.75rem;
}

.dialog p {
  margin-bottom: 1.5rem;
}

.dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ============================================================
   MOBILE MAP TOGGLE
   ============================================================ */
.map-toggle-btn {
  display: none;
  width: 100%;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
}

.map-toggle-btn:hover {
  background: #3d5068;
}

.mobile-map-wrap {
  height: 300px;
  display: none;
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

/* ============================================================
   LOCATION PIN ICON
   ============================================================ */
.location-pin {
  color: var(--accent);
  font-size: 1rem;
}

/* ============================================================
   STEP EDIT LIST (trip_edit.php)
   ============================================================ */
.step-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.step-list-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: grab;
  transition: background var(--transition), border-color var(--transition);
}

.step-list-item:hover {
  border-color: var(--accent);
}

.step-list-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.step-list-item.drag-over {
  border-color: var(--accent);
  background: rgba(249,115,22,0.08);
}

.step-list-drag {
  color: var(--text-muted);
  cursor: grab;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.step-list-num {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

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

.step-list-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-list-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.step-list-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* ============================================================
   SECTION
   ============================================================ */
.section {
  padding: 2rem 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ============================================================
   COVER IMAGE PREVIEW
   ============================================================ */
.cover-preview {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: none;
  margin-top: 0.5rem;
}

.cover-preview.visible {
  display: block;
}

/* ============================================================
   SHARE PAGE BANNER
   ============================================================ */
.share-banner {
  background: rgba(249,115,22,0.1);
  border-bottom: 1px solid rgba(249,115,22,0.2);
  padding: 0.6rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.share-banner a {
  color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.animate-fadeIn  { animation: fadeIn  0.4s ease; }
.animate-slideUp { animation: slideUp 0.4s ease; }
.animate-pulse   { animation: pulse   1.5s ease infinite; }

/* ============================================================
   RESPONSIVE — 1024px
   ============================================================ */
@media (max-width: 1024px) {
  .trips-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .split-layout {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .split-map {
    display: none;
    width: 100%;
    height: 300px;
    position: static;
  }

  .split-map.mobile-visible {
    display: block;
  }

  .step-inline-map {
    display: block;
  }

  .split-content {
    width: 100%;
    overflow-y: visible;
  }

  .mobile-map-wrap {
    display: block;
  }

  .map-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   RESPONSIVE — 768px
   ============================================================ */
@media (max-width: 768px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }

  .trips-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .stats-bar {
    gap: 1rem;
    padding: 0.75rem 1rem;
  }

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

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .navbar-title {
    display: none;
  }

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

  .timeline {
    padding-left: 2.5rem;
  }

  .timeline::before {
    left: 0.85rem;
  }

  .step-number {
    left: -1.9rem;
    width: 1.6rem;
    height: 1.6rem;
    font-size: 0.7rem;
  }

  .auth-card {
    padding: 2rem 1.25rem;
  }

  #toast-container {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }

  .toast {
    max-width: 100%;
  }

  .share-box {
    flex-direction: column;
  }

  .share-url {
    width: 100%;
  }
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================================
   UTILITY MISC
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

.d-none { display: none !important; }
.d-flex { display: flex !important; }

.overflow-hidden { overflow: hidden; }

pre {
  white-space: pre-wrap;
  word-break: break-word;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-accent {
  background: rgba(249,115,22,0.15);
  color: var(--accent);
}

/* Page content padding */
.page-content {
  padding-top: 2rem;
  padding-bottom: 4rem;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 540px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  animation: slideUp 0.2s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-header h3 { font-size:1.1rem; font-weight:700; margin:0; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.25rem; cursor: pointer; padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.share-url-row { display:flex; gap:0.5rem; margin-bottom:1rem; }
.share-url-row input {
  flex:1; font-family:monospace; font-size:0.82rem; color:var(--accent);
  background:var(--input-bg); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:0.5rem 0.75rem;
}
.share-hint { font-size:0.8rem; color:var(--text-muted); line-height:1.5; }

/* ============================================================
   IMPORT PAGE
   ============================================================ */
.import-step-indicator {
  display:flex; margin-bottom:2rem;
  border-radius:var(--radius-md); overflow:hidden; border:1px solid var(--border);
}
.import-step-indicator .ist-step {
  flex:1; padding:0.6rem 1rem; text-align:center;
  font-size:0.82rem; font-weight:600;
  background:var(--bg-tertiary); color:var(--text-muted);
}
.import-step-indicator .ist-step.active { background:var(--accent); color:#fff; }
.import-step-indicator .ist-step.done  { background:rgba(34,197,94,0.2); color:var(--success); }
.import-places-table { width:100%; border-collapse:collapse; font-size:0.88rem; }
.import-places-table th {
  text-align:left; padding:0.6rem 0.75rem; color:var(--text-muted);
  font-size:0.75rem; font-weight:600; text-transform:uppercase; letter-spacing:0.05em;
  border-bottom:1px solid var(--border);
}
.import-places-table td {
  padding:0.6rem 0.75rem; border-bottom:1px solid rgba(51,65,85,0.5); vertical-align:middle;
}
.import-places-table tr:hover td { background:rgba(255,255,255,0.02); }
.import-places-table input[type="checkbox"] { width:1rem; height:1rem; accent-color:var(--accent); cursor:pointer; }
.import-places-table input[type="text"] {
  background:var(--bg-primary); border:1px solid var(--border); border-radius:4px;
  padding:0.25rem 0.5rem; color:var(--text-primary); font-size:0.85rem; width:100%;
}
.import-places-table input[type="text"]:focus { outline:none; border-color:var(--accent); }
.dur-badge {
  display:inline-block; padding:0.15rem 0.5rem; border-radius:999px;
  font-size:0.75rem; background:var(--bg-tertiary); color:var(--text-secondary);
}
.import-select-bar {
  display:flex; align-items:center; gap:1rem; padding:0.75rem 1rem;
  background:var(--bg-tertiary); border-radius:var(--radius-sm);
  margin-bottom:1rem; font-size:0.88rem;
}
.import-select-bar button {
  background:none; border:none; color:var(--accent); cursor:pointer;
  font-size:0.85rem; padding:0; text-decoration:underline;
}
.format-hint {
  background:rgba(249,115,22,0.08); border:1px solid rgba(249,115,22,0.2);
  border-radius:var(--radius-sm); padding:1rem; font-size:0.85rem;
  color:var(--text-secondary); line-height:1.6; margin-bottom:1.5rem;
}
.format-hint strong { color:var(--accent); }
