/* ============================================
   BANGIN' TRAVEL - Design System
   A retro-playful travel coordination app
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Bungee&family=Inter:wght@400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  /* Primary Colors */
  --primary-blue: #3498db;
  --primary-blue-dark: #2980b9;
  --accent-orange: #f39c12;
  --accent-orange-dark: #e67e22;

  /* Background & Surface */
  --warm-sand: #fdfaf5;
  --cream: #f8f4eb;
  --white: #ffffff;

  /* Text */
  --dark-ink: #2c3e50;
  --text-secondary: #5d6d7e;
  --text-muted: #95a5a6;

  /* Semantic Colors */
  --success: #27ae60;
  --warning: #f1c40f;
  --danger: #e74c3c;
  --info: #3498db;

  /* Entity Colors */
  --flight-color: #3498db;
  --stay-color: #9b59b6;
  --transit-color: #1abc9c;
  --activity-color: #e67e22;

  /* Priority Colors */
  --priority-must: #e74c3c;
  --priority-nice: #3498db;
  --priority-optional: #95a5a6;

  /* Type Badges */
  --badge-departure: #27ae60;
  --badge-return: #e67e22;
  --badge-internal: #3498db;

  /* Retro Design Tokens */
  --border-width: 3px;
  --border-color: var(--dark-ink);
  --shadow-retro: 6px 6px 0px 0px var(--dark-ink);
  --shadow-retro-sm: 3px 3px 0px 0px var(--dark-ink);
  --shadow-retro-hover: 4px 4px 0px 0px var(--dark-ink);
  --radius-retro: 12px;
  --radius-sm: 6px;
  --radius-pill: 50px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Typography */
  --font-display: 'Bungee', cursive;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

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

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

body {
  background-color: var(--warm-sand);
  color: var(--dark-ink);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.125rem;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 1px;
}

.brand {
  cursor: pointer;
  transition: var(--transition-fast);
}

.brand:hover {
  transform: scale(1.02);
  filter: brightness(1.1);
}

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

.text-secondary {
  color: var(--text-secondary);
}

.text-small {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

/* ============================================
   APP LAYOUT
   ============================================ */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================
   AUTH VIEW
   ============================================ */
#auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-lg);
  background: linear-gradient(135deg, var(--warm-sand) 0%, var(--cream) 100%);
}

.auth-card {
  background: var(--white);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-retro);
  box-shadow: var(--shadow-retro);
  padding: var(--space-2xl);
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.auth-card .brand-title {
  margin-bottom: var(--space-sm);
}

.auth-card p {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.auth-card input[type="email"] {
  padding: var(--space-md);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: var(--transition-fast);
}

.auth-card input[type="email"]:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--text-muted);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--cream);
}

.auth-card .small {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
  background: var(--accent-orange);
  color: var(--white);
  border: var(--border-width) solid var(--border-color);
  padding: 14px 28px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  border-radius: var(--radius-retro);
  box-shadow: var(--shadow-retro-sm);
  transition: var(--transition-fast);
}

.btn-primary:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0px 0px var(--dark-ink);
}

.btn-primary:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.btn-primary-compact {
  background: var(--accent-orange);
  color: var(--white);
  border: var(--border-width) solid var(--border-color);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-retro-sm);
  transition: var(--transition-fast);
}

.btn-primary-compact:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0px 0px var(--dark-ink);
}

.btn-primary-compact:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.btn-secondary {
  background: var(--white);
  color: var(--dark-ink);
  border: var(--border-width) solid var(--border-color);
  padding: 14px 28px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: var(--radius-retro);
  box-shadow: var(--shadow-retro-sm);
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--cream);
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0px 0px var(--dark-ink);
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  cursor: pointer;
  padding: var(--space-sm) var(--space-md);
  transition: var(--transition-fast);
}

.btn-text:hover {
  color: var(--dark-ink);
}

.btn-icon {
  background: var(--white);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  background: var(--cream);
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
/* ============================================
   RESPONSIVE HEADER LAYOUT
   ============================================ */
.main-header {
  background: var(--white);
  border-bottom: var(--border-width) solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0;
  /* Let children handle padding or grid gaps */
}

/* Base Mobile Layout (Default) */
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  height: 70px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.main-nav {
  display: flex;
  overflow-x: auto;
  padding: 0 var(--space-md);
  border-top: var(--border-width) solid var(--border-color);
  background: var(--white);
  -ms-overflow-style: none;
  /* Hide scrollbar IE/Edge */
  scrollbar-width: none;
  /* Hide scrollbar Firefox */
}

.main-nav::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  padding: var(--space-md);
  white-space: nowrap;
  background: none;
  border: none;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.nav-tab.active {
  color: var(--primary-blue);
  border-bottom-color: var(--primary-blue);
}



/* Desktop Layout (min-width: 1024px) */
@media (min-width: 1024px) {
  .main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    padding: 0 var(--space-lg);
  }

  /* Flatten structure to put everything in one row */
  .header-content {
    display: contents;
    /* Removes this wrapper from layout flow */
  }

  .header-left {
    display: contents;
    /* Removes this wrapper too */
  }

  /* Explicit Order for Single Row */
  .hamburger-btn {
    display: none;
  }

  .brand {
    order: 1;
    margin-right: var(--space-lg);
  }

  #trip-switcher-container {
    order: 2;
    margin-right: var(--space-lg);
  }

  /* Nav moves to middle */
  .main-nav {
    order: 3;
    flex: 1;
    border-top: none;
    padding: 0;
    justify-content: center;
    /* Center tabs */
    height: 100%;
    /* Fill header height */
  }

  .nav-tab {
    height: 100%;
    /* Fill height */
    padding: 0 var(--space-md);
    display: flex;
    align-items: center;
  }

  /* Profile moves to end */
  .header-right {
    order: 4;
    margin-left: var(--space-lg);
  }
}

.nav-tab.active {
  background: var(--accent-orange);
  color: var(--white);
  border-color: var(--border-color);
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.app-content {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-xl);
  width: 100%;
}

.view {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--white);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-retro);
  box-shadow: var(--shadow-retro);
  overflow: hidden;
}

.card-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 2px solid var(--cream);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: var(--space-lg);
}

.card-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 2px solid var(--cream);
  background: var(--cream);
}

/* Entity Cards */
.entity-card {
  background: var(--white);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-retro);
  box-shadow: var(--shadow-retro-sm);
  margin-bottom: var(--space-lg);
  overflow: hidden;
  transition: var(--transition-fast);
}

.entity-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-retro);
}

.entity-card-header {
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  border-bottom: 2px dashed var(--cream);
}

.entity-card-body {
  padding: var(--space-lg);
}

.entity-card-footer {
  padding: var(--space-md) var(--space-lg);
  background: var(--cream);
  border-top: 2px dashed var(--cream);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
}

.badge-departure {
  background: var(--badge-departure);
  color: var(--white);
}

.badge-return {
  background: var(--badge-return);
  color: var(--white);
}

.badge-internal {
  background: var(--badge-internal);
  color: var(--white);
}

.badge-must-do {
  background: var(--priority-must);
  color: var(--white);
}

.badge-nice-to-have {
  background: var(--priority-nice);
  color: var(--white);
}

.badge-optional {
  background: var(--priority-optional);
  color: var(--white);
}

.badge-type {
  background: var(--cream);
  color: var(--dark-ink);
}

/* ============================================
   AVATARS
   ============================================ */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--white);
  flex-shrink: 0;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.625rem;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1rem;
}

.avatar-group {
  display: flex;
  align-items: center;
}

.avatar-group .avatar {
  margin-left: -8px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

.avatar-organizer::after {
  content: '👑';
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 0.75rem;
}

.avatar-organizer {
  position: relative;
}

/* ============================================
   TRAVELER LIST
   ============================================ */
.traveler-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.traveler-chip {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  background: var(--cream);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
}

.traveler-chip .avatar {
  width: 24px;
  height: 24px;
  font-size: 0.5rem;
}

/* ============================================
   SUMMARY TAB
   ============================================ */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

@media (min-width: 768px) {
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1200px) {
  .summary-grid {
    grid-template-columns: 2fr 1fr;
  }
}

.trip-header {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-xl);
}

.trip-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  margin-bottom: var(--space-sm);
}

.trip-dates {
  font-size: 1.25rem;
  color: var(--text-secondary);
}

.trip-destination {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--cream);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-pill);
  margin-top: var(--space-md);
  font-weight: 500;
}

/* Map Container */
.map-container {
  grid-column: 1 / -1;
  height: 300px;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-retro);
  overflow: hidden;
  box-shadow: var(--shadow-retro-sm);
}

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

/* Flight Summary Cards */
.flight-summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

@media (min-width: 768px) {
  .flight-summary-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.flight-summary-card {
  background: var(--white);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-retro);
  padding: var(--space-lg);
  box-shadow: var(--shadow-retro-sm);
}

.flight-summary-card h4 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.flight-route {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.flight-route .arrow {
  color: var(--text-muted);
}

.flight-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-md);
}

.stat-item {
  text-align: center;
  padding: var(--space-md);
  background: var(--cream);
  border-radius: var(--radius-sm);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark-ink);
}

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

/* ============================================
   CALENDAR TAB
   ============================================ */
.calendar-container {
  background: var(--white);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-retro);
  box-shadow: var(--shadow-retro);
  overflow: hidden;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  background: var(--cream);
  border-bottom: var(--border-width) solid var(--border-color);
}

.calendar-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
}

.calendar-nav {
  display: flex;
  gap: var(--space-sm);
}

.calendar-nav button {
  background: var(--white);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-fast);
}

.calendar-nav button:hover {
  background: var(--accent-orange);
  color: var(--white);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--dark-ink);
  color: var(--white);
}

.calendar-weekday {
  padding: var(--space-sm);
  text-align: center;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
  min-height: 100px;
  border-right: 1px solid var(--cream);
  border-bottom: 1px solid var(--cream);
  padding: var(--space-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

.calendar-day:nth-child(7n) {
  border-right: none;
}

.calendar-day:hover {
  background: var(--cream);
}

.calendar-day.outside-month {
  background: #f9f9f9;
  color: var(--text-muted);
}

.calendar-day.in-trip {
  background: rgba(52, 152, 219, 0.08);
}

.calendar-day.today {
  background: rgba(243, 156, 18, 0.15);
}

.calendar-day.today::before {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--accent-orange);
  border-radius: 50%;
}

.day-number {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: var(--space-xs);
}

.day-events {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.day-event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.day-event-dot.flight {
  background: var(--flight-color);
}

.day-event-dot.stay {
  background: var(--stay-color);
}

.day-event-dot.transit {
  background: var(--transit-color);
}

.day-event-dot.activity {
  background: var(--activity-color);
}

/* ============================================
   DAY DETAIL MODAL
   ============================================ */
.day-detail-header {
  margin-bottom: var(--space-lg);
}

.day-detail-date {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
}

.day-detail-meta {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.timeline {
  position: relative;
  padding-left: var(--space-xl);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--cream);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-lg);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-xl) + 6px);
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--white);
}

.timeline-item.flight::before {
  background: var(--flight-color);
}

.timeline-item.stay::before {
  background: var(--stay-color);
}

.timeline-item.transit::before {
  background: var(--transit-color);
}

.timeline-item.activity::before {
  background: var(--activity-color);
}

.timeline-time {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.timeline-content {
  background: var(--cream);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--dark-ink);
}

.timeline-content.flight {
  border-left-color: var(--flight-color);
}

.timeline-content.stay {
  border-left-color: var(--stay-color);
}

.timeline-content.transit {
  border-left-color: var(--transit-color);
}

.timeline-content.activity {
  border-left-color: var(--activity-color);
}

.timeline-title {
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.timeline-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ============================================
   FLIGHTS TAB
   ============================================ */
.tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.tab-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.tab-title h2 {
  font-family: var(--font-heading);
}

.flight-card {
  margin-bottom: var(--space-lg);
}

.flight-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--cream);
  border-bottom: 2px dashed var(--border-color);
}

.flight-card-body {
  padding: var(--space-lg);
}

.flight-route-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.flight-endpoint {
  text-align: center;
}

.flight-endpoint.arrival {
  text-align: center;
}

.airport-code {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 2px;
}

.airport-city {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.flight-time-group {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}

.flight-time {
  font-weight: 600;
  margin-top: var(--space-xs);
}

.flight-offset {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

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

.flight-path {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-lg);
}

.flight-path-line {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  max-width: 300px;
}

.flight-path-line .line {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--dark-ink) 50%, transparent 50%);
  background-size: 8px 2px;
}

.flight-path-line .plane {
  font-size: 1.5rem;
  transform: rotate(0deg);
}

.flight-details {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px dashed var(--cream);
}

.flight-detail-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.flight-detail-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.flight-detail-value {
  font-weight: 600;
}

/* ============================================
   STAYS TAB
   ============================================ */
.stay-card {
  margin-bottom: var(--space-lg);
}

.stay-card-content {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-lg);
}

.stay-thumbnail {
  width: 120px;
  height: 120px;
  background: var(--cream);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.stay-info h3 {
  margin-bottom: var(--space-xs);
}

.stay-type {
  display: inline-block;
  margin-bottom: var(--space-sm);
}

.stay-dates {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
}

.stay-date-item {
  display: flex;
  flex-direction: column;
}

.stay-date-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stay-date-value {
  font-weight: 600;
}

.stay-address {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.amenities-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.amenity-pill {
  background: var(--cream);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
}

.stay-cost {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: rgba(39, 174, 96, 0.1);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.stay-cost-total {
  font-weight: 700;
}

/* ============================================
   TRANSIT TAB
   ============================================ */
.transit-card {
  margin-bottom: var(--space-lg);
}

.transit-type-badge {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.transit-route-display {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.transit-station {
  flex: 1;
}

.transit-station-name {
  font-weight: 600;
  font-size: 1rem;
}

.transit-station-time {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.transit-arrow {
  font-size: 1.5rem;
  color: var(--transit-color);
}

.transit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  font-size: 0.875rem;
}

.transit-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.jr-pass-badge {
  background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
  color: var(--white);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* ============================================
   ACTIVITIES TAB
   ============================================ */
.activities-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.filter-btn {
  background: var(--white);
  border: 2px solid var(--border-color);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: var(--transition-fast);
}

.filter-btn:hover {
  background: var(--cream);
}

.filter-btn.active {
  background: var(--dark-ink);
  color: var(--white);
}

.activity-day-group {
  margin-bottom: var(--space-xl);
}

.activity-day-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--dark-ink);
}

.activity-day-date {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
}

.activity-day-location {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.activity-card {
  margin-bottom: var(--space-md);
}

.activity-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.activity-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.activity-icon {
  font-size: 1.25rem;
}

.activity-time-location {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  margin: var(--space-md) 0;
  font-size: 0.875rem;
}

.activity-notes {
  background: var(--cream);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(44, 62, 80, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--white);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-retro);
  box-shadow: var(--shadow-retro);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: var(--white);
  border: 2px solid var(--border-color);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  /* Ensure above header elements */
  transition: var(--transition-fast);
}

.modal-close:hover {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}

#modal-body {
  padding: var(--space-xl);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  background: var(--dark-ink);
  color: var(--white);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-retro-sm);
  font-weight: 500;
  animation: toastIn 0.3s ease;
  z-index: 2000;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

/* Hamburger Button (hidden on desktop) */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}

.hamburger-btn span {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--accent-orange);
  border-radius: 2px;
  transition: var(--transition-fast);
}

/* Mobile Navigation Drawer */
.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: var(--dark-ink);
  z-index: 10000;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  padding: 0;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.drawer-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.drawer-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.drawer-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.drawer-user-info {
  color: white;
}

.drawer-user-name {
  font-weight: 600;
  font-size: 1rem;
}

.drawer-user-email {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
}

.drawer-nav {
  padding: 16px 0;
}

.drawer-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 1rem;
  font-family: var(--font-body);
}

.drawer-nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.drawer-nav-item.active {
  background: var(--accent-orange);
  color: white;
}

.drawer-nav-item .icon {
  font-size: 1.25rem;
}

.drawer-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 8px 0;
}

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
}

.drawer-footer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
}

.drawer-footer-item:hover {
  color: white;
}

/* ============================================
   TABLET LANDSCAPE (768-1024px)
   Compact nav tabs with icons, no hamburger yet
   ============================================ */
@media (max-width: 1024px) and (min-width: 769px) {
  .main-header {
    padding: var(--space-sm) var(--space-md);
  }

  .header-content {
    gap: var(--space-sm);
  }

  .brand {
    font-size: 1rem;
  }

  /* Compact nav tabs */
  .nav-tab {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
  }

  /* Hide text, show icons on very tight space */
  .trip-switcher-name {
    max-width: 100px;
  }

  /* Note: Timeline column hiding removed - all 7 days should be visible */
}

@media (max-width: 768px) {

  /* Condensed Header */
  .main-header {
    padding: 10px 12px;
  }

  .header-content {
    flex-direction: row;
    gap: var(--space-xs);
  }

  .brand {
    font-size: 0.85rem;
  }

  /* Hide desktop nav, show hamburger */
  .main-nav {
    display: none;
  }

  .hamburger-btn {
    display: flex;
  }

  /* Hide user info on mobile - it's in the drawer */
  .header-right {
    display: none;
  }

  /* Simplify trip switcher on mobile */
  .trip-switcher-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
    border: none;
    background: transparent;
  }

  .trip-switcher-icon {
    display: none;
  }

  .trip-switcher-arrow {
    font-size: 0.5rem;
  }

  .header-left {
    gap: var(--space-xs);
  }

  /* App Content */
  .app-content {
    padding: var(--space-md);
  }

  .trip-title {
    font-size: 1.5rem;
  }

  /* Full-screen Modals */
  .modal-overlay {
    padding: 0;
  }

  .modal-content {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }

  .modal-close {
    top: 12px;
    right: 12px;
  }

  /* Flight Cards */
  .flight-route-display {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .flight-path {
    transform: rotate(90deg);
    padding: var(--space-md) 0;
  }

  .flight-endpoint {
    width: 100%;
  }

  /* Stay Cards */
  .stay-card-content {
    grid-template-columns: 1fr;
  }

  .stay-thumbnail {
    width: 100%;
    height: 160px;
  }

  /* Calendar */
  .calendar-day {
    min-height: 60px;
    padding: var(--space-xs);
  }

  .day-number {
    font-size: 0.75rem;
  }

  /* Note: Timeline column hiding removed - all 7 days should be visible */
}

@media (max-width: 480px) {

  /* Smaller header */
  .main-header {
    padding: 10px 12px;
  }

  .brand {
    font-size: 0.9rem;
  }
}

/* Leaflet Overrides */
.leaflet-container {
  font-family: var(--font-body);
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
}

.leaflet-popup-content {
  margin: var(--space-sm);
  font-size: 0.875rem;
}

/* ============================================
   TRIPS VIEW
   ============================================ */
#trips-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-lg);
  background: linear-gradient(135deg, var(--warm-sand) 0%, var(--cream) 100%);
}

.trips-container {
  max-width: 600px;
  width: 100%;
}

.trips-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.trips-subtitle {
  color: var(--text-secondary);
  margin-top: var(--space-sm);
}

.trips-section-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.trips-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.trips-empty {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-muted);
}

/* Trip Cards */
.trip-card {
  background: var(--white);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-retro);
  box-shadow: var(--shadow-retro-sm);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  cursor: pointer;
  transition: var(--transition-fast);
}

.trip-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-retro);
}

.trip-card:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.trip-card-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

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

.trip-card-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.125rem;
  margin-bottom: var(--space-xs);
}

.trip-card-dates {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.trip-card-travelers {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.trip-card-arrow {
  font-size: 1.5rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.trip-card-new {
  background: var(--cream);
  border-style: dashed;
}

.trip-card-new:hover {
  background: var(--white);
}

/* ============================================
   PASSWORD MODAL
   ============================================ */
.password-modal {
  text-align: center;
}

.password-modal h2 {
  margin-bottom: var(--space-sm);
}

.password-modal p {
  margin-bottom: var(--space-lg);
}

/* ============================================
   TRIP SETUP FORM
   ============================================ */
.trip-setup-form h2 {
  margin-bottom: var(--space-sm);
}

.trip-setup-form>p {
  margin-bottom: var(--space-lg);
}

.form-group {
  margin-bottom: var(--space-md);
  text-align: left;
}

.form-group label {
  display: block;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: var(--space-xs);
  color: var(--dark-ink);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"] {
  width: 100%;
  padding: var(--space-md);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: var(--transition-fast);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-error {
  background: rgba(231, 76, 60, 0.1);
  color: var(--danger);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: var(--space-md);
}

.form-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.form-actions .btn-secondary {
  flex: 1;
}

.form-actions .btn-primary {
  flex: 2;
}

/* ============================================
   TRIP SWITCHER (Header)
   ============================================ */
.trip-switcher {
  position: relative;
}

.trip-switcher-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: transparent;
  border: 1px solid rgba(44, 62, 80, 0.2);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.trip-switcher-btn:hover {
  background: var(--cream);
  border-color: var(--border-color);
}

.trip-switcher-icon {
  font-size: 1rem;
}

.trip-switcher-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trip-switcher-arrow {
  font-size: 0.625rem;
  color: var(--text-muted);
}

.trip-switcher-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 200px;
  background: var(--white);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-retro-sm);
  z-index: 200;
  overflow: hidden;
}

.trip-switcher-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
}

.trip-switcher-option:hover {
  background: var(--cream);
}

.trip-switcher-option.active {
  background: rgba(52, 152, 219, 0.1);
  font-weight: 600;
}

.trip-switcher-divider {
  height: 1px;
  background: var(--cream);
  margin: var(--space-xs) 0;
}

.current-trip-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.875rem;
  padding: var(--space-sm) var(--space-md);
  background: var(--cream);
  border-radius: var(--radius-sm);
}

/* Header layout update for trip switcher */
.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

@media (min-width: 769px) {
  .header-left {
    flex: 1;
  }

  .header-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
  }

  .header-right .user-email {
    font-weight: 500;
    color: var(--dark-ink);
  }

  .header-right .btn-text,
  .header-right .btn-secondary {
    font-size: 0.75rem;
    padding: var(--space-xs) var(--space-sm);
  }
}

/* Map View Specifics */
#tab-map {
  height: 100%;
  flex-direction: column;
}

#tab-map.active {
  display: flex;
}

.map-view-container {
  flex: 1;
  position: relative;
  /* Context for absolute children */
  /* Break out of parent padding */
  margin: calc(var(--space-xl) * -1);
  width: calc(100% + (var(--space-xl) * 2));
  height: calc(100% + (var(--space-xl) * 2));
}

@media (max-width: 768px) {
  .map-view-container {
    /* Mobile app-content padding might be different? usually space-md */
    margin: calc(var(--space-md) * -1);
    width: calc(100% + (var(--space-md) * 2));
    height: calc(100% + (var(--space-md) * 2));
  }
}

/* Base Switcher Visibility (Hidden on Mobile) */
#trip-switcher-container {
  display: none;
}

/* Tablet & Desktop: Show Header Switcher (Raised to 1280px) */
@media (min-width: 1280px) {
  #trip-switcher-container {
    display: block;
  }
}

/* Brand Styling */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.brand-icon {
  font-size: 1.5rem;
}

.brand-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--dark-ink);
}

.brand:hover {
  transform: scale(1.02);
  filter: brightness(1.1);
}

/* Trip Switcher Two-Row Layout */
.trip-switcher-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.trip-switcher-dates {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Map Info Bar: Mobile Only */
.map-info-bar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 1280px) {

  /* Hide Map Switcher on Desktop (1280px+) */
  .map-info-bar {
    display: none;
  }
}

/* Style the switcher button inside map to match original info bar pill */
.map-info-bar .trip-switcher-btn {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 8px 16px;
  border-radius: 20px;
}

.map-info-bar strong {
  color: var(--primary-blue);
  font-family: var(--font-heading);
}

#dashboard-view {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Prevent body scroll, handle inside tabs */
}

@media (max-width: 768px) {
  .trip-switcher-name {
    max-width: 100px;
  }

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

/* ============================================
   IMPORT ZONE
   ============================================ */
.import-zone {
  border: 2px dashed var(--border-color);
  background-color: var(--warm-sand);
  border-radius: var(--radius-retro);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-bottom: var(--space-lg);
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

.import-zone:hover,
.import-zone.drag-active {
  background-color: var(--white);
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
}

.import-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  color: var(--text-muted);
}

.import-text {
  font-family: var(--font-heading);
  font-weight: 500;
  color: var(--dark-ink);
}

.import-text .cmd-shortcut {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--text-secondary);
}

.form-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  margin: var(--space-lg) 0;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
  opacity: 0.3;
}

.form-divider span {
  padding: 0 var(--space-md);
}

/* ============================================
   LOGIN PROMPT
   ============================================ */
.login-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-2xl);
  min-height: 50vh;
}

.login-prompt h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: var(--space-md);
}

.login-prompt p {
  color: var(--text-secondary);
  font-size: 1.125rem;
  margin-bottom: var(--space-lg);
}

/* ============================================
   ROLE BADGES
   ============================================ */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
}

.role-badge.organizer {
  background: var(--accent-orange);
  color: var(--white);
}

.role-badge.contributor {
  background: var(--primary-blue);
  color: var(--white);
}

/* ============================================
   LEDGER STYLES
   ============================================ */
.ledger-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  margin-top: var(--space-lg);
}

@media (min-width: 992px) {
  .ledger-grid {
    grid-template-columns: 1.5fr 1fr;
  }
}

.ledger-total-card {
  background: var(--dark-ink);
  color: var(--white);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.ledger-total-card .stat-label {
  color: var(--text-muted);
}

.ledger-total-card .stat-value {
  color: var(--accent-orange);
  font-size: 3rem;
}

.ledger-section h3 {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--border-color);
}

.balance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background: var(--white);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
}

.balance-amount {
  font-weight: 700;
  font-size: 1.1rem;
}

.debt-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.debt-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-retro);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-retro-sm);
}

.debt-from,
.debt-to {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  min-width: 80px;
}

.debt-arrow {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.debt-amount {
  background: var(--cream);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border-color);
  font-weight: 700;
  font-size: 0.875rem;
  margin-bottom: 4px;
}

.debt-arrow .arrow {
  font-size: 1.5rem;
  color: var(--text-muted);
}

.ledger-balance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background: var(--white);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
}

.ledger-balance-item .traveler-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.ledger-balance-item .traveler-name {
  font-weight: 600;
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

/* Account Settings Button */
.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.account-btn {
  background: var(--white);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-retro);
  padding: 6px 12px;
  color: var(--dark-ink);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-retro-sm);
  transition: var(--transition-fast);
  white-space: nowrap;
}

.account-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-retro);
}

.account-btn:active {
  transform: translate(0, 0);
  box-shadow: var(--shadow-retro-sm);
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--cream);
  border-top: 5px solid var(--accent-orange);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--space-md);
}

.loading-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--dark-ink);
  animation: pulse 1.5s infinite ease-in-out;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.6;
  }
}

/* ============================================
   CALENDAR DETAILS (Redesign)
   ============================================ */

.day-details-container {
  margin-top: 24px;
  padding: 24px;
  background: var(--white);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-retro);
  box-shadow: var(--shadow-retro-sm);
  animation: fadeIn 0.3s ease;
}

.day-detail-header {
  border-bottom: 2px dashed var(--border-color);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.day-detail-date {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--primary-color);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--text-color);
}

.timeline-item.flight {
  border-left-color: var(--badge-departure);
}

.timeline-item.stay {
  border-left-color: var(--badge-internal);
}

.timeline-item.activity {
  border-left-color: var(--priority-must);
}

.timeline-item.transit {
  border-left-color: var(--badge-return);
}

.timeline-time {
  font-family: var(--font-mono);
  font-weight: 700;
  white-space: nowrap;
  min-width: 80px;
}

.timeline-content {
  flex: 1;
}

.timeline-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.timeline-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Selected Day State */
.calendar-day.selected {
  border-color: var(--primary-color) !important;
  background-color: var(--cream) !important;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 2;
}

/* ============================================
   UNIFIED CARD DESIGN (Refactor 2026)
   ============================================ */

.unified-card {
  display: flex;
  background: var(--white);
  border-radius: 12px;
  padding: 12px;
  gap: 12px;
  align-items: flex-start;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-color);
  border-color: #e5e7eb;
  margin-bottom: 12px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.unified-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.unified-card.booked {
  border-color: #d1fae5;
  background: linear-gradient(to bottom right, #f0fdf4 0%, #ffffff 40%);
}

.unified-card .card-left {
  flex-shrink: 0;
}

.unified-card .card-icon {
  width: 36px;
  height: 36px;
  background: #f3f4f6;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.unified-card .card-right {
  flex: 1;
  min-width: 0;
}

.unified-card .eyebrow-row {
  margin-bottom: 3px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1;
}

.unified-card .status-text.text-green {
  color: #059669;
}

.unified-card .status-text.text-gray {
  color: #9ca3af;
}

.unified-card .card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  line-height: 1.35;
  word-wrap: break-word;
  font-family: var(--font-body);
}

.unified-card .card-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unified-card .meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 6px;
}

.unified-card .meta-item {
  font-size: 11px;
  color: #4b5563;
  background: #f9fafb;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.unified-card .card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: -2px;
  margin-left: 4px;
}

.unified-card .btn-action {
  border: none;
  background: #f3f4f6;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  text-decoration: none;
  width: 32px;
  height: 32px;
}

.unified-card .btn-action:hover {
  background: #e5e7eb;
}

.unified-card .map-btn {
  background: #eff6ff;
  color: #1d4ed8;
}

.unified-card .map-btn:hover {
  background: #dbeafe;
}

.unified-card .edit-btn {
  opacity: 0.6;
}

.unified-card .edit-btn:hover {
  opacity: 1;
}

@media (max-width: 480px) {
  .unified-card {
    padding: 10px;
    gap: 10px;
  }

  .unified-card .card-title {
    font-size: 14px;
  }
}

/* ============================================
   EVENT DETAILS MODAL VIEW
   ============================================ */
.details-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 80vh;
  /* Ensure it fits in modal */
}

/* Header */
.details-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  background: white;
  /* Add padding-right to avoid close button overlap if we didn't have z-index, 
     but we want content to flow nicely. Close button is top-right. */
  padding-right: 60px;
}

/* Old absolute badge removed, now inline */
.details-header .status-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.details-header .status-badge.booked {
  background: #dcfce7;
  color: #166534;
}

.details-header .status-badge.planned {
  background: #f3f4f6;
  color: #6b7280;
}

.details-header .header-content {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.details-header .header-icon {
  font-size: 32px;
  background: #f8fafc;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  flex-shrink: 0;
}

.details-header .header-text {
  flex: 1;
}

.details-header .type-label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.details-header .title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-color);
  margin: 0;
  line-height: 1.3;
}

.details-header .subtitle {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Body */
.details-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
  background: white;
}

.details-body .section-row {
  display: flex;
  gap: 12px;
}

.details-body .icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.details-body .section-content {
  flex: 1;
  font-size: 14px;
  color: var(--text-color);
}

.details-body .time-row {
  margin-bottom: 4px;
  line-height: 1.4;
}

.details-body .sub-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.details-body .location-block {
  margin-bottom: 12px;
}

.details-body .location-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.details-body .location-text {
  font-weight: 500;
  margin-bottom: 4px;
  line-height: 1.4;
}

.details-body .map-link {
  font-size: 12px;
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #eff6ff;
  border-radius: 6px;
  margin-top: 2px;
}

.details-body .map-link:hover {
  background: #dbeafe;
}

.details-body .section-header {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.details-body .notes-box {
  background: #fffbeb;
  color: #92400e;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.details-body .cost-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-color);
}

/* Footer */
.details-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  display: flex;
  gap: 12px;
  border-radius: 0 0 12px 12px;
  /* Match modal radius if needed */
}

/* Mobile Adjustments */
@media (max-width: 600px) {
  .details-view {
    max-height: 100vh;
  }

  .details-body {
    padding: 16px;
  }
}

/* ============================================
   TIMELINE COMPONENT
   Redesigned Week View (Vertical Drag & Drop)
   ============================================ */

/* Main Container */
.timeline-calendar {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 150px);
  min-height: 600px;
  background: var(--warm-sand, #fdfaf5);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--cream, #f8f4eb);
  border: 3px solid var(--border-color, #2c3e50);
  border-radius: 12px 12px 0 0;
  flex-wrap: wrap;
  gap: 12px;
}

.timeline-title h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
}

.week-range {
  font-size: 0.9rem;
  color: var(--text-secondary, #5d6d7e);
  margin-left: 12px;
}

/* Navigation Buttons */
.timeline-nav {
  display: flex;
  gap: 8px;
}

.btn-nav {
  padding: 8px 16px;
  background: white;
  border: 2px solid var(--border-color, #2c3e50);
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: 2px 2px 0 var(--border-color);
}

.btn-nav:hover {
  transform: translateY(-1px);
  box-shadow: 3px 3px 0 var(--border-color);
}

.btn-nav:active {
  transform: translateY(1px);
  box-shadow: 1px 1px 0 var(--border-color);
}

/* Instructions */
.timeline-instructions {
  padding: 8px 16px;
  background: white;
  border-left: 3px solid var(--border-color, #2c3e50);
  border-right: 3px solid var(--border-color, #2c3e50);
  font-size: 0.8rem;
  color: var(--text-secondary, #5d6d7e);
  text-align: center;
}

/* Grid Wrapper */
.timeline-wrapper {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  border: 3px solid var(--border-color, #2c3e50);
  border-top: none;
  border-radius: 0 0 12px 12px;
  background: white;
}

.hour-sidebar {
  flex: 0 0 60px;
  background: var(--cream, #f8f4eb);
  border-right: 2px solid var(--border-color, #2c3e50);
  overflow: hidden;
  /* No scroll bar */
  display: flex;
  flex-direction: column;
}

.hours-header-spacer {
  height: 52px;
  /* Matches day header */
  background: var(--cream);
  border-bottom: 2px solid var(--border-color);
  flex-shrink: 0;
}

.hour-label {
  height: 60px;
  /* 15px * 4 slots */
  padding: 2px 8px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  text-align: right;
  display: flex;
  justify-content: flex-end;
  box-sizing: border-box;
}

.timeline-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  /* Main vertical scroll */
  overflow-x: auto;
  /* Horizontal scroll for mobile */
  -webkit-overflow-scrolling: touch;
  background: var(--white);
  position: relative;
}

.timeline-grid {
  display: flex;
  /* Flex row for columns */
  flex: 1;
  min-width: 100%;
  /* Fill container */
}

.day-column {
  flex: 1;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  min-width: 65px;
  /* Force height so touch scroll works */
  position: relative;
}

.day-column:last-child {
  border-right: none;
}

.day-column.out-of-trip {
  background-color: rgba(0, 0, 0, 0.03);
}

.day-header {
  height: 52px;
  background: var(--cream);
  border-bottom: 2px solid var(--border-color);
  text-align: center;
  padding: 4px;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.day-header.today {
  background: var(--primary-blue);
  color: white;
}

.day-header-dow {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.2;
}

.day-header-date {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.2;
}

/* Day Slots (The interactive grid area) */
.day-slots {
  position: relative;
  cursor: crosshair;
  touch-action: pan-y;
  /* Allow vertical scroll */
  overscroll-behavior-y: none;
  /* Prevent pull-to-refresh */
  user-select: none;
  flex-shrink: 0;
  /* Fix for grid disappearing */
}

/* Items */
.timeline-item {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 0.75rem;
  cursor: pointer;
  border: 2px solid var(--border-color);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
  overflow: hidden;
  z-index: 5;
  transition: transform 0.1s;
}

.timeline-item:hover {
  transform: scale(1.02);
  z-index: 15;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.15);
}

.timeline-item.flight {
  background: var(--flight-color);
  color: white;
  border-color: #2980b9;
}

.timeline-item.stay {
  background: var(--stay-color);
  color: white;
  border-color: #8e44ad;
}

.timeline-item.transit {
  background: var(--transit-color);
  color: white;
  border-color: #16a085;
}

.timeline-item.activity {
  background: var(--activity-color);
  color: white;
  border-color: #d35400;
}

.slot-line {
  box-sizing: border-box;
  height: 15px !important;
  pointer-events: none;
}

.item-title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-time {
  font-size: 0.65rem;
  opacity: 0.9;
}

/* Selection / Draft Box */
.selection-box {
  position: absolute;
  left: 2px;
  right: 2px;
  background: rgba(52, 152, 219, 0.15);
  border: 2px solid var(--primary-blue);
  border-radius: 6px;
  z-index: 5;
  pointer-events: none;
  /* Let clicks pass through context */
}

.resize-handle {
  position: absolute;
  width: 24px;
  height: 12px;
  background: var(--primary-blue);
  border-radius: 6px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
  pointer-events: auto;
  /* Catch events */
  touch-action: none;
  /* Prevent scroll when grabbing handle */
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.resize-handle::after {
  content: '';
  width: 12px;
  height: 2px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 1px;
}

.resize-handle.top {
  top: -6px;
}

.resize-handle.bottom {
  bottom: -6px;
}

/* Floating Add Button */
.fab-add {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-orange);
  color: white;
  border: 3px solid var(--border-color);
  box-shadow: 4px 4px 0 var(--border-color);
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  transition: transform 0.2s;
}

.fab-add:hover {
  transform: scale(1.1);
}

.fab-add:active {
  transform: scale(0.95);
}

/* Responsive Week View (Mobile Edge-to-Edge) */
@media (max-width: 600px) {

  /* Remove padding from container to go edge-to-edge */
  #tab-calendar {
    padding: 0 !important;
  }

  .timeline-calendar {
    min-height: calc(100vh - 120px);
    /* Adjust for mobile chrome */
    border: none;
    /* Remove outer border */
    background: white;
  }

  .timeline-header {
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 8px 12px;
  }

  .timeline-wrapper {
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  .hour-sidebar {
    flex: 0 0 32px;
    /* Narrower sidebar */
  }

  .hour-label {
    font-size: 0.5rem;
    padding: 2px;
  }

  .day-column {
    min-width: 42px;
    /* Fit 7 days on 375px screen */
  }

  .day-header-dow {
    font-size: 0.6rem;
  }

  .day-header-date {
    font-size: 0.9rem;
  }
}

/* --- New Item Details Modal Styles (Ported from Sandbox) --- */

.item-details-modal {
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  /* Safety cap */
  background: white;
}

.item-details-header {
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  flex-shrink: 0;
}

.item-details-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.item-details-close-btn:hover {
  background: #f9fafb;
  color: var(--text-primary);
}

.header-main {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 8px;
}

.header-icon-box {
  font-size: 32px;
  background: white;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.eyebrow-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border: 1px solid #eef2ff;
  margin-bottom: 8px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

.status-dot.planned {
  background: #9ca3af;
}

.title-area h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.title-area .sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.item-details-body {
  padding: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Info Grid (Time) */
.info-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #fff;
  border-bottom: 1px solid var(--border-color);
}

.info-cell {
  display: flex;
  flex-direction: column;
}

.info-cell label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.info-cell .val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.info-cell .sub-val {
  font-size: 13px;
  color: var(--text-secondary);
}

.grid-arrow {
  color: #d1d5db;
  font-size: 16px;
  margin: 0 8px;
}

/* Detail Section */
.detail-section {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-row {
  display: flex;
  gap: 12px;
}

.detail-icon-col {
  font-size: 18px;
  width: 24px;
  text-align: center;
  color: var(--text-muted);
  padding-top: 2px;
}

.detail-content-col {
  flex: 1;
  min-width: 0;
}

.detail-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
  font-weight: 500;
  word-break: break-word;
}

.map-chip {
  display: inline-flex;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
  background: #eff6ff;
  padding: 4px 8px;
  border-radius: 6px;
}

.map-chip:hover {
  background: #dbeafe;
}

/* Notes */
.notes-box {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 8px;
}

.notes-label {
  font-size: 11px;
  font-weight: 700;
  color: #b45309;
  text-transform: uppercase;
  margin-bottom: 4px;
  display: block;
}

.notes-text {
  font-size: 14px;
  color: #92400e;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Flight Specifics */
.airport-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
}

.map-link-sm {
  font-size: 12px;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: 4px;
}

/* Travelers & Payer */
.travelers-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.traveler-chip {
  background: #f3f4f6;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
}

.payer-badge {
  font-size: 12px;
  color: #15803d;
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
  font-weight: 500;
  margin-top: 4px;
}

/* Footer */
.item-details-footer {
  padding: 16px 20px;
  background: #fff;
  border-top: 1px solid #f3f4f6;
  display: flex;
  gap: 12px;
  flex-shrink: 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

/* Mobile Overrides (Bottom Sheet nature handled by global modal if possible, or here) */
@media (max-width: 480px) {
  .header-icon-box {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .title-area h2 {
    font-size: 18px;
  }
}


/* Missing Button Styles for Item Details */
.item-details-footer .btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-size: 15px;
}

.item-details-footer .btn-edit {
  background: #f3f4f6;
  color: #374151;
}

.item-details-footer .btn-done {
  background: #f59e0b;
  color: white;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}


/* Standardized Form Input Styles */
.form-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.2s ease;
  outline: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.form-input:focus {
  border-color: var(--primary-color, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

/* Flatpickr Customization overrides */
.flatpickr-calendar {
  font-family: 'Inter', sans-serif !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
  border: none !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover,
.flatpickr-day.selected.prevMonthDay,
.flatpickr-day.startRange.prevMonthDay,
.flatpickr-day.endRange.prevMonthDay,
.flatpickr-day.selected.nextMonthDay,
.flatpickr-day.startRange.nextMonthDay,
.flatpickr-day.endRange.nextMonthDay {
  background: var(--primary-color, #2563eb) !important;
  border-color: var(--primary-color, #2563eb) !important;
}

/* ============================================
   MODAL OVERLAY (Global) - Appended Fix
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000 !important;
  /* Force high Z-index */
  backdrop-filter: blur(4px);
  padding: var(--space-md);
  opacity: 1;
  transition: opacity 0.2s;
}

.modal-overlay.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: var(--white);
  padding: var(--space-xl);
  border-radius: var(--radius-retro);
  border: var(--border-width) solid var(--border-color);
  box-shadow: var(--shadow-retro);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideIn 0.3s forwards;
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s;
}

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