/* ==========================================================
   KL79.in  -  Shared Theme
   Paper-warm palette · Forest-green primary · Laterite accent
   Loaded AFTER Tailwind so the overrides stick.
   ========================================================== */

:root {
    --paper:        #f4ede1;
    --paper-soft:   #faf4e8;
    --paper-light:  #fffdf6;
    --laterite:     #b8472a;
    --laterite-d:   #9b3a1f;
    --forest:       #2d4a3e;
    --forest-d:     #1e3529;
    --forest-l:     #3e6654;
    --gold:         #c89a4a;
    --ink:          #1a1410;
    --ink-soft:     #5b5342;
    --ink-muted:    #8a8270;
    --line:         #e8dcc0;

    --font-sans:    'Manrope', 'Inter', system-ui, sans-serif;
    --font-display: 'Fraunces', 'Noto Sans Malayalam', serif;
    --font-ml:      'Baloo Chettan 2', 'Noto Sans Malayalam', sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, monospace;
}

/* ------ Body + typography ------------------------------------ */
body {
    background: var(--paper-soft);
    color: var(--ink);
    font-family: var(--font-sans);
}

/* Headings stay readable on paper */
h1, h2, h3, h4 { color: var(--forest); letter-spacing: -0.01em; }

/* Malayalam text gets the rounded Baloo face */
.font-malayalam,
[lang="ml"] {
    font-family: var(--font-ml);
}

/* ------ Tailwind green overrides (nav, buttons, accents) ----- */
/* We keep Tailwind for layout but remap its greens to our forest */
.bg-green-700 { background-color: var(--forest) !important; }
.bg-green-800 { background-color: var(--forest-d) !important; }
.bg-green-600 { background-color: var(--forest-l) !important; }
.hover\:bg-green-600:hover,
.hover\:bg-green-700:hover { background-color: var(--forest-l) !important; }
.hover\:bg-green-800:hover { background-color: var(--forest-d) !important; }

.text-green-700,
.text-green-800,
.text-green-900 { color: var(--forest) !important; }
.text-green-600 { color: var(--forest-l) !important; }
.text-green-100,
.text-green-200,
.text-green-300 { color: var(--paper-light) !important; }

.border-green-600,
.border-green-700,
.border-green-800 { border-color: var(--forest) !important; }

.bg-green-50  { background-color: var(--paper-soft) !important; }
.bg-green-100 { background-color: #e4dcc4 !important; }

/* Yellow highlight → gold */
.bg-yellow-400,
.border-yellow-400 {
    background-color: var(--gold) !important;
    border-color: var(--gold) !important;
}
.text-yellow-600,
.text-yellow-700,
.text-yellow-800 { color: var(--laterite) !important; }

/* ------ Generic card polish ---------------------------------- */
.kl79-card {
    background: var(--paper-light);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 8px 24px -16px rgba(45, 74, 62, 0.2);
}
.kl79-card-accent {
    border-left: 4px solid var(--laterite);
}

/* ------ Buttons ---------------------------------------------- */
.kl79-btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.5rem;
    background: var(--forest); color: var(--paper-light);
    border: none; border-radius: 10px;
    padding: 0.7rem 1.2rem; font-weight: 700; cursor: pointer;
    transition: background 0.18s, transform 0.08s;
}
.kl79-btn:hover  { background: var(--forest-d); }
.kl79-btn:active { transform: translateY(1px); }
.kl79-btn.ghost  { background: transparent; color: var(--forest);
                   border: 1.5px solid var(--forest); }
.kl79-btn.ghost:hover { background: var(--forest); color: var(--paper-light); }

/* ==========================================================
   LEAVING SOON widget (used on bus pages)
   ========================================================== */
.ls-card {
    background: linear-gradient(180deg, #fff6ef 0%, #f8e8d7 100%);
    border: 1px solid #e9d2ba;
    border-left: 5px solid var(--laterite);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    margin: 1rem auto 1.5rem;
    max-width: 72rem;
}
/* Force the same Malayalam font the pages use, overriding anything
   from Tailwind / page-level styles. */
.ls-card,
.ls-card * {
    font-family: 'Noto Sans Malayalam', 'Inter', system-ui, sans-serif !important;
}
.ls-card .ls-time,
.ls-card .ls-countdown {
    font-family: 'JetBrains Mono', ui-monospace, monospace !important;
}

.ls-title {
    display: flex; align-items: center; gap: 0.5rem;
    color: var(--laterite); font-weight: 800; font-size: 0.85rem;
    letter-spacing: 0.04em;
    margin-bottom: 0.6rem;
}
.ls-title .ls-dot {
    display: inline-block; width: 8px; height: 8px; background: var(--laterite);
    border-radius: 50%; animation: ls-pulse 1.8s ease-in-out infinite;
}
@keyframes ls-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}
.ls-row {
    display: grid; grid-template-columns: auto 1fr auto;
    gap: 0.6rem 0.9rem; align-items: center;
    padding: 0.5rem 0; border-top: 1px dashed rgba(184, 71, 42, 0.2);
}
.ls-row:first-of-type { border-top: none; }
.ls-time {
    font-family: var(--font-mono); font-weight: 700;
    color: var(--ink); font-size: 1rem; min-width: 70px;
}
.ls-countdown {
    font-size: 0.72rem; color: var(--laterite); font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
}
.ls-info {
    font-family: 'Noto Sans Malayalam', 'Inter', sans-serif;
    color: var(--ink); font-size: 0.92rem; line-height: 1.4;
}
.ls-info b { font-weight: 700; color: var(--forest); }
.ls-share {
    color: var(--forest); background: transparent; border: 1px solid var(--forest);
    border-radius: 8px; padding: 0.25rem 0.55rem; font-size: 0.72rem;
    font-weight: 700; cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.3rem;
    white-space: nowrap; text-decoration: none;
}
.ls-share:hover { background: var(--forest); color: var(--paper-light); }
.ls-none {
    color: var(--ink-soft); font-style: italic;
    padding: 0.5rem 0;
}

/* ==========================================================
   ROUTE FINDER  -  skeleton loading rows
   ========================================================== */
.rf-skeleton {
    background: #fffdf6; border: 1px solid var(--line);
    border-left: 4px solid var(--line);
    border-radius: 10px; padding: 0.85rem 1rem;
    display: grid; grid-template-columns: 70px 1fr 90px; gap: 0.75rem;
    align-items: center;
}
.rf-sk-bar {
    height: 12px; border-radius: 6px;
    background: linear-gradient(90deg, #ece2cf 0%, #f6efe0 50%, #ece2cf 100%);
    background-size: 200% 100%;
    animation: rf-shimmer 1.4s linear infinite;
}
.rf-sk-bar.short { width: 60%; }
.rf-sk-bar.tall  { height: 16px; margin-bottom: 0.3rem; }
@keyframes rf-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* ==========================================================
   MOBILE BOTTOM NAV BAR
   Shown on phones only, fixed to bottom edge. Pushes page
   content up so nothing is hidden behind it.
   ========================================================== */
.kl79-bottom-nav { display: none; }

@media (max-width: 767px) {
    body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }

    .kl79-bottom-nav {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        position: fixed; left: 0; right: 0; bottom: 0;
        background: var(--paper-light);
        border-top: 1px solid var(--line);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        z-index: 50;
        box-shadow: 0 -4px 20px -8px rgba(45, 74, 62, 0.15);
    }
    .kl79-bottom-nav a,
    .kl79-bottom-nav button {
        display: flex; flex-direction: column; align-items: center;
        justify-content: center; gap: 2px;
        padding: 0.5rem 0.25rem; color: var(--ink-soft);
        font-size: 0.65rem; font-weight: 600;
        text-decoration: none; transition: color 0.15s;
        background: transparent; border: 0; cursor: pointer;
        font-family: inherit;
    }
    .kl79-bottom-nav a svg,
    .kl79-bottom-nav button svg { width: 22px; height: 22px; stroke-width: 2; }
    .kl79-bottom-nav a:hover,
    .kl79-bottom-nav a.active,
    .kl79-bottom-nav button:hover,
    .kl79-bottom-nav button.active { color: var(--forest); }
    .kl79-bottom-nav a.active,
    .kl79-bottom-nav button.active { font-weight: 800; }
    .kl79-bottom-nav a.accent { color: var(--laterite); }
    .kl79-bottom-nav a.accent:hover { color: var(--laterite-d); }

    /* Lift the floating WhatsApp button above the bottom bar */
    .whatsapp-float {
        bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* ==========================================================
   BOTTOM SHEET — used by the mobile "Bus" tab to show the list
   of 11 source towns instead of jumping to a single page.
   ========================================================== */
.kl79-sheet-overlay {
    position: fixed; inset: 0;
    background: rgba(26, 20, 16, 0.45);
    backdrop-filter: blur(2px);
    z-index: 60;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.kl79-sheet-overlay.open { opacity: 1; }

.kl79-sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--paper-light, #f4ede1);
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    box-shadow: 0 -10px 40px -8px rgba(26, 20, 16, 0.25);
    z-index: 61;
    max-height: 82vh;
    display: flex; flex-direction: column;
    padding: 0.5rem 0 env(safe-area-inset-bottom, 0.5rem);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    font-family: 'Noto Sans Malayalam', 'Inter', sans-serif;
}
.kl79-sheet.open { transform: translateY(0); }

.kl79-sheet-handle {
    width: 44px; height: 5px;
    background: rgba(45, 74, 62, 0.22);
    border-radius: 3px;
    margin: 0.5rem auto 0.75rem;
}
.kl79-sheet-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem;
    padding: 0 1.25rem 0.75rem;
    border-bottom: 1px solid var(--line, rgba(26,20,16,0.08));
}
.kl79-sheet-title {
    font-family: 'Noto Sans Malayalam', 'Inter', sans-serif;
    font-size: 1.15rem; font-weight: 800;
    color: var(--ink, #1a1410);
    line-height: 1.3;
}
.kl79-sheet-subtitle {
    font-family: 'Noto Sans Malayalam', 'Inter', sans-serif;
    font-size: 0.78rem; color: var(--ink-soft, #5a4a3f);
    margin-top: 2px;
}
.kl79-sheet-close {
    background: transparent; border: 0; cursor: pointer;
    color: var(--ink-soft, #5a4a3f);
    padding: 6px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.kl79-sheet-close svg { width: 22px; height: 22px; stroke-width: 2; }
.kl79-sheet-close:hover {
    background: rgba(45, 74, 62, 0.08);
    color: var(--forest, #2d4a3e);
}

.kl79-sheet-list {
    overflow-y: auto;
    padding: 0.5rem 0.75rem 1rem;
    -webkit-overflow-scrolling: touch;
}

/* Generic sheet row — used by the Bus source list + More menu */
.kl79-sheet-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 0.85rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--ink, #1a1410);
    transition: background 0.15s;
    border: 1px solid transparent;
}
.kl79-sheet-row:hover,
.kl79-sheet-row:active {
    background: rgba(45, 74, 62, 0.06);
    border-color: rgba(45, 74, 62, 0.12);
}
.kl79-sheet-row + .kl79-sheet-row {
    margin-top: 0.25rem;
}

.kl79-sheet-row-main {
    flex: 1;
    font-family: 'Noto Sans Malayalam', 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink, #1a1410);
}
.kl79-sheet-row-arrow {
    width: 20px; height: 20px;
    color: var(--forest, #2d4a3e);
    opacity: 0.6;
    flex-shrink: 0;
}

/* Variant for the More menu — icon + ML + EN */
.kl79-sheet-row-more {
    padding: 0.75rem 0.85rem;
}
.kl79-sheet-row-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: rgba(45, 74, 62, 0.1);
    color: var(--forest, #2d4a3e);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.kl79-sheet-row-icon svg { width: 22px; height: 22px; }
.kl79-sheet-row-text {
    flex: 1; display: flex; flex-direction: column; gap: 1px;
}
.kl79-sheet-row-ml {
    font-family: 'Noto Sans Malayalam', 'Inter', sans-serif;
    font-size: 1rem; font-weight: 700;
    color: var(--ink, #1a1410);
    line-height: 1.35;
}
.kl79-sheet-row-en {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: var(--ink-soft, #5a4a3f);
    letter-spacing: 0.2px;
}
