/* ==========================================================================
   RouteWag - theme.css
   --------------------------------------------------------------------------
   All brand colors, sizes and base styles live here.
   To re-skin the app, change the variables in :root below - every page
   uses these variables, so one edit updates the whole site.
   Page-specific layouts go in app.css (not here).
   ========================================================================== */

:root {
  /* ---- Brand colors ---------------------------------------------------- */
  --color-primary:        #0E7C77;  /* main teal: buttons, links, active states */
  --color-primary-hover:  #0A6662;  /* darker teal for hover/pressed */
  --color-primary-bright: #2BB5AC;  /* lighter teal: logo, highlights, map pins */
  --color-primary-soft:   #E3F4F3;  /* very light teal: badges, selected rows */

  --color-accent:         #F2994A;  /* warm orange: "Best Value" badge, small highlights */
  --color-accent-text:    #B4532A;  /* readable orange text on light backgrounds */
  --color-accent-soft:    #FFF1E8;

  /* ---- Neutrals -------------------------------------------------------- */
  --color-bg:             #F7F9FB;  /* page background */
  --color-surface:        #FFFFFF;  /* cards, inputs, modals */
  --color-surface-alt:    #F1F5F8;  /* subtle panels, table headers */
  --color-border:         #E3E8EE;  /* soft dividers (use sparingly) */
  --color-text:           #1F2A37;  /* main text */
  --color-text-muted:     #64748B;  /* secondary text, hints */
  --color-text-inverse:   #FFFFFF;  /* text on primary buttons */

  /* ---- Status colors --------------------------------------------------- */
  --color-success:        #15803D;
  --color-success-soft:   #E8F6EE;
  --color-warning:        #B45309;
  --color-warning-soft:   #FFF6E0;
  --color-danger:         #C8372D;
  --color-danger-soft:    #FDECEA;

  /* ---- Typography ------------------------------------------------------ */
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  --font-size-xs:   0.75rem;   /* 12px */
  --font-size-sm:   0.875rem;  /* 14px */
  --font-size-base: 1rem;      /* 16px - never go below this on inputs (iOS zoom) */
  --font-size-lg:   1.125rem;  /* 18px */
  --font-size-xl:   1.375rem;  /* 22px */
  --font-size-2xl:  1.75rem;   /* 28px */
  --font-size-3xl:  2.25rem;   /* 36px */
  --line-height:    1.55;

  /* ---- Spacing (4px scale) --------------------------------------------- */
  --space-1: 0.25rem;  /*  4px */
  --space-2: 0.5rem;   /*  8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.5rem;   /* 24px */
  --space-6: 2rem;     /* 32px */
  --space-7: 3rem;     /* 48px */
  --space-8: 4rem;     /* 64px */

  /* ---- Shape & depth --------------------------------------------------- */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(15, 35, 52, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 35, 52, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 35, 52, 0.12);
  --focus-ring: 0 0 0 3px rgba(43, 181, 172, 0.35);

  /* ---- Layout ---------------------------------------------------------- */
  --container-max: 1120px;
  --tap-size:      44px;       /* minimum touch target for phone users */
  --transition:    150ms ease;
}

/* ==========================================================================
   Base / reset
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
}

/* Elements with the "hidden" attribute stay hidden, even if a class
   (like .btn) sets display:flex */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1, h2, h3, h4 {
  margin: 0 0 var(--space-3);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }

p {
  margin: 0 0 var(--space-4);
}

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

/* Bigger headings on tablets/desktops (mobile-first) */
@media (min-width: 768px) {
  h1 { font-size: var(--font-size-3xl); }
  h2 { font-size: var(--font-size-2xl); }
}

/* ==========================================================================
   Layout helpers
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.stack > * + * {
  margin-top: var(--space-4);   /* vertical spacing between children */
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

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

.small {
  font-size: var(--font-size-sm);
}

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

/* Hides text visually but keeps it for screen readers */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-5);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin: 0 0 var(--space-2);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap-size);
  padding: 0 var(--space-5);
  font: inherit;
  font-weight: 600;
  font-size: var(--font-size-base);
  line-height: 1;
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), box-shadow var(--transition),
              transform var(--transition);
}
.btn:hover {
  text-decoration: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  color: var(--color-text-inverse);
}

.btn-secondary {
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
}
.btn-secondary:hover {
  background: #D2EDEB;
  color: var(--color-primary-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
}
.btn-ghost:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.btn-danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}
.btn-danger:hover {
  background: #FAD9D5;
  color: var(--color-danger);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 36px;
  padding: 0 var(--space-4);
  font-size: var(--font-size-sm);
}

/* Icon inside a button (inline SVG) */
.btn svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--tap-size);
  padding: var(--space-2) var(--space-3);
  font: inherit;
  font-size: var(--font-size-base);   /* 16px stops iOS from zooming in */
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary-bright);
  box-shadow: var(--focus-ring);
}

.hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* ==========================================================================
   Badges & alerts
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
}
.badge-accent  { background: var(--color-accent-soft);  color: var(--color-accent-text); }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger  { background: var(--color-danger-soft);  color: var(--color-danger); }

.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-4);
}
.alert-success { background: var(--color-success-soft); color: var(--color-success); }
.alert-error   { background: var(--color-danger-soft);  color: var(--color-danger); }
.alert-info    { background: var(--color-primary-soft); color: var(--color-primary-hover); }

/* ==========================================================================
   Icons (simple outlined inline SVGs - no icon library)
   Usage: <svg class="icon" viewBox="0 0 24 24">...</svg>
   ========================================================================== */

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
