﻿/* ============================================
   EPaperSystem_Razorpay — Design System v4
   v4 additions over v3 (CSS-only, no markup or
   backend changes needed — class names unchanged):
     • real mobile breakpoints (1024 / 768 / 480px)
     • hamburger forced visible on mobile via CSS
       (overrides the inline display:none with
       !important — your existing admin-shell.js
       click-toggle logic still runs untouched)
     • animated mobile nav dropdown
     • tactile button press states, focus rings
     • 2-column stat grid on phones instead of
       cards stacking to full width
     • styled scrollbars on the responsive table
     • fluid type via clamp() on a couple of spots
       so nothing overflows on very small screens
   ============================================ */

:root {
    --accent: #2563EB;
    --accent-dark: #1D4ED8;
    --accent-light: #EFF6FF;
    --surface: #FFFFFF;
    --surface-alt: #F8FAFC;
    --border: #E2E8F0;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --success: #16A34A;
    --warning: #D97706;
    --danger: #DC2626;
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(15,23,42,0.06);
    --shadow: 0 4px 16px rgba(15,23,42,0.08);
    --shadow-lg: 0 12px 40px rgba(15,23,42,0.14);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --transition: 0.18s ease;
    /* Type scale — the size that felt right after the last round */
    --fs-root: 14px;
    --fs-xs: 0.75rem;
    --fs-sm: 0.85rem;
    --fs-base: 0.9375rem;
    --fs-md: 1rem;
    --fs-lg: 1.1rem;
    --fs-xl: 1.5rem;
    --fs-2xl: 1.75rem;
    --lh-tight: 1.25;
    --lh-normal: 1.5;
    --lh-relaxed: 1.65;
}

* {
    box-sizing: border-box;
}

html {
    font-size: var(--fs-root);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    background: var(--surface-alt);
    color: var(--text-main);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden; /* stop stray wide elements from causing horizontal page scroll on phones */
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font);
    line-height: var(--lh-tight);
    letter-spacing: -0.01em;
    color: var(--text-main);
}

p {
    line-height: var(--lh-relaxed);
    color: var(--text-muted);
}

a {
    -webkit-tap-highlight-color: transparent;
}

/* Accessible focus ring everywhere, mouse users don't see it thanks to :focus-visible */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- App Shell ---------- */
.app-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow-sm);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: var(--fs-lg);
    color: var(--text-main);
    letter-spacing: -0.02em;
    white-space: nowrap;
}

    .app-brand i {
        color: var(--accent);
        font-size: 1.4rem;
    }

.app-nav {
    display: flex;
    gap: 4px;
}

    .app-nav a {
        padding: 10px 16px;
        border-radius: var(--radius-sm);
        color: var(--text-muted);
        font-size: var(--fs-sm);
        font-weight: 600;
        text-decoration: none;
        transition: all var(--transition);
        white-space: nowrap;
    }

        .app-nav a:hover {
            background: var(--surface-alt);
            color: var(--text-main);
        }

        .app-nav a.active {
            background: var(--accent-light);
            color: var(--accent);
        }

.app-body {
    padding: 28px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ---------- Cards ---------- */
.card-panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 20px;
    transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}

    .card-panel:hover {
        box-shadow: var(--shadow);
    }

.card-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

    .card-panel-header h5 {
        margin: 0;
        font-weight: 700;
        font-size: var(--fs-md);
        display: flex;
        align-items: center;
    }

/* ---------- Stat Cards ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: transform var(--transition), box-shadow var(--transition);
}

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

.stat-card-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 14px;
}

.stat-card-value {
    font-size: clamp(1.3rem, 4vw, var(--fs-xl));
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.stat-card-label {
    color: var(--text-muted);
    font-size: var(--fs-sm);
    font-weight: 500;
    margin-top: 4px;
}

/* ---------- Buttons ---------- */
.btn-nova, .btn-nova-outline {
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

.btn-nova {
    background: var(--accent);
    border: none;
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-size: var(--fs-sm);
    font-weight: 600;
    transition: all var(--transition);
}

    .btn-nova:hover {
        background: var(--accent-dark);
        color: #fff;
        box-shadow: var(--shadow);
    }

    .btn-nova:active, .btn-nova-outline:active {
        transform: scale(0.97);
    }

.btn-nova-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    padding: 9px 17px;
    font-size: var(--fs-sm);
    font-weight: 600;
    transition: all var(--transition);
}

    .btn-nova-outline:hover {
        border-color: var(--accent);
        color: var(--accent);
        background: var(--accent-light);
    }

/* ---------- Tables ---------- */
.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

    .table-responsive::-webkit-scrollbar {
        height: 6px;
    }

    .table-responsive::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 10px;
    }

    .table-responsive::-webkit-scrollbar-track {
        background: transparent;
    }

.table-nova thead th {
    background: var(--surface-alt);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--text-muted);
    border: none;
    padding: 13px 16px;
    white-space: nowrap;
}

.table-nova td {
    padding: 15px 16px;
    border-bottom: 1px solid var(--border);
    font-size: var(--fs-sm);
    vertical-align: middle;
}

.table-nova tbody tr {
    transition: background var(--transition);
}

    .table-nova tbody tr:hover {
        background: var(--surface-alt);
    }

.badge-nova {
    padding: 5px 13px;
    border-radius: 20px;
    font-size: var(--fs-xs);
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

    .badge-nova.success {
        background: #DCFCE7;
        color: #166534;
    }

    .badge-nova.warning {
        background: #FEF3C7;
        color: #92400E;
    }

    .badge-nova.danger {
        background: #FEE2E2;
        color: #991B1B;
    }

    .badge-nova.neutral {
        background: #F1F5F9;
        color: #475569;
    }

/* ---------- Utility text classes ---------- */
.text-meta {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.text-sub {
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

.text-strong-sm {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-main);
}

.list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

    .list-row:last-child {
        border-bottom: none;
    }

.activity-row {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

    .activity-row:last-child {
        border-bottom: none;
    }

.dot-accent {
    font-size: 8px;
    color: var(--accent);
    margin-top: 7px;
    flex-shrink: 0;
}

.empty-state {
    color: var(--text-muted);
    font-size: var(--fs-sm);
    display: block;
    padding: 24px;
    text-align: center;
}

/* ---------- Auth pages ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-light), var(--surface-alt));
    padding: 20px;
}

.auth-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 44px;
    width: 100%;
    max-width: 420px;
}

    .auth-card h2 {
        font-weight: 800;
        font-size: var(--fs-2xl);
        margin-bottom: 6px;
    }

    .auth-card p.subtitle {
        color: var(--text-muted);
        font-size: var(--fs-base);
        margin-bottom: 28px;
    }

.form-control-nova {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    width: 100%;
    font-size: var(--fs-base);
    font-family: var(--font);
    transition: border-color var(--transition);
}

    .form-control-nova:focus {
        border-color: var(--accent);
        outline: none;
        box-shadow: 0 0 0 3px var(--accent-light);
    }

/* ===========================================================
   RESPONSIVE — three real breakpoints instead of one
   =========================================================== */

/* Tablet / small laptop */
@media (max-width: 1024px) {
    .app-body {
        padding: 22px;
    }

    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

/* Phones and the nav collapse point */
@media (max-width: 768px) {
    .app-topbar {
        padding: 0 16px;
        height: 62px;
    }

    .app-brand span {
        display: none;
    }

    .app-nav:not(#mobileNav) {
        display: none;
    }

    .app-body {
        padding: 14px;
    }

    /* Force the hamburger visible — beats the inline style="display:none"
       without needing admin-shell.js to be touched or re-read. */
    #btnMobileNavToggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    .card-panel {
        padding: 18px;
        border-radius: var(--radius-sm);
    }

    .card-panel-header h5 {
        font-size: var(--fs-base);
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        margin-bottom: 10px;
    }

    .stat-card-label {
        font-size: var(--fs-xs);
    }

    .auth-card {
        padding: 26px 20px;
    }

    /* Buttons get a touch-friendly minimum tap target on phones */
    .btn-nova, .btn-nova-outline {
        min-height: 40px;
    }
}

/* Mobile nav dropdown — plays a slide-fade whenever JS flips it visible */
#mobileNav {
    box-shadow: var(--shadow);
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    animation: navDrop 0.2s ease;
}

    #mobileNav a {
        padding: 13px 10px;
        color: var(--text-main);
        text-decoration: none;
        border-bottom: 1px solid var(--border);
        font-size: var(--fs-md);
        font-weight: 500;
        border-radius: var(--radius-sm);
        transition: background var(--transition);
    }

        #mobileNav a:hover {
            background: var(--accent-light);
            color: var(--accent);
        }

        #mobileNav a:last-child {
            border-bottom: none;
        }

@keyframes navDrop {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Small phones */
@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-card-value {
        font-size: 1.25rem;
    }

    .card-panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

        .card-panel-header > a, .card-panel-header > .btn-nova-outline {
            align-self: flex-end;
        }

    .table-nova td, .table-nova thead th {
        padding: 10px 12px;
    }
}
