/* ==========================================================================
   Sabre Business Logbook - Design System & Modern Responsive Stylesheet
   ========================================================================== */

:root {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-glass: rgba(30, 41, 59, 0.75);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-highlight: rgba(59, 130, 246, 0.3);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-emerald: #10b981;
  --accent-emerald-hover: #059669;
  --accent-indigo: #6366f1;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.25);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 80px; /* Space for bottom mobile nav */
  min-height: 100vh;
}

/* App Header Topbar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
}

.header-container {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-emerald));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.15);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* PWA Install Banner */
.pwa-banner {
  background: linear-gradient(90deg, #1e1b4b, #311b92);
  border-bottom: 1px solid rgba(99, 102, 241, 0.4);
  padding: 10px 16px;
  display: none;
  align-items: center;
  justify-content: space-between;
}

.pwa-banner-text {
  font-size: 13px;
  color: #e0e7ff;
}

/* Main Container Layout */
.main-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px;
}

.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.tab-content.active {
  display: block;
}

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

/* Active Trip HUD Card */
.hud-card-wrapper {
  margin-bottom: 20px;
}

.active-hud-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 2px solid var(--accent-emerald);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

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

.hud-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-dot {
  width: 12px;
  height: 12px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-ring 1.5s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.hud-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--accent-emerald);
}

.hud-timer {
  font-family: monospace;
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  letter-spacing: 2px;
}

.hud-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.hud-info-grid .label {
  color: var(--text-muted);
}

.hud-address {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

/* Section Cards & Metric Grids */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 640px) {
  .metrics-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.metric-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.metric-card .title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;

}

.metric-card .value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);

}

.metric-card.highlight .value {
  color: var(--accent-emerald);
}

/* Form Controls & Buttons */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control, .form-select {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-emerald {
  background: var(--accent-emerald);
  color: #ffffff;
}

.btn-emerald:hover {
  background: var(--accent-emerald-hover);
}

.btn-blue {
  background: var(--accent-blue);
  color: #ffffff;
}

.btn-blue:hover {
  background: var(--accent-blue-hover);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-outline-danger {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--accent-red);
}

.btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* Action Banner Controls */
.action-banner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 600px) {
  .action-banner {
    grid-template-columns: 2fr 1fr;
  }
}

.hero-start-btn {
  padding: 18px;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

/* Filters bar */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  background: var(--bg-card);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* Trip Cards List */
.trip-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  transition: transform 0.2s, border-color 0.2s;
}

.trip-card:hover {
  border-color: var(--border-highlight);
}

.trip-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.trip-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-business {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-personal {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-indigo);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.trip-purpose {
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.trip-route {
  background: rgba(15, 23, 42, 0.5);
  border-left: 2px solid var(--accent-blue);
  padding: 8px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 12px;
}

.route-point {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.route-point:last-child {
  margin-bottom: 0;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.green { background: var(--accent-emerald); }
.dot.red { background: var(--accent-red); }

.trip-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
  margin-bottom: 12px;
}

.trip-metrics .metric {
  display: flex;
  flex-direction: column;
}

.trip-metrics .label {
  font-size: 11px;
  color: var(--text-muted);
}

.trip-metrics .value {
  font-weight: 600;
  color: var(--text-primary);
}

.trip-metrics .val-highlight {
  color: var(--accent-blue);
}

.trip-metrics .val-claim {
  color: var(--accent-emerald);
  font-weight: 700;
}

.trip-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

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

/* Export Cards Grid */
.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;

}

.export-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.export-card-icon {
  font-size: 28px;
  margin-bottom: 10px;
}

.export-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.export-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Modal Window */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-main);
  animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.map-trip-info {
  background: rgba(15, 23, 42, 0.6);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.map-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  font-size: 12px;
  margin-top: 6px;

}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  color: var(--text-primary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-main);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success { border-left: 4px solid var(--accent-emerald); }
.toast-error { border-left: 4px solid var(--accent-red); }
.toast-info { border-left: 4px solid var(--accent-blue); }

/* Mobile Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  z-index: 900;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  gap: 4px;
}

.nav-item.active {
  color: var(--accent-emerald);
}

.nav-icon {
  font-size: 20px;
}
