/* =====================================================================
   DSI - Driving School Institute
   assets/css/style.css
   Modern Professional Theme
   ===================================================================== */

:root {
    /* Backgrounds */
    --dsi-bg:        #eef6ff;
    --dsi-surface:   #c8e0fc;
    --dsi-panel:     #ffffff;
    --dsi-surface-2: #f1f7ff;

    /* Borders */
    --dsi-border:    #d2e3f4;
    --dsi-border-2:  #b9d0e8;

    /* Primary */
    --dsi-accent:     #2563eb;
    --dsi-accent-2:   #3b82f6;
    --dsi-accent-dark:#1d4ed8;

    /* Stronger typography */
    --dsi-text:       #0b1f3a;
    --dsi-text-2:     #1e3a5f;
    --dsi-text-dim:   #425d78;
    --dsi-text-muted: #60758a;

    /* Status */
    --dsi-success: #15803d;
    --dsi-danger:  #b91c1c;
    --dsi-warning: #b45309;
    --dsi-info:    #0369a1;

    /* Shadows */
    --dsi-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --dsi-shadow:    0 4px 12px rgba(15, 23, 42, 0.06);
    --dsi-shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.08);

    /* Radius */
    --dsi-radius-sm: 0.5rem;
    --dsi-radius:    0.75rem;
    --dsi-radius-lg: 1rem;

    /* App shell dimensions (single source of truth, used below) */
    --dsi-topbar-height: 4.25rem;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--dsi-bg);
    color: var(--dsi-text);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont,
                 'Segoe UI', sans-serif;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

h1,
h2,
h3,
h4,
h5,
h6,
.font-display {
    font-family: 'Manrope', sans-serif;
    color: var(--dsi-text);
    letter-spacing: -0.015em;
}

h1,
h2,
h3 {
    font-weight: 700;
}

p {
    color: var(--dsi-text-2);
}

/* ================================================================
   SHARED SURFACES
   ================================================================ */

.panel {
    background: var(--dsi-surface);
    border: 1px solid var(--dsi-border);
    border-radius: var(--dsi-radius);
    box-shadow: var(--dsi-shadow-sm);
}

/* Optional helper classes */
.card {
    background: var(--dsi-surface);
    border: 1px solid var(--dsi-border);
    border-radius: var(--dsi-radius);
    box-shadow: var(--dsi-shadow-sm);
}

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

.btn-primary {
    background: var(--dsi-accent);
    color: #ffffff;
    font-weight: 600;
    padding: 0.58rem 1.1rem;
    border-radius: var(--dsi-radius-sm);
    border: 1px solid var(--dsi-accent);
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--dsi-accent-dark);
    border-color: var(--dsi-accent-dark);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.20);
}

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

/* ================================================================
   BADGES
   ================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    line-height: 1;
    font-weight: 600;
    border: 1px solid transparent;
}

.badge-active {
    background: #ecfdf3;
    color: #15803d;
    border-color: #bbf7d0;
}

.badge-completed {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.badge-dropped {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.badge-cancelled {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

/* ================================================================
   FORM INPUTS
   ================================================================ */

.form-input {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--dsi-border-2);
    border-radius: var(--dsi-radius-sm);
    padding: 0.62rem 0.78rem;
    font-size: 0.875rem;
    color: var(--dsi-text);
    font-family: inherit;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

.form-input::placeholder {
    color: var(--dsi-text-muted);
}

.form-input:hover {
    border-color: #94a3b8;
}

.form-input:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--dsi-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ================================================================
   APP SHELL
   ================================================================ */

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;

    padding: 0.68rem 0.9rem;
    border-radius: var(--dsi-radius-sm);

    color: var(--dsi-text-dim);
    font-size: 0.88rem;
    font-weight: 500;

    border: 1px solid transparent;

    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
}

.sidebar-link:hover {
    background: #f8fafc;
    color: var(--dsi-text);
}

.sidebar-link.active {
    background: #eff6ff;
    color: var(--dsi-accent-dark);
    border-color: #dbeafe;
    font-weight: 600;
}

#sidebar {
    width: 16rem;
    min-height: 100vh;

    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;

    padding: 1.25rem;

    background: #ffffff;
    border-right: 1px solid var(--dsi-border);

    display: flex;
    flex-direction: column;
    gap: 0.15rem;

    transform: translateX(-100%);
    transition: transform 0.2s ease;
}

#sidebar.open {
    transform: translateX(0);
}

#sidebarOverlay {
    display: none;
    position: fixed;
    inset: 0;

    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);

    z-index: 30;
}

#sidebarOverlay.open {
    display: block;
}

/* Locked height (not left to the HTML's Tailwind class alone) so this can
   never silently grow taller than the padding-top reserved for it below —
   that mismatch is what let a logo image push content underneath the bar. */
#mobileTopbar {
    display: flex;
    align-items: center;
    height: var(--dsi-topbar-height);
    min-height: var(--dsi-topbar-height);
    max-height: var(--dsi-topbar-height);
    overflow: hidden;

    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--dsi-border);
    backdrop-filter: blur(10px);
}

/* Logo/avatar inside the topbar and sidebar must never exceed their box,
   regardless of the uploaded image's natural dimensions. */
#mobileTopbar img,
#sidebar img {
    display: block;
    width: 2rem;
    height: 2rem;
    object-fit: cover;
    flex-shrink: 0;
}

/* Targeted by #id, not the `main` tag, because Tailwind's `p-5` utility class
   on <main> (see header.php) has higher specificity than a plain tag selector
   and would otherwise silently override padding-top with its own 1.25rem. */
#mainContent {
    margin-left: 0;
    /* topbar height + a small buffer, so text is never flush against the edge */
    padding-top: calc(var(--dsi-topbar-height) + 0.5rem) !important;
}

@media (min-width: 1024px) {

    #sidebar {
        transform: translateX(0);
    }

    #sidebarOverlay {
        display: none !important;
    }

    #mobileTopbar {
        display: none;
    }

    #mainContent {
        margin-left: 16rem;
        padding-top: 2rem !important;
    }
}

/* ================================================================
   AUTH PAGES
   ================================================================ */

body.auth-body {
    min-height: 100vh;
    display: flex;
    background: #f8fafc;
}

body.auth-body.centered {
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

/* ================================================================
   AUTH BRAND PANEL
   ================================================================ */

.brand-panel {
    flex: 1.1;

    position: relative;
    overflow: hidden;

    background:
        radial-gradient(
            circle at 20% 20%,
            rgba(59, 130, 246, 0.28),
            transparent 35%
        ),
        linear-gradient(
            145deg,
            #0f2a5f 0%,
            #123b82 45%,
            #0f172a 100%
        );

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 4rem 3rem;

    color: #ffffff;
}

.brand-panel::before {
    content: "";
    position: absolute;
    inset: 0;

    background:
        linear-gradient(
            120deg,
            transparent 0%,
            rgba(255,255,255,0.04) 45%,
            transparent 70%
        );

    pointer-events: none;
}

.brand-content {
    width: 100%;
    max-width: 26rem;
    position: relative;
    z-index: 2;
}

/* ================================================================
   ROAD-LINE MOTIF
   ================================================================ */

.road-lines {
    position: absolute;
    inset: 0;

    opacity: 0.22;
    pointer-events: none;

    background-image:
        repeating-linear-gradient(
            180deg,
            #bfdbfe 0 40px,
            transparent 40px 76px
        );

    background-size: 5px 76px;
    background-repeat: repeat-y;

    left: 5%;
    width: 5px;

    transform: perspective(500px) rotateX(2deg);

    animation: lane-move 3.2s linear infinite;

    mask-image:
        linear-gradient(
            180deg,
            transparent,
            black 20%,
            black 80%,
            transparent
        );
}

.road-lines.r2 {
    left: auto;
    right: 5%;
    animation-duration: 3.6s;
}

@keyframes lane-move {

    from {
        background-position-y: 0;
    }

    to {
        background-position-y: 76px;
    }

}

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

.brand-mark {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 2rem;
    letter-spacing: -0.03em;

    color: #ffffff;

    position: relative;
    z-index: 1;
}

.brand-sub {
    color: #bfdbfe;
    font-size: 0.95rem;
    margin-top: 0.35rem;

    position: relative;
    z-index: 1;
}

.brand-tagline {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1.35;

    margin-top: 2.5rem;

    color: #ffffff;

    position: relative;
    z-index: 1;
}

.brand-features {
    margin-top: 2.25rem;

    display: flex;
    flex-direction: column;
    gap: 0.75rem;

    position: relative;
    z-index: 1;
}

.brand-feature {
    display: flex;
    align-items: center;
    gap: 0.6rem;

    color: #cbd5e1;
    font-size: 0.875rem;
}

.brand-feature .dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: #60a5fa;

    flex-shrink: 0;

    box-shadow:
        0 0 0 4px rgba(96, 165, 250, 0.10);
}

/* ================================================================
   LOGIN FORM PANEL
   ================================================================ */

.form-panel {
    flex: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 2rem;

    background: #ffffff;
}

.form-card {
    width: 100%;
    max-width: 380px;
}

.form-card h1 {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 1.55rem;

    color: var(--dsi-text);

    margin: 0 0 0.4rem;
}

.form-card p.sub {
    color: var(--dsi-text-dim);
    font-size: 0.9rem;

    margin: 0 0 1.75rem;
}

/* ================================================================
   SIGNUP CARD
   ================================================================ */

.signup-card {
    width: 100%;
    max-width: 440px;

    background: #ffffff;

    border: 1px solid var(--dsi-border);
    border-radius: var(--dsi-radius-lg);

    padding: 2.25rem;

    box-shadow: var(--dsi-shadow-lg);
}

.signup-card h1 {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;

    color: var(--dsi-text);

    margin: 1.5rem 0 0.3rem;
}

.signup-card p.sub {
    color: var(--dsi-text-dim);
    font-size: 0.88rem;

    margin: 0 0 1.5rem;
}

.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

/* ================================================================
   AUTH LABELS
   ================================================================ */

.form-panel label,
.signup-card label {
    display: block;

    font-size: 0.8rem;
    font-weight: 600;

    color: var(--dsi-text-2);

    margin-bottom: 0.4rem;
    margin-top: 1rem;
}

/* ================================================================
   AUTH INPUTS
   ================================================================ */

.form-panel input,
.signup-card input {
    width: 100%;

    background: #ffffff;

    border: 1px solid var(--dsi-border-2);
    border-radius: var(--dsi-radius-sm);

    padding: 0.68rem 0.8rem;

    font-size: 0.92rem;
    color: var(--dsi-text);

    font-family: inherit;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.form-panel input::placeholder,
.signup-card input::placeholder {
    color: var(--dsi-text-muted);
}

.form-panel input:hover,
.signup-card input:hover {
    border-color: #94a3b8;
}

.form-panel input:focus,
.signup-card input:focus {
    outline: none;

    border-color: var(--dsi-accent);

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ================================================================
   AUTH SUBMIT BUTTON
   ================================================================ */

.form-panel button[type="submit"],
.signup-card button[type="submit"] {

    width: 100%;

    margin-top: 1.6rem;

    background: var(--dsi-accent);
    color: #ffffff;

    border: 1px solid var(--dsi-accent);
    border-radius: var(--dsi-radius-sm);

    padding: 0.73rem;

    font-size: 0.93rem;
    font-weight: 600;
    font-family: inherit;

    cursor: pointer;

    transition:
        background 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.form-panel button[type="submit"]:hover,
.signup-card button[type="submit"]:hover {

    background: var(--dsi-accent-dark);
    border-color: var(--dsi-accent-dark);

    box-shadow:
        0 5px 14px rgba(37, 99, 235, 0.20);
}

.form-panel button[type="submit"]:active,
.signup-card button[type="submit"]:active {
    transform: translateY(1px);
}

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

.error-box,
.success-box {

    font-size: 0.84rem;

    padding: 0.65rem 0.82rem;

    border-radius: var(--dsi-radius-sm);

    margin: 1rem 0 0.5rem;
}

.error-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.success-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

/* ================================================================
   AUTH LINKS
   ================================================================ */

.form-links {
    margin-top: 1.5rem;

    text-align: center;

    font-size: 0.85rem;

    color: var(--dsi-text-dim);
}

.form-links a {
    color: var(--dsi-accent);
    text-decoration: none;
    font-weight: 600;

    transition: color 0.15s ease;
}

.form-links a:hover {
    color: var(--dsi-accent-dark);
    text-decoration: underline;
}

/* ================================================================
   TABLE / DATA HELPERS
   ================================================================ */

table {
    color: var(--dsi-text);
}

thead {
    background: #f8fafc;
}

th {
    color: var(--dsi-text-2);
    font-weight: 600;
}

td {
    color: var(--dsi-text-2);
}

tr {
    border-color: var(--dsi-border);
}

tr:hover {
    background: #f8fafc;
}

/* ================================================================
   LINKS
   ================================================================ */

a {
    color: var(--dsi-accent);
}

a:hover {
    color: var(--dsi-accent-dark);
}

/* ================================================================
   SCROLLBAR
   ================================================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ================================================================
   MOBILE
   ================================================================ */

@media (max-width: 768px) {

    .brand-panel {
        display: none;
    }

    .form-panel {
        padding: 1.25rem;
    }

}

@media (max-width: 480px) {

    .signup-card {
        padding: 1.5rem;

        border-radius: 0.85rem;

        box-shadow: var(--dsi-shadow);
    }

    .row-2 {
        grid-template-columns: 1fr;
    }

}
