/* ==========================================================
   Lone's Laundry Services — default brand theme.
   These CSS variables are the fallback brand. In the full
   build, PHP will echo per-tenant overrides into a <style>
   block from tenant_settings so each tenant sees their own
   colours/logo without touching this file.
   ========================================================== */
:root {
    --brand-primary: #2E1A47;      /* deep purple */
    --brand-secondary: #E6217E;    /* magenta / pink */
    --brand-accent: #9B87D9;       /* soft lavender */
    --brand-on-primary: #FFFFFF;
    --brand-surface: #FAF9FC;
    --brand-radius: 14px;
    /* Real measured height of .bottom-nav (padding + icon + label) —
       used so bottom clearance is always provably nav-height-plus-margin,
       not a guessed flat number. */
    --bottom-nav-height: 71px;
}

body {
    background: var(--brand-surface);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Font Awesome <i> icons render slightly smaller than surrounding
   text by default — solid-weight glyphs look visually heavier/bigger
   than text at the same nominal font-size, so sizing them down a touch
   keeps icons feeling like accents rather than competing with labels. */
.fa-solid, .fa-brands, .fa-regular {
    font-size: 0.85em;
    vertical-align: -0.06em;
}

/* Shared KPI-card component — used on every dashboard (business,
   admin, driver) for consistent, elegant stat display instead of
   plain unstyled numbers. */
.kpi-card {
    background: #fff; border-radius: 16px; padding: 18px 20px;
    border: 1px solid #f0ecf5; transition: box-shadow 0.15s ease;
}
.kpi-card:hover { box-shadow: 0 6px 20px rgba(46,26,71,0.08); }
.kpi-icon {
    width: 38px; height: 38px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; margin-bottom: 12px;
}
.kpi-value { font-size: 26px; font-weight: 800; color: #1a1a2e; line-height: 1.1; }
.kpi-label { font-size: 12.5px; color: #8a8a9e; font-weight: 600; margin-top: 4px; }
.dash-section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #8a8a9e; margin-bottom: 12px; }

.btn-brand-primary {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: var(--brand-on-primary);
}
.btn-brand-primary:hover, .btn-brand-primary:focus {
    background-color: #3d2563;
    border-color: #3d2563;
    color: var(--brand-on-primary);
}
.btn-brand-secondary {
    background-color: var(--brand-secondary);
    border-color: var(--brand-secondary);
    color: #fff;
}
.text-brand-primary { color: var(--brand-primary); }
.text-brand-secondary { color: var(--brand-secondary); }
.bg-brand-primary { background-color: var(--brand-primary); }

/* ---------- Auth pages ---------- */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-wrapper { width: 100%; max-width: 420px; padding: 16px; }
.auth-card {
    background: #fff;
    border-radius: var(--brand-radius);
    box-shadow: 0 10px 40px rgba(46, 26, 71, 0.12);
    padding: 32px 28px;
}
.auth-logo { max-width: 220px; width: 100%; height: auto; }

/* ---------- App shell ---------- */
.app-topbar {
    background: var(--brand-primary);
    color: var(--brand-on-primary);
    min-height: 56px;
}
.app-topbar .brand-name { font-weight: 700; letter-spacing: .3px; }

.avatar-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 1.5px solid rgba(255,255,255,0.5);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; padding: 0;
    cursor: pointer;
    transition: background 0.15s ease;
}
.avatar-btn:hover, .avatar-btn:focus { background: rgba(255,255,255,0.35); }
.avatar-btn-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.topbar-icon-link {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 15px;
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    transition: background 0.15s ease;
}
.topbar-icon-link.topbar-icon-accent { color: rgba(255,255,255,0.85); }
.topbar-icon-link:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* Avatar dropdown: icons read as near-black by default (Bootstrap's
   .dropdown-item text color) — recolor them to the brand purple so
   they match the rest of the UI. Logout keeps its own red styling. */
.dropdown-item:not(.text-danger) i { color: var(--brand-primary); margin-right: 2px; }
.topbar-icon-badge {
    position: absolute; top: -2px; right: -2px;
    background: var(--brand-secondary);
    color: #fff;
    font-size: 10px; font-weight: 700;
    min-width: 16px; height: 16px;
    border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 3px;
    border: 1.5px solid var(--brand-primary);
}

.btn-back {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    background: #f4f0f8;
    color: var(--brand-primary);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid #ece5f3;
    box-shadow: 0 1px 3px rgba(46,26,71,0.06);
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn-back:hover { background: var(--brand-primary); color: #fff; transform: translateX(-2px); box-shadow: 0 4px 10px rgba(46,26,71,0.25); }
.btn-back:visited { color: var(--brand-primary); }
.btn-back:hover:visited { color: #fff; }
.btn-back .back-arrow { font-size: 15px; line-height: 1; }

/* ==========================================================
   Sidebar (admin/business/driver panels — never customer,
   which keeps its bottom mobile nav instead)
   ========================================================== */
.app-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 240px;
    height: 100vh;
    background: #ffffff;
    color: #1a1a2e;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    border-right: 1px solid #eef0f4;
    transition: transform 0.25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 20px 14px;
}
.sidebar-brand img { max-width: 100%; height: auto; max-height: 32px; object-fit: contain; }

.sidebar-scroll {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 14px 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin; scrollbar-color: #d8d5e2 transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: #d8d5e2; border-radius: 999px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-group-label {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.6px; color: #adb1c4;
    padding: 14px 10px 6px;
}
.sidebar-link {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px;
    margin-bottom: 2px;
    border-radius: 10px;
    color: #5c5f72;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.12s ease, color 0.12s ease;
    position: relative;
}
.sidebar-link:hover { background: #f5f4fa; color: var(--brand-primary); }
.sidebar-link-active {
    background: var(--brand-primary);
    color: #fff;
    font-weight: 600;
}
.sidebar-link-active .sidebar-icon { opacity: 1; }
.sidebar-icon {
    width: 17px; text-align: center; flex-shrink: 0;
    font-size: 13.5px; opacity: 0.7;
}
.sidebar-divider { height: 1px; background: #eef0f4; margin: 12px 10px; }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid #eef0f4;
}
.sidebar-footer .sidebar-link { color: #b3261e; }
.sidebar-footer .sidebar-link:hover { background: #fdeceb; color: #b3261e; }

.sidebar-toggle-btn {
    display: none;
    position: fixed; top: 14px; left: 14px; z-index: 1050;
    width: 38px; height: 38px; border-radius: 10px;
    background: #fff; color: var(--brand-primary); border: 1px solid #eef0f4;
    font-size: 16px; box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}
.sidebar-backdrop {
    display: none;

    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1035;
}

body.has-sidebar { margin-left: 240px; }

@media (max-width: 991.98px) {
    body.has-sidebar { margin-left: 0; }
    body.has-sidebar .app-topbar { padding-left: 60px; }
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.sidebar-open { transform: translateX(0); }
    .sidebar-toggle-btn { display: block; }
    .sidebar-backdrop.sidebar-open { display: block; }
}

.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-around;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
    z-index: 1000;
}
.bottom-nav a {
    flex: 1;
    text-align: center;
    font-size: 11px;
    color: #6b6b6b;
    text-decoration: none;
    padding: 6px 2px;
}
.bottom-nav a.active { color: var(--brand-primary); font-weight: 600; }
.bottom-nav .nav-icon { display: block; font-size: 18px; margin-bottom: 2px; }
.notif-badge {
    background: var(--brand-secondary);
    color: #fff;
    font-size: 10px;
    border-radius: 999px;
    padding: 1px 5px;
    position: relative;
    top: -8px;
    left: 2px;
}

@media (min-width: 768px) {
    .bottom-nav { display: none; }
}

/* Guarantees content (especially submit/action buttons) never ends up
   hidden behind the fixed bottom nav bar on mobile. Needs !important
   because Bootstrap's own .py-4 utility sets padding-bottom with
   !important, which would otherwise silently win over a plain inline
   style. Padding is bottom-nav-height + 24px margin (well over the
   3px-minimum requirement) plus the device's safe-area inset, so it
   stays correct on notched phones too. */
@media (max-width: 767.98px) {
    .mobile-bottom-clearance {
        padding-bottom: calc(var(--bottom-nav-height) + 24px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* ==========================================================
   Action-notification ribbon (toast) component
   ========================================================== */
.notification-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: min(420px, calc(100vw - 40px));
    display: flex;
    flex-direction: column-reverse; /* stack upward on desktop */
    gap: 12px;
    z-index: 9999;
    pointer-events: none;
}

.action-ribbon {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px 42px 15px 16px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    animation: ribbonInDesktop 0.25s ease-out;
    border-left: 5px solid var(--brand-primary);
}
.action-ribbon-success { border-left-color: #1FA97A; }
.action-ribbon-error   { border-left-color: #E23B4E; }
.action-ribbon-warning { border-left-color: #E6A100; }
.action-ribbon-info    { border-left-color: var(--brand-accent); }

.action-ribbon-icon {
    flex: 0 0 auto;
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold;
    color: #fff;
    background: var(--brand-primary);
}
.action-ribbon-success .action-ribbon-icon { background: #1FA97A; }
.action-ribbon-error .action-ribbon-icon   { background: #E23B4E; }
.action-ribbon-warning .action-ribbon-icon { background: #E6A100; }
.action-ribbon-info .action-ribbon-icon    { background: var(--brand-accent); }

.action-ribbon-content { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.action-ribbon-content strong { color: #222; }
.action-ribbon-content span { color: #555; }

.action-ribbon-close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #999;
}
.action-ribbon-close:hover { color: #333; }

@keyframes ribbonInDesktop {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes ribbonInMobile {
    from { opacity: 0; transform: translateY(-15px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 767.98px) {
    .notification-container {
        top: 16px;
        right: 12px;
        bottom: auto;
        left: auto;
        width: calc(100vw - 24px);
        flex-direction: column; /* stack downward on mobile */
    }
    .action-ribbon { animation-name: ribbonInMobile; }
}
