/* ============================================================
   Scholarship Management System v2
   Navy & Steel Design System
   ============================================================ */

/* ------------------------------------------------------------
   CSS Custom Properties — theme colours injected by layout
   These defaults are overridden by inline :root from settings
   ------------------------------------------------------------ */
:root {
    --primary:          #1e3a5f;
    --primary-dark:     #152b47;
    --primary-light:    #2a4f7c;
    --accent:           #378ADD;
    --accent-light:     #e8f0fb;
    --accent-dark:      #185FA5;
    --text-on-primary:  #ffffff;

    --bg-page:          #f0f2f5;
    --bg-card:          #ffffff;
    --bg-sidebar:       var(--primary);

    --text-primary:     #1a1a2e;
    --text-secondary:   #5a6474;
    --text-muted:       #8a95a3;
    --text-inverse:     #ffffff;

    --border:           #e2e6ea;
    --border-light:     #f0f2f5;

    --success:          #1D9E75;
    --success-light:    #e1f5ee;
    --danger:           #E24B4A;
    --danger-light:     #fcebeb;
    --warning:          #BA7517;
    --warning-light:    #faeeda;
    --info:             #378ADD;
    --info-light:       #e8f0fb;

    --sidebar-width:    240px;
    --header-height:    64px;
    --card-radius:      12px;
    --btn-radius:       8px;
    --input-radius:     8px;

    --shadow-sm:        0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:        0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg:        0 8px 24px rgba(0,0,0,0.10);

    --font:             'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:        'JetBrains Mono', 'Fira Code', monospace;

    --transition:       0.18s ease;
}

/* ------------------------------------------------------------
   Reset & Base
   ------------------------------------------------------------ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100%;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

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

img {
    max-width: 100%;
    display: block;
}

/* ------------------------------------------------------------
   Layout — sidebar + main
   ------------------------------------------------------------ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand-logo img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.sidebar-brand-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-on-primary);
    line-height: 1.3;
}

.sidebar-brand-sub {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-section {
    padding: 16px 16px 4px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.75);
    font-size: 13.5px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    position: relative;
    margin: 1px 8px;
    border-radius: 8px;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}

.sidebar-link.active {
    background: var(--accent);
    color: #ffffff;
}

.sidebar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.85;
}

.sidebar-link.active .sidebar-icon {
    opacity: 1;
}

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background var(--transition);
}

.sidebar-user:hover {
    background: rgba(255,255,255,0.08);
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-username {
    font-size: 12.5px;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
}

.sidebar-role {
    font-size: 10.5px;
    color: rgba(255,255,255,0.4);
}

/* ------------------------------------------------------------
   Main content area
   ------------------------------------------------------------ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ------------------------------------------------------------
   Top header bar
   ------------------------------------------------------------ */
.topbar {
    flex: 0 0 auto;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: relative;
    z-index: 50;
}

.topbar-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ------------------------------------------------------------
   Page content wrapper
   ------------------------------------------------------------ */
.page-content {
    padding: 28px;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
}

.page-header p {
    font-size: 13.5px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ------------------------------------------------------------
   Stat cards — dashboard summary numbers
   ------------------------------------------------------------ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    border: 1px solid var(--border);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

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

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.stat-card-icon.blue   { background: var(--info-light);    color: var(--info); }
.stat-card-icon.green  { background: var(--success-light); color: var(--success); }
.stat-card-icon.amber  { background: var(--warning-light); color: var(--warning); }
.stat-card-icon.red    { background: var(--danger-light);  color: var(--danger); }

.stat-card-label {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card-value.accent  { color: var(--accent); }
.stat-card-value.success { color: var(--success); }
.stat-card-value.warning { color: var(--warning); }
.stat-card-value.danger  { color: var(--danger); }

.stat-card-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* ------------------------------------------------------------
   Cards — general purpose
   ------------------------------------------------------------ */
.card {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.card-body {
    padding: 20px 22px;
}

.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-page);
}

/* ------------------------------------------------------------
   Two column grid for cards
   ------------------------------------------------------------ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* ------------------------------------------------------------
   Tables
   ------------------------------------------------------------ */
.table-wrapper {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table thead th {
    background: var(--bg-page);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 11px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover td {
    background: var(--accent-light);
}

.data-table .amount-cr {
    color: var(--success);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.data-table .amount-dr {
    color: var(--danger);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.data-table .amount-bal {
    color: var(--accent);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   Badges & pills
   ------------------------------------------------------------ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-deposit    { background: var(--success-light); color: var(--success); }
.badge-withdrawal { background: var(--danger-light);  color: var(--danger); }
.badge-expire     { background: var(--warning-light); color: var(--warning); }
.badge-admin      { background: var(--info-light);    color: var(--accent-dark); }
.badge-user       { background: var(--border-light);  color: var(--text-secondary); }

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--btn-radius);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    font-family: var(--font);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-page);
    border-color: var(--text-muted);
}

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.btn-success:hover {
    background: #0F6E56;
    color: #fff;
}

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger-light);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-sm {
    padding: 5px 11px;
    font-size: 12px;
}

.btn-lg {
    padding: 11px 22px;
    font-size: 15px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--btn-radius);
}

/* ------------------------------------------------------------
   Forms
   ------------------------------------------------------------ */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: var(--input-radius);
    font-size: 13.5px;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-card);
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(55,138,221,0.12);
}

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

.form-control:disabled {
    background: var(--bg-page);
    color: var(--text-muted);
    cursor: not-allowed;
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a95a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

/* ------------------------------------------------------------
   Alerts
   ------------------------------------------------------------ */
.alert {
    padding: 12px 16px;
    border-radius: var(--btn-radius);
    font-size: 13.5px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success { background: var(--success-light); color: #085041; border: 1px solid #9FE1CB; }
.alert-danger  { background: var(--danger-light);  color: #791F1F; border: 1px solid #F7C1C1; }
.alert-warning { background: var(--warning-light); color: #633806; border: 1px solid #FAC775; }
.alert-info    { background: var(--info-light);    color: #0C447C; border: 1px solid #B5D4F4; }

/* ------------------------------------------------------------
   Search bar
   ------------------------------------------------------------ */
.search-wrap {
    position: relative;
    flex: 1;
    max-width: 340px;
}

.search-wrap .search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--border);
    border-radius: var(--btn-radius);
    font-size: 13.5px;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-page);
    transition: border-color var(--transition), background var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(55,138,221,0.12);
}

/* ------------------------------------------------------------
   Bowler account card — bank statement style
   ------------------------------------------------------------ */
.account-card {
    background: var(--primary);
    border-radius: var(--card-radius);
    padding: 24px 28px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.account-card::after {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}

.account-card-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 2px;
}

.account-card-id {
    font-size: 12px;
    color: rgba(255,255,255,0.55);
    font-family: var(--font-mono);
    margin-bottom: 24px;
}

.account-card-balances {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.account-balance-item label {
    display: block;
    font-size: 10.5px;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 4px;
}

.account-balance-item .bal-value {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.bal-value.cr  { color: #9FE1CB; }
.bal-value.dr  { color: #F09595; }
.bal-value.net { color: #ffffff; }

/* ------------------------------------------------------------
   Login page
   ------------------------------------------------------------ */
.login-page {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    padding: 24px;
}

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

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo-mark {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

.login-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 6px;
}

.login-sub {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 28px;
}

/* ------------------------------------------------------------
   Pagination
   ------------------------------------------------------------ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    padding: 16px 0 4px;
}

.page-btn {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

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

.page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ------------------------------------------------------------
   Override browser autofill yellow background
   ------------------------------------------------------------ */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px #ffffff inset;
    box-shadow: 0 0 0px 1000px #ffffff inset;
    -webkit-text-fill-color: var(--text-primary);
    transition: background-color 5000s ease-in-out 0s;
}

/* ------------------------------------------------------------
   Utility classes
   ------------------------------------------------------------ */
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.text-muted    { color: var(--text-muted); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.text-accent   { color: var(--accent); }
.font-mono     { font-family: var(--font-mono); }
.font-bold     { font-weight: 700; }

.mt-0  { margin-top: 0; }
.mt-1  { margin-top: 8px; }
.mt-2  { margin-top: 16px; }
.mt-3  { margin-top: 24px; }
.mt-4  { margin-top: 32px; }
.mb-0  { margin-bottom: 0; }
.mb-1  { margin-bottom: 8px; }
.mb-2  { margin-bottom: 16px; }
.mb-3  { margin-bottom: 24px; }
.mb-4  { margin-bottom: 32px; }

.d-flex          { display: flex; }
.align-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1           { gap: 8px; }
.gap-2           { gap: 16px; }
.w-100           { width: 100%; }

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .page-content {
        padding: 16px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .account-card-balances {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .card-grid {
        grid-template-columns: 1fr;
    }
    .login-card {
        padding: 28px 22px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
/* Fix content area full width */
