﻿/* ========================================
   SKY THEME - PREMIUM CARPOOL APP
   Mobile-first, Clean, Modern Design
   ======================================== */

:root {
  /* PRIMARY COLORS - Blue/Sky */
  --hs-primary: #1D4ED8;
  --hs-primary-2: #2563EB;
  --hs-sky: #38BDF8;
  
  /* BACKGROUNDS */
  --hs-bg: #F6F9FF;
  --hs-card: #FFFFFF;
  --hs-text: #0F172A;
  --hs-muted: #64748B;
  
  /* STATUS COLORS */
  --hs-success: #16A34A;
  --hs-warning: #F59E0B;
  --hs-danger: #DC2626;
  --hs-info: #38BDF8;
  
  /* SPACING & RADIUS */
  --hs-radius-sm: 12px;
  --hs-radius-md: 16px;
  --hs-radius-lg: 20px;
  --hs-radius-xl: 24px;
  
  /* SHADOWS - Soft, floating effect */
  --hs-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
  --hs-shadow-md: 0 4px 16px rgba(15, 23, 42, 0.12);
  --hs-shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.15);
}

[data-bs-theme="dark"] {
  --hs-bg: #0F172A;
  --hs-card: #1E293B;
  --hs-text: #F1F5F9;
  --hs-muted: #94A3B8;
}

/* ========================================
   BASE STYLES
   ======================================== */

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
}

body {
  background-color: var(--hs-bg);
  color: var(--hs-text);
  line-height: 1.6;
  font-size: 15px;
  transition: background-color 0.3s ease;
}

body.hs-app {
  padding-bottom: 80px; /* Space for bottom nav on mobile */
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--hs-text);
  line-height: 1.3;
}

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

p {
  color: var(--hs-text);
  margin-bottom: 1rem;
}

.hs-muted, .text-muted {
  color: var(--hs-muted) !important;
}

.small, small {
  font-size: 0.875rem;
  color: var(--hs-muted);
}

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

/* ========================================
   NAVBAR/APP HEADER
   ======================================== */

.navbar {
  background-color: var(--hs-card);
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
  padding: 0.75rem 0;
  box-shadow: var(--hs-shadow-sm);
  position: sticky;
  top: 0;
  z-index: 999;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--hs-primary) !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-brand i {
  font-size: 1.75rem;
}

.navbar-text {
  color: var(--hs-muted);
  font-size: 0.9rem;
}

/* ========================================
   BOTTOM NAVIGATION (Mobile)
   ======================================== */

.hs-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--hs-card);
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.1);
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 1000;
  display: none;
}

@media (max-width: 991.98px) {
  .hs-bottom-nav {
    display: flex;
  }
}

.hs-bottom-nav-group {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  gap: 0.5rem;
}

.hs-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: var(--hs-muted);
  font-size: 0.75rem;
  padding: 0.75rem 0.5rem;
  transition: all 0.2s ease;
  border-radius: var(--hs-radius-md);
}

.hs-nav-item i {
  font-size: 1.4rem;
  line-height: 1;
}

.hs-nav-item.active {
  color: var(--hs-primary);
  background-color: rgba(29, 78, 216, 0.08);
}

.hs-nav-item:hover {
  color: var(--hs-primary);
}

/* ========================================
   HERO SECTION
   ======================================== */

.hs-hero {
  background: linear-gradient(135deg, var(--hs-primary) 0%, var(--hs-primary-2) 50%, var(--hs-sky) 100%);
  color: white;
  padding: 2rem 1.5rem;
  border-radius: var(--hs-radius-lg);
  margin: 1.5rem 0;
  position: relative;
  overflow: hidden;
}

.hs-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  filter: blur(40px);
}

.hs-hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  filter: blur(30px);
}

.hs-hero h1,
.hs-hero h2 {
  color: white;
  position: relative;
  z-index: 1;
}

.hs-hero p {
  color: rgba(255, 255, 255, 0.9);
  position: relative;
  z-index: 1;
}

/* ========================================
   CARDS
   ======================================== */

.hs-card,
.card {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--hs-radius-lg);
  box-shadow: var(--hs-shadow-md);
  background-color: var(--hs-card);
  transition: all 0.2s ease;
}

.hs-card:hover,
.card:hover {
  box-shadow: var(--hs-shadow-lg);
  transform: translateY(-2px);
}

.card-body {
  padding: 1.5rem;
}

.card-header {
  background-color: transparent;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  padding: 1.25rem 1.5rem;
}

/* Compact trip cards grid */
.hs-trip-grid .hs-trip-card .card-body {
  padding: 1.1rem;
}

@media (max-width: 575.98px) {
  .hs-trip-grid .hs-trip-card .card-body {
    padding: 0.9rem;
  }

  .hs-trip-grid .hs-trip-route {
    font-size: 0.92rem;
  }

  .hs-trip-grid .hs-trip-info {
    font-size: 0.85rem;
    gap: 0.35rem;
  }

  .hs-trip-grid .badge {
    font-size: 0.7rem;
  }
}

/* ========================================
   CHIPS & BADGES
   ======================================== */

.hs-chip {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: rgba(29, 78, 216, 0.1);
  color: var(--hs-primary);
  border-radius: var(--hs-radius-xl);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid rgba(29, 78, 216, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.hs-chip:hover {
  background-color: var(--hs-primary);
  color: white;
}

.hs-chip.active {
  background-color: var(--hs-primary);
  color: white;
  border-color: var(--hs-primary);
}

.badge {
  padding: 0.5rem 0.75rem;
  border-radius: var(--hs-radius-md);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

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

.badge-success {
  background-color: rgba(22, 163, 74, 0.15);
  color: var(--hs-success);
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--hs-warning);
}

.badge-info {
  background-color: rgba(56, 189, 248, 0.15);
  color: var(--hs-info);
}

/* ========================================
   FORMS
   ======================================== */

.form-control,
.form-select,
textarea {
  border: 1px solid rgba(15, 23, 42, 0.15);
  border-radius: var(--hs-radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  background-color: var(--hs-card);
  color: var(--hs-text);
  transition: all 0.2s ease;
  pointer-events: auto !important;
  position: relative;
}

.form-select {
  z-index: 10;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
  border-color: var(--hs-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
  color: var(--hs-text);
  z-index: 100;
}

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

.form-select-sm {
  padding-right: 2.5rem !important;
  font-size: 0.875rem;
  min-width: 140px;
}

.form-label {
  color: var(--hs-text);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.form-text {
  color: var(--hs-muted);
  font-size: 0.85rem;
}




.invalid-feedback {
  color: var(--hs-danger);
  font-size: 0.85rem;
  margin-top: 0.4rem;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--hs-radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--hs-primary) 0%, var(--hs-primary-2) 100%);
  color: white;
  box-shadow: var(--hs-shadow-md);
}

.btn-primary:hover {
  color: white;
  box-shadow: var(--hs-shadow-lg);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-outline-primary:hover {
  background-color: var(--hs-primary);
  color: white;
}

.btn-success {
  background-color: var(--hs-success);
  color: white;
}

.btn-success:hover {
  background-color: #15803d;
  color: white;
}

.btn-danger {
  background-color: var(--hs-danger);
  color: white;
}

.btn-danger:hover {
  background-color: #b91c1c;
  color: white;
}

.btn-warning {
  background-color: var(--hs-warning);
  color: white;
}

.btn-info {
  background-color: var(--hs-info);
  color: white;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.05rem;
}

.btn-block, .w-100 {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ========================================
   ALERTS
   ======================================== */

.alert {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: var(--hs-radius-lg);
  padding: 1rem 1.5rem;
  background-color: transparent;
}

.alert-primary {
  background-color: rgba(29, 78, 216, 0.08);
  color: var(--hs-primary);
  border-color: rgba(29, 78, 216, 0.2);
}

.alert-success {
  background-color: rgba(22, 163, 74, 0.08);
  color: var(--hs-success);
  border-color: rgba(22, 163, 74, 0.2);
}

.alert-warning {
  background-color: rgba(245, 158, 11, 0.08);
  color: var(--hs-warning);
  border-color: rgba(245, 158, 11, 0.2);
}

.alert-danger {
  background-color: rgba(220, 38, 38, 0.08);
  color: var(--hs-danger);
  border-color: rgba(220, 38, 38, 0.2);
}

/* ========================================
   LIST GROUPS
   ======================================== */

.list-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.list-group-item {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--hs-radius-lg);
  padding: 1rem 1.5rem;
  background-color: var(--hs-card);
  transition: all 0.2s ease;
}

.list-group-item:hover {
  box-shadow: var(--hs-shadow-md);
  transform: translateY(-1px);
}

.list-group-item a {
  color: var(--hs-primary);
  text-decoration: none;
}

.list-group-item a:hover {
  text-decoration: underline;
}

/* ========================================
   MODALS & DROPDOWNS
   ======================================== */

.modal-content {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: var(--hs-radius-lg);
  box-shadow: var(--hs-shadow-lg);
}

.modal-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  padding: 1.5rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  padding: 1.5rem;
}

.dropdown-menu {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: var(--hs-radius-lg);
  box-shadow: var(--hs-shadow-lg);
}

.dropdown-item {
  color: var(--hs-text);
  padding: 0.75rem 1.5rem;
}

.dropdown-item:hover,
.dropdown-item.active {
  background-color: rgba(29, 78, 216, 0.1);
  color: var(--hs-primary);
}

/* ========================================
   NAV PILLS (Tabs)
   ======================================== */

.nav-pills .nav-link {
  color: var(--hs-muted);
  border-radius: var(--hs-radius-md);
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-pills .nav-link:hover {
  color: var(--hs-primary);
  background-color: transparent;
}

.nav-pills .nav-link.active {
  background-color: var(--hs-primary);
  color: white;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.hs-page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--hs-text);
  margin-bottom: 1.5rem;
}

.hs-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--hs-text);
  margin-bottom: 1rem;
}

.hs-trip-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hs-trip-route {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--hs-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hs-trip-info {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--hs-muted);
}

.hs-trip-info > div {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hs-autocomplete {
  position: relative;
}

.hs-autocomplete .form-control {
  padding-right: 2.2rem;
}

.hs-autocomplete .hs-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 0.4rem;
  line-height: 1.4;
  display: none;
}

.hs-autocomplete.has-value .hs-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hs-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1050;
  max-height: 240px;
  overflow-y: auto;
}

.hs-recent {
  margin-top: 0.25rem;
}

.hs-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hs-quick .btn {
  border-radius: 999px;
  font-size: 0.85rem;
}

.hs-dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.hs-dashboard-actions .hs-action-note {
  flex: 1 1 100%;
}

@media (max-width: 576px) {
  .hs-dashboard-actions .btn {
    flex: 1 1 100%;
  }
}

.hs-rating {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--hs-warning);
}

.hs-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--hs-primary) 0%, var(--hs-sky) 100%);
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
}

.hs-empty-state {
  text-align: center;
  padding: 2rem 1.5rem;
  border-radius: var(--hs-radius-lg);
  background-color: rgba(29, 78, 216, 0.05);
  border: 1px dashed rgba(29, 78, 216, 0.2);
}

.hs-empty-state i {
  font-size: 3rem;
  color: var(--hs-primary);
  margin-bottom: 0.5rem;
  opacity: 0.3;
}

.hs-empty-state h3 {
  color: var(--hs-text);
  font-size: 1.15rem;
}

.hs-empty-state p {
  color: var(--hs-muted);
  font-size: 0.95rem;
}

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }

.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 576px) {
  body.hs-app {
    padding-bottom: 80px;
  }

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

  .btn-primary.w-100 {
    width: 100%;
    margin: 0.5rem 0;
  }

  .hs-hero {
    padding: 1.5rem 1rem;
    margin: 1rem 0;
  }

  .card-body {
    padding: 1rem;
  }

  .modal {
    --bs-modal-margin: 0.5rem;
  }
}

@media (min-width: 992px) {
  body.hs-app {
    padding-bottom: 0;
  }

  .hs-bottom-nav {
    display: none !important;
  }

  .navbar-toggler {
    display: none;
  }

  .navbar-nav {
    display: flex;
  }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

a:focus, button:focus, input:focus {
  outline: 2px solid var(--hs-primary);
  outline-offset: 2px;
}

button:focus-visible {
  outline: 2px solid var(--hs-primary);
  outline-offset: 2px;
}

/* ========================================
   WEBVIEW SHELL
   ======================================== */

:root {
  --hs-safe-top: env(safe-area-inset-top, 0px);
  --hs-safe-bottom: env(safe-area-inset-bottom, 0px);
  --hs-safe-left: env(safe-area-inset-left, 0px);
  --hs-safe-right: env(safe-area-inset-right, 0px);
  --hs-vh: 100vh;
  --hs-header-height: 62px;
}

.hs-shell {
  min-height: var(--hs-vh);
  padding-left: var(--hs-safe-left);
  padding-right: var(--hs-safe-right);
}

.hs-app-header {
  padding-top: var(--hs-safe-top);
  background: var(--hs-card);
  z-index: 1020;
}

.hs-header-container {
  min-height: var(--hs-header-height);
}

.hs-main {
  padding-top: 0.85rem;
  padding-bottom: 1rem;
}

.hs-content-container {
  max-width: 560px;
}

.hs-footer {
  margin-bottom: calc(80px + var(--hs-safe-bottom));
}

.hs-bottom-nav {
  padding-bottom: max(0.6rem, var(--hs-safe-bottom));
}

.hs-loading-overlay,
.hs-offline-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.hs-loading-overlay.is-visible,
.hs-offline-overlay:not(.d-none) {
  opacity: 1;
  visibility: visible;
}

.hs-loading-box,
.hs-offline-card,
.hs-modal-card {
  width: min(90vw, 340px);
  background: var(--hs-card);
  color: var(--hs-text);
  border-radius: var(--hs-radius-lg);
  box-shadow: var(--hs-shadow-lg);
  padding: 1.25rem;
  text-align: center;
}

.hs-spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid rgba(29, 78, 216, 0.2);
  border-top-color: var(--hs-primary);
  margin: 0 auto 0.9rem;
  animation: hs-spin 0.8s linear infinite;
}

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

.hs-external-link-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
}

.hs-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.hs-modal-card {
  position: absolute;
  left: 50%;
  bottom: calc(24px + var(--hs-safe-bottom));
  transform: translateX(-50%);
}

.hs-offline-icon {
  font-size: 2rem;
  color: var(--hs-primary);
}

.hs-error-screen {
  min-height: 58vh;
  display: grid;
  place-items: center;
  padding: 1rem 0 2rem;
}

.hs-error-card {
  width: min(100%, 420px);
}

.hs-error-code {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--hs-primary);
  line-height: 1;
  margin-bottom: 0.6rem;
}

.hs-skeleton {
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.08) 25%, rgba(15, 23, 42, 0.14) 37%, rgba(15, 23, 42, 0.08) 63%);
  background-size: 400% 100%;
  animation: hs-skeleton 1.25s ease infinite;
}

@keyframes hs-skeleton {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.hs-trip-skeleton {
  height: 108px;
  margin-bottom: 0.75rem;
}

.hs-loading #trips-list {
  opacity: 0.45;
}

.hs-loading .hs-trips-skeleton {
  display: block !important;
}

.hs-keyboard-open .hs-bottom-nav {
  transform: translateY(100%);
}

@media (max-width: 390px) {
  .hs-nav-item {
    font-size: 0.68rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  .hs-nav-item i {
    font-size: 1.2rem;
  }

  .navbar-brand {
    font-size: 1.2rem;
  }
}

@media (min-width: 992px) {
  .hs-footer {
    margin-bottom: 0;
  }
}
