/* Multi-Trip Dashboard CSS Module */

/* Dashboard Container Panel */
.panel-dashboard {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-core, #0a0b0d);
  z-index: 50;
  overflow-y: auto;
  padding: calc(var(--hud-height, 90px) + 24px) 32px 32px 32px;
  box-sizing: border-box;
  font-family: var(--font-sans);
  /* Entrance state */
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  pointer-events: auto;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0s linear 0s;
}

/* Exit: opacity/scale animate out, then visibility hides after 0.28s */
.panel-dashboard.collapsed {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
  visibility: hidden;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0s linear 0.28s;
}

.panel-dashboard.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0s linear 0s;
}

.dashboard-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
}

.dashboard-title-group h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
}

.dashboard-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-dashboard-new {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--accent-flight, #00e5ff);
  color: var(--bg-core, #0a0b0d);
  border: none;
  border-radius: var(--border-radius-md, 10px);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-dashboard-new:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-close-dashboard {
  background: transparent;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.15));
  border-radius: var(--border-radius-md, 10px);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-close-dashboard:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.list-new-popup-form {
  display: none;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px;
  margin-bottom: 20px;
  max-width: 420px;
}

.list-new-popup-form.active {
  display: flex;
}

/* Dashboard Toolbar Controls */
.dashboard-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  width: 100%;
  flex-wrap: wrap;
}

.dashboard-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-elevated, #18181b);
  border: 1px solid var(--border-color, #27272a);
  border-radius: var(--border-radius-md, 10px);
  padding: 10px 14px;
  flex: 1;
  min-width: 260px;
  color: var(--text-secondary, #a1a1aa);
  transition: var(--transition-smooth);
}

.dashboard-search-box:focus-within {
  border-color: var(--accent-flight, #00e5ff);
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.15);
  color: var(--text-primary, #ffffff);
}

.dashboard-search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary, #ffffff);
  font-family: var(--font-sans);
  font-size: 13px;
  width: 100%;
  outline: none;
}

.dashboard-sort-box {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary, #a1a1aa);
  font-weight: 500;
}

.dashboard-sort-box select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--bg-surface-elevated, #18181b) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--border-color, #27272a);
  border-radius: var(--border-radius-md, 10px);
  color: var(--text-primary, #ffffff);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 36px 10px 14px;
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.dashboard-sort-box select:focus,
.dashboard-sort-box select:hover {
  border-color: var(--accent-flight, #00e5ff);
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.15);
}

/* Dashboard Grid Layout & Sections */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
}

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

.dashboard-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

.dashboard-section-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard-section-icon {
  font-size: 16px;
}

.dashboard-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.dashboard-section-count {
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 12px;
}

.dashboard-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  width: 100%;
}

.dashboard-section-empty {
  font-size: 13px;
  color: var(--text-secondary, #a1a1aa);
  font-style: italic;
  padding: 12px 0;
}

.shared-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-hotel, #a855f7);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.trip-card.shared-card {
  border-color: rgba(168, 85, 247, 0.25);
}

.trip-card.shared-card:hover {
  border-color: var(--accent-hotel, #a855f7);
}

.trip-card {
  background: var(--bg-surface, #12141c);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: var(--border-radius-lg, 14px);
  padding: 24px 20px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}

.trip-card-active-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: rgba(0, 255, 102, 0.05);
  border-bottom: 1px solid rgba(0, 255, 102, 0.15);
  padding: 0 20px;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-green, #00ff66);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  z-index: 2;
}

.trip-card:hover {
  border-color: var(--accent-flight, #00e5ff);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.trip-card.active-trip {
  border-color: var(--accent-green, #00ff66);
  background: linear-gradient(180deg, rgba(0, 255, 102, 0.04) 0%, var(--bg-surface, #12141c) 100%);
}

.trip-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.trip-card-title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.trip-card-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.trip-card-subhead {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
}

.active-trip-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-green, #00ff66);
  flex-shrink: 0;
}

.trip-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
  word-break: break-word;
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.2s ease;
  font-family: var(--font-sans);
}

.trip-card-title:hover {
  border-color: var(--text-secondary);
}

.btn-edit-title-quick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.btn-edit-title-quick:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-flight, #00e5ff);
}

.trip-card-title-input {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--accent-flight, #00e5ff);
  border-radius: 6px;
  padding: 4px 8px;
  flex: 1 1 auto;
  min-width: 0;
  box-sizing: border-box;
  outline: none;
}

.btn-save-title-quick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--accent-green, #00ff66);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  opacity: 0.85;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.btn-save-title-quick:hover {
  opacity: 1;
  background: rgba(0, 255, 102, 0.15);
}

.trip-card-countdown-container {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-bottom: 2px;
}

.trip-card-splitflap {
  display: inline-flex;
  align-items: center;
}

.trip-card-splitflap .flap-char {
  font-size: 13px;
  width: 17px;
  height: 23px;
  margin: 0 2px;
  border-radius: 3px;
}

.trip-card-splitflap .flap-char.is-space {
  width: 10px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.trip-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

.btn-trip-action {
  padding: 8px 16px;
  min-width: 80px;
  border-radius: var(--border-radius-sm, 6px);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.15));
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-trip-action.primary {
  background: rgba(0, 229, 255, 0.12);
  color: var(--accent-flight, #00e5ff);
  border-color: rgba(0, 229, 255, 0.3);
}

.btn-trip-action.primary:hover {
  background: rgba(0, 229, 255, 0.22);
}

.btn-trip-action.secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-trip-action.secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-trip-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: var(--border-radius-sm, 6px);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-delete-trip {
  margin-left: auto;
}

.btn-trip-action-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-delete-trip:hover {
  background: rgba(255, 82, 82, 0.15);
  color: #ff5252;
  border-color: rgba(255, 82, 82, 0.3);
}

/* Delete Confirmation Popover */
.delete-confirm-popover {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: #1a1c26;
  border: 1px solid rgba(255, 82, 82, 0.4);
  border-radius: var(--border-radius-md, 10px);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 10;
  font-size: 12px;
}

.delete-confirm-popover p {
  margin: 0;
  color: var(--text-primary);
  font-weight: 600;
}

.delete-confirm-actions {
  display: flex;
  gap: 6px;
}

.btn-popover-confirm {
  background: #ff5252;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.btn-popover-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.dashboard-empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.dashboard-empty-state.active {
  display: flex;
}

.dashboard-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.dashboard-loading,
.dashboard-error {
  padding: 30px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.dashboard-error {
  color: #ff5252;
}

@media (max-width: 768px) {
  .panel-dashboard {
    padding: calc(var(--mobile-hud-height, 125px) + var(--sandbox-banner-height, 0px) + var(--announcement-banner-height, 0px) + 16px) 16px 20px 16px;
  }

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

  .dashboard-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-search-box {
    max-width: 100%;
  }

  /* iOS Safari auto-zooms the page on focus for any input under 16px —
     bump just enough to clear that threshold without changing the visual
     size much at this width. */
  .dashboard-search-box input {
    font-size: 16px;
  }

  /* Title and action buttons no longer fit on one line at mobile widths —
     give the actions their own full-width row below the title instead of
     letting them squeeze against the wrapping heading. */
  .dashboard-header-bar {
    flex-wrap: wrap;
    row-gap: 14px;
  }

  .dashboard-title-group {
    flex: 1 1 100%;
  }

  .dashboard-header-actions {
    flex: 1 1 100%;
    width: 100%;
  }

  .dashboard-header-actions .btn-dashboard-new,
  .dashboard-header-actions .btn-close-dashboard {
    flex: 1;
  }

  /* Mobile: dashboard is a full-screen stack overlay — collapsed state
     slides off to the right (jet-bridge push) rather than just fading. */
  .panel-dashboard.collapsed {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel-dashboard,
  .panel-dashboard.collapsed,
  .panel-dashboard.active {
    transition: none !important;
  }
}