/* ===================================================
   FUNVAL — Argon Dashboard 3 Inspired UI
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary:       #5e72e4;
    --primary-dark:  #324cdd;
    --success:       #2dce89;
    --info:          #11cdef;
    --warning:       #fb6340;
    --danger:        #f5365c;
    --dark:          #172b4d;
    --muted:         #8898aa;
    --surface:       #f4f5f7;
    --white:         #ffffff;
    --sidebar-w:     260px;
    --card-shadow:   0 2px 12px rgba(50,50,93,.08), 0 1px 4px rgba(0,0,0,.06);
    --transition:    0.22s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--surface);
    color: var(--dark);
    font-size: .875rem;
    min-height: 100vh;
}

h1,h2,h3,h4,h5,h6 { font-weight: 700; color: var(--dark); margin-bottom: .5rem; }
a { text-decoration: none; transition: color var(--transition); }
p { margin-bottom: .5rem; }

/* ================================================
   SIDEBAR
   ================================================ */
#sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: linear-gradient(195deg, #42424a 0%, #191919 100%);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 1.4rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 38px; height: 38px;
    background: linear-gradient(195deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 1rem; flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(94,114,228,.45);
}

.sidebar-brand-text { font-size: .95rem; font-weight: 800; color: white; letter-spacing: 1px; text-transform: uppercase; }
.sidebar-brand-sub  { font-size: .6rem; color: rgba(255,255,255,.4); display: block; font-weight: 400; line-height: 1.2; }

.sidebar-nav { padding: .75rem 0; flex: 1; }

.sidebar-section-title {
    padding: .7rem 1.25rem .2rem;
    font-size: .6rem; font-weight: 700;
    letter-spacing: .09em; text-transform: uppercase;
    color: rgba(255,255,255,.35);
}

.sidebar-item { padding: 0 .75rem; margin-bottom: 2px; }

.sidebar-link {
    display: flex; align-items: center; gap: 11px;
    padding: .55rem .75rem;
    color: rgba(255,255,255,.65) !important;
    border-radius: 8px;
    font-weight: 500; font-size: .79rem;
    transition: all var(--transition);
    cursor: pointer; user-select: none;
    white-space: nowrap; overflow: hidden;
}

.sidebar-link:hover  { background: rgba(255,255,255,.09); color: white !important; }
.sidebar-link.active {
    background: linear-gradient(195deg, rgba(94,114,228,.92), rgba(50,76,221,.92));
    color: white !important;
    box-shadow: 0 3px 10px rgba(94,114,228,.45);
}

.sidebar-link .link-icon {
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem; flex-shrink: 0;
}

.sidebar-link .link-text { flex: 1; }
.sidebar-link .link-badge {
    background: var(--danger); color: white;
    border-radius: 20px; padding: 1px 7px;
    font-size: .62rem; font-weight: 700;
}

.sidebar-user {
    padding: .9rem 1.1rem;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0;
}

.sidebar-user-avatar {
    width: 34px; height: 34px;
    background: linear-gradient(195deg, var(--success), #1aae6f);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 800; font-size: .8rem; flex-shrink: 0;
}

.sidebar-user-info   { flex: 1; overflow: hidden; }
.sidebar-user-name   { color: white; font-size: .76rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role   { color: rgba(255,255,255,.38); font-size: .62rem; }
.sidebar-logout      { color: rgba(255,255,255,.45); font-size: .95rem; cursor: pointer; padding: 4px 6px; border-radius: 6px; transition: all var(--transition); }
.sidebar-logout:hover{ color: var(--danger); background: rgba(245,54,92,.12); }

/* Overlay */
#sidebar-overlay { display: none; position: fixed; top:0;left:0;right:0;bottom:0; background:rgba(0,0,0,.45); z-index:1040; }

/* ================================================
   MAIN CONTENT
   ================================================ */
#main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex; flex-direction: column;
    transition: margin-left var(--transition);
}

/* Top Header */
.top-header {
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0,0,0,.05);
    padding: .65rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 100;
}

.top-header-left  { display: flex; align-items: center; gap: 10px; }

.sidebar-toggle-btn {
    background: none; border: none; color: var(--muted);
    font-size: 1.05rem; cursor: pointer;
    padding: 5px 8px; border-radius: 7px; transition: all var(--transition);
    line-height: 1;
}
.sidebar-toggle-btn:hover { background: var(--surface); color: var(--dark); }

.breadcrumb-area { font-size: .78rem; color: var(--muted); }
.breadcrumb-area strong { color: var(--dark); }

.top-header-right { display: flex; align-items: center; gap: 8px; }

/* Page Content */
.page-content  { padding: 1.5rem; flex: 1; }
.page-title-block { margin-bottom: 1.25rem; }
.page-title-block h1 { font-size: 1.3rem; font-weight: 800; margin: 0; }
.page-title-block p  { color: var(--muted); font-size: .8rem; margin: 3px 0 0; }

/* ================================================
   CARDS
   ================================================ */
.card {
    background: var(--white);
    border: 0;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: transform .18s ease, box-shadow .18s ease;
    overflow: hidden;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(50,50,93,.12), 0 3px 8px rgba(0,0,0,.08); }

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0,0,0,.06);
    padding: 1rem 1.25rem;
    font-weight: 700;
    font-size: .87rem;
    color: var(--dark);
}

.card-body   { padding: 1.25rem; color: var(--dark); }
.card-footer { background: transparent; border-top: 1px solid rgba(0,0,0,.06); padding: .9rem 1.25rem; }

/* glass-card alias */
.glass-card { background: var(--white); border: 0; border-radius: 12px; box-shadow: var(--card-shadow); }

/* Stat Cards */
.stat-card { border: 0; border-radius: 12px; box-shadow: var(--card-shadow); overflow: visible; background: var(--white); }

.stat-icon-box {
    width: 56px; height: 56px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; color: white; flex-shrink: 0;
    margin-top: -12px;
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.stat-icon-box.primary { background: linear-gradient(195deg,#ec407a,#d81b60); }
.stat-icon-box.success { background: linear-gradient(195deg,#66bb6a,#43a047); }
.stat-icon-box.warning { background: linear-gradient(195deg,#ffa726,#fb8c00); }
.stat-icon-box.info    { background: linear-gradient(195deg,#26c6da,#00acc1); }
.stat-icon-box.purple  { background: linear-gradient(195deg,#7e57c2,#512da8); }
.stat-icon-box.danger  { background: linear-gradient(195deg,#ef5350,#e53935); }

.stat-number { font-size: 1.5rem; font-weight: 800; color: var(--dark); line-height: 1.1; }
.stat-label  { font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* ================================================
   PAGE HEADER BLOCKS
   ================================================ */
.page-header {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
    margin-bottom: 1.25rem;
}
.page-header h2 { font-size: 1.2rem; font-weight: 800; margin: 0; }
.page-header p  { color: var(--muted); font-size: .78rem; margin: 3px 0 0; }

/* ================================================
   TABLES — both light and the existing table-dark
   ================================================ */
.table {
    --bs-table-color: var(--dark);
    --bs-table-bg: var(--white);
    --bs-table-border-color: rgba(0,0,0,.06);
    --bs-table-striped-bg: rgba(244,245,247,.7);
    font-size: .8rem; margin-bottom: 0;
}

.table thead th {
    background: var(--surface) !important;
    color: var(--muted) !important;
    font-size: .65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em;
    border-bottom: 1px solid rgba(0,0,0,.08) !important;
    padding: .7rem 1rem; white-space: nowrap;
}
.table td { padding: .7rem 1rem; vertical-align: middle; border-color: rgba(0,0,0,.05); }

/* table-dark kept but styled better */
.table-dark {
    --bs-table-color: rgba(255,255,255,.88);
    --bs-table-bg: #1c2240;
    --bs-table-border-color: rgba(255,255,255,.06);
    --bs-table-striped-bg: rgba(255,255,255,.03);
    --bs-table-hover-bg: rgba(255,255,255,.06);
}
.table-dark thead th {
    background: rgba(255,255,255,.05) !important;
    color: rgba(255,255,255,.45) !important;
    border-bottom: 1px solid rgba(255,255,255,.07) !important;
}
.table-dark td { color: rgba(255,255,255,.88); border-color: rgba(255,255,255,.05); }
.table-dark .text-muted { color: rgba(255,255,255,.45) !important; }

/* ================================================
   FORMS
   ================================================ */
.form-control, .form-select {
    background: var(--white); border: 1px solid #d2d6da;
    border-radius: 8px; padding: .55rem .9rem;
    font-size: .82rem; color: var(--dark);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(94,114,228,.15);
    color: var(--dark); background: var(--white); outline: none;
}
.form-control::placeholder { color: var(--muted); }
.form-label { font-size: .78rem; font-weight: 600; color: var(--dark); margin-bottom: .3rem; }
.input-group-text { background: var(--surface); border: 1px solid #d2d6da; border-radius: 8px; font-size: .82rem; color: var(--muted); }

/* Dark modal form overrides */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select  { background: #2b2d42; border-color: rgba(255,255,255,.15); color: rgba(255,255,255,.9); }
[data-bs-theme="dark"] .form-label   { color: rgba(255,255,255,.7); }
[data-bs-theme="dark"] .input-group-text { background: #2b2d42; border-color: rgba(255,255,255,.15); color: rgba(255,255,255,.45); }
[data-bs-theme="dark"] .modal-content { background: #1e2038; color: rgba(255,255,255,.9); }
[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer { border-color: rgba(255,255,255,.08); }

/* ================================================
   BUTTONS
   ================================================ */
.btn { border-radius: 8px; font-weight: 600; font-size: .8rem; padding: .48rem 1rem; transition: all var(--transition); border: none; cursor: pointer; }

.btn-primary  { background: linear-gradient(195deg, var(--primary), var(--primary-dark)); color: white; box-shadow: 0 3px 10px rgba(94,114,228,.38); }
.btn-primary:hover  { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(94,114,228,.5); color: white; background: linear-gradient(195deg, #6a82eb, var(--primary)); }

.btn-success  { background: linear-gradient(195deg, var(--success), #1aae6f); color: white; box-shadow: 0 3px 10px rgba(45,206,137,.35); }
.btn-success:hover  { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(45,206,137,.48); color: white; }

.btn-warning  { background: linear-gradient(195deg, var(--warning), #e8560e); color: white; box-shadow: 0 3px 10px rgba(251,99,64,.35); }
.btn-warning:hover  { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(251,99,64,.48); color: white; }

.btn-danger   { background: linear-gradient(195deg, var(--danger), #c3134e); color: white; box-shadow: 0 3px 10px rgba(245,54,92,.35); }
.btn-danger:hover   { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(245,54,92,.48); color: white; }

.btn-info     { background: linear-gradient(195deg, var(--info), #0da8c4); color: white; box-shadow: 0 3px 10px rgba(17,205,239,.35); }
.btn-info:hover     { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(17,205,239,.48); color: white; }

.btn-secondary { background: #e9ecef; color: var(--dark); border: 0; }
.btn-secondary:hover { background: #d9dee3; color: var(--dark); transform: translateY(-1px); }

.btn-outline-primary  { border: 1.5px solid var(--primary); color: var(--primary); background: transparent; }
.btn-outline-primary:hover  { background: var(--primary); color: white; transform: translateY(-1px); }

.btn-outline-success  { border: 1.5px solid var(--success); color: var(--success); background: transparent; }
.btn-outline-success:hover  { background: var(--success); color: white; transform: translateY(-1px); }

.btn-outline-danger   { border: 1.5px solid var(--danger); color: var(--danger); background: transparent; }
.btn-outline-danger:hover   { background: var(--danger); color: white; transform: translateY(-1px); }

.btn-outline-warning  { border: 1.5px solid var(--warning); color: var(--warning); background: transparent; }
.btn-outline-warning:hover  { background: var(--warning); color: white; transform: translateY(-1px); }

.btn-outline-info     { border: 1.5px solid var(--info); color: var(--info); background: transparent; }
.btn-outline-info:hover     { background: var(--info); color: white; transform: translateY(-1px); }

.btn-outline-secondary { border: 1.5px solid #d2d6da; color: var(--muted); background: transparent; }
.btn-outline-secondary:hover { background: var(--surface); color: var(--dark); }

.btn-sm { padding: .28rem .65rem; font-size: .74rem; border-radius: 6px; }
.btn-lg { padding: .65rem 1.4rem; font-size: .9rem; }

/* Pulse */
.pulse-btn:hover { animation: pulse-anim 1.6s infinite; }
@keyframes pulse-anim {
    0%  { box-shadow: 0 0 0 0 rgba(94,114,228,.55); }
    70% { box-shadow: 0 0 0 11px rgba(94,114,228,0); }
    100%{ box-shadow: 0 0 0 0 rgba(94,114,228,0); }
}

/* ================================================
   BADGES
   ================================================ */
.badge { font-size: .67rem; font-weight: 700; padding: .28em .6em; border-radius: 6px; letter-spacing: .02em; }

/* ================================================
   MODALS
   ================================================ */
.modal-content { border: 0; border-radius: 14px; box-shadow: 0 16px 48px rgba(0,0,0,.18); background: var(--white); }
.modal-header  { border-bottom: 1px solid rgba(0,0,0,.06); padding: 1.1rem 1.4rem; }
.modal-body    { padding: 1.4rem; }
.modal-footer  { border-top: 1px solid rgba(0,0,0,.06); padding: .9rem 1.4rem; }

/* ================================================
   ALERTS
   ================================================ */
.alert { border: 0; border-radius: 10px; font-size: .82rem; font-weight: 500; }
.alert-success { background: rgba(45,206,137,.12); color: #1a7f56; }
.alert-danger  { background: rgba(245,54,92,.1);  color: #c82333; }
.alert-warning { background: rgba(251,99,64,.1);  color: #c04b0b; }
.alert-info    { background: rgba(17,205,239,.1); color: #0a8fa5; }

/* ================================================
   TABS
   ================================================ */
.nav-tabs { border-bottom: 2px solid rgba(0,0,0,.07); }
.nav-tabs .nav-link {
    border: 0; border-bottom: 2px solid transparent;
    color: var(--muted); font-weight: 600; font-size: .8rem;
    padding: .6rem 1rem; margin-bottom: -2px; border-radius: 0;
    transition: all var(--transition); background: transparent;
}
.nav-tabs .nav-link:hover  { color: var(--primary); border-bottom-color: rgba(94,114,228,.3); }
.nav-tabs .nav-link.active { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }
.tab-content { padding-top: 1rem; }

/* ================================================
   TEXT UTILITIES
   ================================================ */
.text-gradient { background: linear-gradient(90deg, var(--primary), #b06af3); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.text-primary  { color: var(--primary) !important; }
.text-success  { color: #1aae6f !important; }
.text-warning  { color: #d95d0b !important; }
.text-danger   { color: var(--danger) !important; }
.text-info     { color: #0d9cc6 !important; }
.text-muted    { color: var(--muted) !important; }
.text-dark     { color: var(--dark) !important; }

/* ================================================
   LOGIN PAGE
   ================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(195deg, #42424a, #191919);
    display: flex; align-items: center; justify-content: center; padding: 2rem 1rem;
}
.login-card { background: var(--white); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden; width: 100%; max-width: 420px; }
.login-card-header { background: linear-gradient(195deg, var(--primary), var(--primary-dark)); padding: 2rem 2rem 1.5rem; text-align: center; color: white; }
.login-card-header h3 { color: white; font-weight: 800; font-size: 1.45rem; margin: 0; }
.login-card-header p  { color: rgba(255,255,255,.72); font-size: .8rem; margin: 4px 0 0; }
.login-icon-box { width: 60px; height: 60px; background: white; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.7rem; color: var(--primary); margin: 0 auto 1rem; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.login-card-body { padding: 1.75rem 2rem; }

/* ================================================
   INFO BOXES (for breakdown cards)
   ================================================ */
.info-box {
    padding: 1rem 1.25rem; border-radius: 12px;
    background: var(--white); box-shadow: var(--card-shadow);
}
.info-box.border-l-success { border-left: 4px solid var(--success); }
.info-box.border-l-danger  { border-left: 4px solid var(--danger); }
.info-box.border-l-warning { border-left: 4px solid var(--warning); }
.info-box.border-l-primary { border-left: 4px solid var(--primary); }
.info-box .label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.info-box .value { font-size: 1.3rem; font-weight: 800; }

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 991px) {
    #sidebar { transform: translateX(-100%); z-index: 1060; }
    #sidebar.show { transform: translateX(0); }
    #sidebar-overlay.show { display: block; }
    #main-content { margin-left: 0; }
}
@media (max-width: 576px) {
    .page-content { padding: 1rem; }
    .stat-number  { font-size: 1.25rem; }
    .top-header   { padding: .55rem 1rem; }
    .card-body    { padding: 1rem; }
    .page-header  { flex-direction: column; align-items: flex-start; }
}

/* ================================================
   SCROLLBAR
   ================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 10px; }

/* ================================================
   DATATABLES
   ================================================ */
div.dataTables_wrapper { color: var(--dark); }
div.dataTables_filter input { border: 1px solid #d2d6da; border-radius: 8px; padding: .28rem .7rem; font-size: .78rem; color: var(--dark); }
div.dataTables_length select { border: 1px solid #d2d6da; border-radius: 8px; padding: .2rem .45rem; font-size: .78rem; }
.dataTables_info, .dataTables_length, .dataTables_filter label { color: var(--muted); font-size: .76rem; }
.page-link { color: var(--primary); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ================================================
   MISC
   ================================================ */
.list-group-item { border-radius: 0 !important; border-left: 0; border-right: 0; }
