/* ==========================================================
   Ledger-themed stylesheet.
   Color values are injected as CSS variables from PHP
   (see includes/header.php) so config.php controls everything.
   ========================================================== */

:root {
    --primary: var(--cfg-primary);
    --secondary: var(--cfg-secondary);
    --dark: var(--cfg-dark);
    --light: var(--cfg-light);
    --accent: var(--cfg-accent);
    --danger: var(--cfg-danger);
    --success: var(--cfg-success);
    --font: var(--cfg-font);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--light);
    color: #1c1c1c;
    line-height: 1.5;
    background-image:
        linear-gradient(rgba(11,61,46,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(11,61,46,0.035) 1px, transparent 1px);
    background-size: 28px 28px;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------------- Landing Page ---------------- */
.navbar {
    background: var(--dark);
    color: #fff;
    padding: 16px 0;
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.25rem; letter-spacing: .3px; }
.brand-mark {
    width: 36px; height: 36px; border-radius: 8px;
    background: linear-gradient(135deg, var(--secondary), var(--accent));
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; color: var(--dark); font-size: 1rem;
}
.nav-actions a { margin-left: 12px; }
.btn {
    display: inline-block; padding: 10px 22px; border-radius: 6px;
    font-weight: 600; font-size: .95rem; border: 2px solid transparent; cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--secondary); color: var(--dark); }
.btn-outline { background: transparent; border-color: #fff; color: #fff; }
.btn-outline:hover { background: #fff; color: var(--dark); }
.btn-block { width: 100%; text-align: center; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-secondary { background: #e7e4da; color: #1c1c1c; }

.hero {
    padding: 90px 0 70px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, var(--dark) 0%, var(--primary) 100%);
    color: #fff;
}
.hero .container { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { font-size: 2.6rem; line-height: 1.15; margin-bottom: 18px; }
.hero h1 span { color: var(--secondary); }
.hero p { font-size: 1.05rem; color: #e7ece9; margin-bottom: 28px; max-width: 46ch; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-visual {
    position: relative; height: 320px; border-radius: 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    overflow: hidden; padding: 20px 22px;
    display: flex; flex-direction: column; gap: 4px; justify-content: center;
}
.hero-visual::before {
    content: "Σ  f(x)  %  ÷  √  π  Δ  ∞";
    position: absolute; top: 10px; right: 16px;
    font-size: 1rem; color: rgba(255,255,255,0.15); font-weight: 700; letter-spacing: 4px;
}
.ledger-row, .ledger-total {
    display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px;
    padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: .88rem; color: rgba(255,255,255,0.85);
}
.ledger-row span:nth-child(2), .ledger-row span:nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; }
.ledger-head { color: var(--secondary); font-weight: 700; text-transform: uppercase; font-size: .74rem; letter-spacing: .06em; border-bottom-color: rgba(255,255,255,0.18); }
.ledger-total {
    grid-template-columns: 1.4fr 1fr 1fr; margin-top: 6px; padding-top: 12px; border-top: 2px solid rgba(255,255,255,0.25);
    border-bottom: none; font-weight: 800; color: var(--secondary); font-size: .95rem;
}
.ledger-total span:last-child { text-align: right; grid-column: 3; }

/* ---------------- Single-screen landing page ---------------- */
body.landing-page { display: flex; flex-direction: column; min-height: 100vh; }
body.landing-page .navbar { flex-shrink: 0; }
body.landing-page .site-footer { flex-shrink: 0; padding: 14px 0; margin-top: 0; }
.hero-single-screen { flex: 1; display: flex; align-items: center; padding: 24px 0; }
.hero-single-screen h1 { font-size: 2.05rem; margin-bottom: 12px; }
.hero-single-screen p { font-size: .95rem; margin-bottom: 18px; }
.hero-single-screen .hero-visual { height: 260px; }

.hero-boxes { display: flex; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.hero-box {
    flex: 1; min-width: 200px; background: #fff; border-radius: 10px; padding: 16px 18px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}
.hero-box-icon { font-size: 1.3rem; margin-bottom: 6px; }
.hero-box h3 { font-size: .92rem; color: var(--dark); margin-bottom: 4px; }
.hero-box p { font-size: .8rem; color: #6b6b6b; margin: 0; }

.features { padding: 70px 0; }
.section-title { text-align: center; margin-bottom: 44px; }
.section-title h2 { font-size: 1.9rem; color: var(--dark); }
.section-title p { color: #5b5b5b; margin-top: 8px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 22px; }
.feature-card {
    background: #fff; border: 1px solid #e5e2d8; border-radius: 12px; padding: 26px;
    box-shadow: 0 2px 10px rgba(11,61,46,0.05);
}
.feature-card .icon { font-size: 1.8rem; color: var(--accent); margin-bottom: 12px; }
.feature-card h3 { font-size: 1.05rem; margin-bottom: 8px; color: var(--dark); }
.feature-card p { color: #5b5b5b; font-size: .92rem; }

.site-footer { background: var(--dark); color: #cfd8d4; padding: 34px 0; margin-top: 40px; }
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: .88rem; }

/* ---------------- Auth Pages (Login / Signup) ---------------- */
.auth-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 40px 16px;
    background: linear-gradient(180deg, var(--dark) 0%, var(--primary) 55%, var(--light) 55%);
}
.auth-card {
    background: #fff; border-radius: 14px; width: 100%; max-width: 440px;
    padding: 36px 34px; box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}
.auth-card .brand { color: var(--dark); justify-content: center; margin-bottom: 6px; }
.auth-card h1 { text-align: center; font-size: 1.4rem; color: var(--dark); margin: 6px 0 4px; }
.auth-card .subtitle { text-align: center; color: #6b6b6b; font-size: .9rem; margin-bottom: 26px; }

/* Login page only: richer accounting/math backdrop + guaranteed single-screen
   fit. The .auth-card itself (the sign-in box) is untouched — only the
   surrounding page chrome changes. */
body.login-page { display: flex; flex-direction: column; min-height: 100vh; }
body.login-page .auth-wrapper {
    flex: 1; min-height: 0; position: relative; overflow: hidden;
    padding: 20px 16px;
}
body.login-page .auth-wrapper::before {
    content: "Σ  f(x)  %  ÷  √  π  Δ  ∞  #  =  Σ  %  ÷  √  Δ  #  =  f(x)  ∞  π  %  Σ  ÷";
    position: absolute; inset: 0; padding: 30px; text-align: justify;
    font-size: 1.5rem; font-weight: 700; line-height: 3.4; letter-spacing: 6px;
    color: rgba(255,255,255,0.07); pointer-events: none;
}
body.login-page .auth-wrapper::after {
    content: "";
    position: absolute; left: 0; right: 0; bottom: 0; height: 45%;
    background-image:
        linear-gradient(rgba(11,61,46,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(11,61,46,0.05) 1px, transparent 1px);
    background-size: 26px 26px; pointer-events: none;
}
body.login-page .auth-card { position: relative; z-index: 1; }
body.login-page .site-footer { flex-shrink: 0; padding: 10px 0; margin-top: 0; }
body.login-page .site-footer .container:first-child { display: none; } /* hide copyright/contact line, keep only dev credit, to save vertical space */

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: var(--dark); margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 11px 13px; border: 1.5px solid #dcd9cf; border-radius: 8px;
    font-size: .95rem; font-family: var(--font); background: #fbfaf7;
}
.form-control:focus { outline: none; border-color: var(--accent); background: #fff; }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

.alert { padding: 12px 16px; border-radius: 8px; font-size: .88rem; margin-bottom: 18px; }
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c2bd; }
.alert-success { background: #eaf6ec; color: var(--success); border: 1px solid #bfe3c4; }
.alert ul { padding-left: 18px; margin-top: 4px; }

.auth-footer-link { text-align: center; margin-top: 20px; font-size: .88rem; color: #6b6b6b; }
.auth-footer-link a { color: var(--accent); font-weight: 600; }

/* ---------------- Dashboard Layout ---------------- */
.dash-wrapper { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px; background: var(--dark); color: #dfe6e2; flex-shrink: 0;
    display: flex; flex-direction: column; padding: 22px 0;
}
.sidebar .brand { padding: 0 22px 22px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 14px; }
.sidebar nav { flex: 1; }
.sidebar .nav-section-title { padding: 14px 22px 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #7f8c86; }
.sidebar a.nav-link {
    display: flex; align-items: center; gap: 10px; padding: 11px 22px; font-size: .93rem;
    color: #d7ded9; border-left: 3px solid transparent;
}
.sidebar a.nav-link:hover { background: rgba(255,255,255,.05); }
.sidebar a.nav-link.active { background: rgba(255,255,255,.08); border-left-color: var(--secondary); color: #fff; font-weight: 600; }
.sidebar .logout-link { margin-top: auto; padding: 14px 22px 0; border-top: 1px solid rgba(255,255,255,.08); }

.main-content { flex: 1; min-width: 0; }
.topbar {
    background: #fff; border-bottom: 1px solid #e6e3d8; padding: 16px 28px;
    display: flex; justify-content: space-between; align-items: center;
}
.topbar h1 { font-size: 1.2rem; color: var(--dark); }
.topbar .user-chip { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: #4a4a4a; }
.avatar-badge {
    width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem;
}
.role-pill {
    display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
}
.role-admin { background: #fdecea; color: var(--danger); }
.role-lecturer { background: #fff4d9; color: #8a6100; }
.role-student { background: #e6f2ee; color: var(--accent); }
.status-pill { padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 700; }
.status-active { background: #eaf6ec; color: var(--success); }
.status-inactive { background: #f1f1f1; color: #767676; }

.access-status-pill { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: .78rem; font-weight: 700; }
.access-active { background: #eaf6ec; color: var(--success); }
.access-expired, .access-none { background: #fdecea; color: var(--danger); }
.device-chip { font-size: .82rem; color: #5b5b5b; }
.device-chip .none { color: #a9a9a9; font-style: italic; }

/* ---------------- Bank details / payment ---------------- */
.bank-details-box {
    background: var(--light); border: 1px solid #e6e3d8; border-radius: 10px;
    padding: 18px 20px; margin-bottom: 18px;
}
.bank-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid #e9e6db;
}
.bank-row:last-child { border-bottom: none; }
.bank-label { color: #6b6b6b; font-size: .85rem; }
.bank-value { font-weight: 700; color: var(--dark); font-size: .95rem; }
.bank-account-copy { display: flex; align-items: center; gap: 10px; }
.copy-btn {
    border: 1px solid var(--accent); background: #fff; color: var(--accent);
    font-size: .75rem; font-weight: 700; padding: 4px 10px; border-radius: 6px; cursor: pointer;
}
.copy-btn:hover { background: var(--accent); color: #fff; }

/* ---------------- WhatsApp ---------------- */
.btn-whatsapp {
    display: inline-flex; align-items: center; gap: 8px; background: #25D366; color: #fff;
    padding: 11px 20px; border-radius: 8px; font-weight: 700; font-size: .92rem;
}
.btn-whatsapp:hover { background: #1ebe5b; }
.wa-icon { font-size: 1.1rem; }

.wa-float-btn {
    position: fixed; bottom: 24px; right: 24px; width: 58px; height: 58px; border-radius: 50%;
    background: #25D366; color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; box-shadow: 0 8px 20px rgba(0,0,0,0.25); z-index: 40;
    transition: transform .15s ease;
}
.wa-float-btn:hover { transform: scale(1.08); }

/* ---------------- Developer branding ---------------- */
.dev-credit { font-size: .78rem; opacity: .75; }
.dev-credit a { font-weight: 600; text-decoration: underline; }

.page-body { padding: 28px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 18px; margin-bottom: 26px; }
.stat-card {
    background: #fff; border: 1px solid #e6e3d8; border-radius: 12px; padding: 22px;
    display: flex; align-items: center; gap: 16px;
}
.stat-icon {
    width: 52px; height: 52px; border-radius: 10px; background: var(--light);
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--accent);
    border: 1px solid #e6e3d8;
}
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--dark); }
.stat-label { font-size: .82rem; color: #6b6b6b; }

.card { background: #fff; border: 1px solid #e6e3d8; border-radius: 12px; margin-bottom: 22px; }
.card-header { padding: 18px 22px; border-bottom: 1px solid #eeece3; display: flex; justify-content: space-between; align-items: center; }
.card-header h2 { font-size: 1.05rem; color: var(--dark); }
.card-body { padding: 22px; }

table.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data-table th {
    text-align: left; background: var(--light); color: var(--dark); font-weight: 700;
    padding: 12px 14px; border-bottom: 2px solid #e6e3d8; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em;
}
table.data-table td { padding: 12px 14px; border-bottom: 1px solid #eeece3; }
table.data-table tr:hover td { background: #fbfaf6; }
.table-actions a, .table-actions button {
    font-size: .8rem; padding: 6px 12px; border-radius: 6px; margin-right: 6px; display: inline-block;
    border: 1px solid #dcd9cf; background: #fff; cursor: pointer;
}
.table-actions a:hover, .table-actions button:hover { background: var(--light); }

.info-list { list-style: none; }
.info-list li { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #eeece3; font-size: .92rem; }
.info-list li:last-child { border-bottom: none; }
.info-list .label { color: #6b6b6b; }
.info-list .value { font-weight: 600; color: var(--dark); }

.empty-state { text-align: center; padding: 40px 20px; color: #8a8a8a; }

.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(10,20,17,.55);
    align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: 14px; padding: 30px; width: 100%; max-width: 460px; }
.modal-box h3 { margin-bottom: 18px; color: var(--dark); }
.modal-close-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

@media (max-width: 860px) {
    .hero .container { grid-template-columns: 1fr; }
    .hero-visual { height: 200px; }
    body.landing-page { min-height: 0; display: block; } /* allow natural scroll on small screens */
    .hero-single-screen .hero-visual { display: none; } /* save space; CTA + highlights matter more on mobile */
    .hero-boxes { flex-direction: column; }
    .dash-wrapper { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 12px; }
    .sidebar .brand { display: none; }
    .sidebar nav { display: flex; }
    .sidebar .nav-section-title { display: none; }
    .sidebar a.nav-link { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
    .sidebar a.nav-link.active { border-left: none; border-bottom-color: var(--secondary); }
    .sidebar .logout-link { display: none; }
    .form-row { flex-direction: column; }
    .page-body { padding: 18px; }
}
