/* =====================================================================
   GoECR Portal — Skote-inspired admin theme
   ===================================================================== */
:root {
    --sidebar-width: 240px;
    --topbar-height: 70px;

    /* Sidebar */
    --sb-bg: #2a3042;
    --sb-brand-bg: #222736;
    --sb-item-color: rgba(255,255,255,.6);
    --sb-item-hover: rgba(255,255,255,.85);
    --sb-item-active: #fff;
    --sb-active-bar: #556ee6;
    --sb-label-color: rgba(255,255,255,.25);

    /* Brand colors */
    --primary:   #556ee6;
    --success:   #34c38f;
    --warning:   #f1b44c;
    --danger:    #f46a6a;
    --info:      #50a5f1;
    --secondary: #74788d;

    /* Page */
    --body-bg:    #f8f8fb;
    --topbar-bg:  #fff;
    --card-bg:    #fff;
    --card-shadow: 0 2px 6px rgba(15,34,58,.12);
    --border:     #e9ecef;

    --text-main: #343a40;
    --text-muted: #74788d;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 15px; } }

body {
    margin: 0;
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--body-bg);
    color: var(--text-main);
    line-height: 1.5;
}

a { color: var(--primary); }
a:hover { color: #4458c8; }

/* ---- SIDEBAR ---- */
#sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sb-bg);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    transition: width .25s ease, transform .25s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.08) transparent;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 2px; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    height: var(--topbar-height);
    padding: 0 1.25rem;
    background: var(--sb-brand-bg);
    text-decoration: none;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,.04);
    overflow: hidden;
    white-space: nowrap;
}

.sb-logo {
    width: 34px; height: 34px;
    background: var(--primary);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sb-brand-text {
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.15;
}
.sb-brand-text small {
    display: block;
    font-size: .62rem;
    font-weight: 400;
    color: rgba(255,255,255,.35);
    text-transform: uppercase;
    letter-spacing: .06em;
}

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

.sb-label {
    padding: .85rem 1.25rem .3rem;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--sb-label-color);
    white-space: nowrap;
    overflow: hidden;
}

.sb-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .62rem 1.25rem;
    color: var(--sb-item-color);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    transition: color .15s, background .15s;
}
.sb-link i { font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center; }
.sb-link span { overflow: hidden; text-overflow: ellipsis; }
.sb-link:hover { color: var(--sb-item-hover); background: rgba(255,255,255,.05); }
.sb-link.active { color: var(--sb-item-active); background: rgba(255,255,255,.07); }
.sb-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--sb-active-bar);
    border-radius: 0 2px 2px 0;
}

/* Sidebar collapsed */
body.sb-collapsed #sidebar { width: 70px; }
body.sb-collapsed .sb-brand-text,
body.sb-collapsed .sb-label,
body.sb-collapsed .sb-link span { display: none !important; }
body.sb-collapsed .sb-link { justify-content: center; padding: .65rem; gap: 0; }
body.sb-collapsed .sb-link i { width: auto; }
body.sb-collapsed #topbar { left: 70px; }
body.sb-collapsed #main { margin-left: 70px; }

/* ---- TOPBAR ---- */
#topbar {
    position: fixed;
    top: 0; left: var(--sidebar-width); right: 0;
    height: var(--topbar-height);
    background: var(--topbar-bg);
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: .75rem;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(15,34,58,.06);
    transition: left .25s ease;
}

.tb-toggle {
    background: none; border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1;
    padding: .3rem .4rem;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.tb-toggle:hover { background: var(--body-bg); color: var(--text-main); }

.tb-spacer { flex: 1; }

.tb-btn {
    background: none; border: none;
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.tb-btn:hover { background: var(--body-bg); color: var(--text-main); }

.tb-divider { width: 1px; height: 24px; background: var(--border); margin: 0 .15rem; }

.tb-user {
    display: flex; align-items: center; gap: .5rem;
    background: none; border: none;
    padding: .25rem .6rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-main);
    text-decoration: none;
    transition: background .15s;
}
.tb-user:hover { background: var(--body-bg); }

.tb-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), #7b8ff5);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.tb-user-meta { text-align: left; display: none; }
@media (min-width: 768px) { .tb-user-meta { display: block; } }
.tb-user-name { font-size: .8rem; font-weight: 600; line-height: 1.2; color: var(--text-main); }
.tb-user-role { font-size: .7rem; color: var(--text-muted); line-height: 1.2; }

/* dropdown tweak */
.dropdown-menu { border: 0; border-radius: 8px; box-shadow: 0 8px 24px rgba(15,34,58,.14); font-size: .875rem; min-width: 180px; }
.dropdown-item { padding: .5rem 1rem; color: var(--text-main); border-radius: 6px; margin: 1px 4px; }
.dropdown-item:hover { background: #f6f7ff; color: var(--primary); }
.dropdown-divider { border-color: var(--border); margin: 4px 0; }

/* mobile overlay */
.sb-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1039;
    backdrop-filter: blur(1px);
}
@media (max-width: 991px) {
    body.sb-open .sb-overlay { display: block; }
    body.sb-open #sidebar { transform: none; }
}
@media (max-width: 991px) {
    #sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; }
    #topbar { left: 0 !important; }
    #main { margin-left: 0 !important; }
}

/* ---- MAIN ---- */
#main {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    padding: 1.5rem;
    transition: margin-left .25s ease;
}

/* Page title box */
.page-title-box {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .5rem;
}
.page-title { font-size: 1rem; font-weight: 600; color: var(--text-main); margin: 0 0 .15rem; }
.page-crumb {
    display: flex; align-items: center; gap: .2rem;
    font-size: .78rem; color: var(--text-muted);
    list-style: none; margin: 0; padding: 0;
}
.page-crumb a { color: var(--text-muted); text-decoration: none; }
.page-crumb a:hover { color: var(--primary); }
.page-crumb li + li::before { content: '›'; margin-right: .2rem; color: #ccc; }

/* ---- CARDS ---- */
.card { border: 0; border-radius: 10px; box-shadow: var(--card-shadow); background: var(--card-bg); }
.card-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    border-radius: 10px 10px 0 0 !important;
    padding: .9rem 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    font-size: .9rem;
    display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 1.25rem; }
.card-footer { background: var(--card-bg); border-top: 1px solid var(--border); border-radius: 0 0 10px 10px !important; }

/* Stat cards */
.stat-card {
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,.1);
}
.stat-card-primary { background: linear-gradient(135deg, #556ee6, #7b8ff5); }
.stat-card-success { background: linear-gradient(135deg, #34c38f, #4ed4a4); }
.stat-card-warning { background: linear-gradient(135deg, #f1b44c, #f5c876); }
.stat-card-info    { background: linear-gradient(135deg, #50a5f1, #78bef5); }

.stat-card-icon {
    position: absolute;
    right: 1.25rem; top: 50%; transform: translateY(-50%);
    font-size: 4rem;
    opacity: .13;
}
.stat-card-value { font-size: 2.25rem; font-weight: 700; line-height: 1; }
.stat-card-label { font-size: .85rem; margin-top: .25rem; opacity: .85; }
.stat-card-sub {
    margin-top: .9rem;
    padding-top: .7rem;
    border-top: 1px solid rgba(255,255,255,.2);
    font-size: .78rem;
    opacity: .8;
    display: flex; align-items: center; gap: .3rem;
}

/* ---- TABLES ---- */
.table { font-size: .875rem; color: var(--text-main); }
.table > thead > tr > th {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    background: #f8f9fb;
    border-bottom: 1px solid var(--border);
    padding: .7rem 1rem;
}
.table > tbody > tr > td { padding: .75rem 1rem; vertical-align: middle; border-color: var(--border); }
.table-hover > tbody > tr:hover > td { background: #f8f9fb; }

/* ---- FORMS ---- */
.form-control, .form-select {
    border-color: #e2e5e8;
    border-radius: 6px;
    font-size: .875rem;
    padding: .45rem .75rem;
    color: var(--text-main);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .15rem rgba(85,110,230,.18);
    outline: none;
}
.form-label { font-size: .82rem; font-weight: 500; color: #495057; margin-bottom: .4rem; }
.input-group-text { background: #f8f9fb; border-color: #e2e5e8; font-size: .875rem; }

/* ---- BUTTONS ---- */
.btn { border-radius: 6px; font-size: .875rem; font-weight: 500; transition: all .15s; }
.btn-sm { font-size: .78rem; padding: .25rem .65rem; }
.btn:focus { outline: none; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #4458c8; border-color: #4458c8; }
.btn-primary:focus { box-shadow: 0 0 0 .2rem rgba(85,110,230,.35); }

.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #2aab7c; border-color: #2aab7c; }

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

.btn-dark { background: #343a40; border-color: #343a40; }
.btn-dark:hover { background: #23272b; border-color: #23272b; }

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

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

.btn-outline-secondary { color: var(--secondary); border-color: #d6d8db; }
.btn-outline-secondary:hover { background: #f8f9fa; color: var(--text-main); border-color: #c6cacd; }

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

/* ---- BADGES (soft style) ---- */
.badge { font-size: .72rem; font-weight: 600; padding: .3em .65em; border-radius: 4px; letter-spacing: .02em; }

.badge.bg-primary   { background: rgba(85,110,230,.15) !important; color: var(--primary); }
.badge.bg-success   { background: rgba(52,195,143,.15) !important; color: #2aab7c; }
.badge.bg-danger    { background: rgba(244,106,106,.15) !important; color: #d94040; }
.badge.bg-warning   { background: rgba(241,180,76,.15)  !important; color: #d49a30; }
.badge.bg-info      { background: rgba(80,165,241,.15)  !important; color: #3d94dd; }
.badge.bg-secondary { background: rgba(116,120,141,.12) !important; color: var(--secondary); }
.badge.bg-dark      { background: #343a40 !important; color: #fff; }
.badge.bg-light     { background: #f0f2f5 !important; color: #495057; }

/* ---- ALERTS ---- */
.alert { border: 0; border-radius: 8px; font-size: .875rem; }
.alert-success { background: rgba(52,195,143,.12); color: #2aab7c; }
.alert-danger  { background: rgba(244,106,106,.12); color: #d94040; }
.alert-warning { background: rgba(241,180,76,.12);  color: #d49a30; }
.alert-info    { background: rgba(80,165,241,.12);  color: #3d94dd; }
.alert .btn-close { filter: none; }

/* ---- REPORT CARDS ---- */
.report-card { border-radius: 10px; box-shadow: var(--card-shadow); background: #fff; padding: 1.5rem; height: 100%; display: flex; flex-direction: column; }
.report-card-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: 1rem; }
.report-card-title { font-weight: 700; font-size: .95rem; margin-bottom: .35rem; color: var(--text-main); }
.report-card-desc  { color: var(--text-muted); font-size: .82rem; flex: 1; }
.report-card .btn  { margin-top: 1.25rem; align-self: flex-start; }

/* ---- LOGIN PAGE ---- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    background: var(--body-bg);
}

.auth-bg {
    flex: 1;
    background: linear-gradient(135deg, #2a3042 0%, #556ee6 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.auth-bg::before {
    content: '';
    position: absolute;
    width: 350px; height: 350px;
    border-radius: 50%;
    background: rgba(255,255,255,.04);
    top: -80px; right: -80px;
}
.auth-bg::after {
    content: '';
    position: absolute;
    width: 250px; height: 250px;
    border-radius: 50%;
    background: rgba(255,255,255,.04);
    bottom: -60px; left: -60px;
}
.auth-bg-content { position: relative; z-index: 1; max-width: 380px; }
.auth-bg-logo { font-size: 2.5rem; font-weight: 800; letter-spacing: -1px; margin-bottom: .5rem; }
.auth-bg-logo span { color: #7b8ff5; }
.auth-bg-tagline { font-size: 1rem; opacity: .8; margin-bottom: 2rem; }
.auth-bg-feature { display: flex; align-items: center; gap: .75rem; margin-bottom: .9rem; font-size: .875rem; opacity: .85; }
.auth-bg-feature i { font-size: 1.1rem; color: #7b8ff5; }

.auth-form-panel {
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 2.5rem;
    background: #fff;
}
.auth-logo { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-bottom: .25rem; }
.auth-subtitle { color: var(--text-muted); font-size: .875rem; margin-bottom: 2rem; }

.auth-form .form-control { padding: .6rem .9rem; }
.auth-form .btn-submit {
    width: 100%;
    padding: .65rem;
    font-size: .95rem;
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    border-radius: 8px;
    margin-top: .5rem;
}
.auth-form .btn-submit:hover { background: #4458c8; border-color: #4458c8; }

@media (max-width: 768px) {
    .auth-bg { display: none; }
    .auth-form-panel { max-width: 100%; padding: 2rem 1.5rem; }
}

/* ---- MISC ---- */
.page-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .5rem; }
.section-title { font-size: .95rem; font-weight: 600; color: var(--text-main); margin: 0; }

.token-alert { background: rgba(241,180,76,.1); border: 1px solid rgba(241,180,76,.4); border-radius: 10px; padding: 1rem 1.25rem; }
.token-code { font-family: monospace; font-size: 1rem; letter-spacing: .05em; word-break: break-all; color: #c27a00; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 2.5rem; margin-bottom: .75rem; display: block; opacity: .4; }

/* ---- DATATABLES ---- */
/* Restore arrow padding stripped by the .form-select override above */
div.dataTables_length select { padding-right: 2.25rem; }
/* Gap between the length/filter controls row and the table */
div.dataTables_wrapper div.dataTables_length,
div.dataTables_wrapper div.dataTables_filter { margin-bottom: .75rem; }
/* Counteract Bootstrap .row negative margins so controls aren't flush to the edge */
div.dataTables_wrapper { padding: 0 .80rem; }

