/* iTAMS – DepEd Division of Sagay City */
/* Design: Government-utility meets editorial precision */

:root {
    --deped-blue: #0047AB;
    --deped-blue-dark: #002f7a;
    --deped-blue-light: #1a5dc8;
    --accent: #F5A623;
    --accent-green: #27AE60;
    --accent-red: #E74C3C;
    --accent-purple: #8B5CF6;
    --bg: #F0F4FA;
    --surface: #FFFFFF;
    --surface-2: #F7F9FC;
    --border: #DDE4EF;
    --text-primary: #0D1B3E;
    --text-secondary: #5A6A8A;
    --text-muted: #9AA6BC;
    --sidebar-w: 260px;
    --sidebar-collapsed: 70px;
    --topbar-h: 60px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 12px rgba(0,71,171,0.08);
    --shadow-md: 0 4px 24px rgba(0,71,171,0.12);
    --transition: all 0.22s cubic-bezier(.4,0,.2,1);
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

/* ── APP SHELL ─────────────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ───────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--deped-blue-dark);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-item span:not(.badge-ai),
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .user-info,
.sidebar.collapsed .badge-ai { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-item i { margin: 0; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    min-height: var(--topbar-h);
}

.brand-mark {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 18px;
    color: var(--deped-blue-dark);
    flex-shrink: 0;
}

.brand-text strong {
    display: block;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    color: #fff;
    font-size: 16px;
    letter-spacing: 0.03em;
}
.brand-text small {
    color: rgba(255,255,255,0.5);
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.nav-section-label {
    color: rgba(255,255,255,0.35);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 12px 20px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    border-radius: 0;
    transition: var(--transition);
    font-size: 13.5px;
    font-weight: 400;
    position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-weight: 500;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; }

.badge-ai {
    margin-left: auto;
    background: var(--accent-purple);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 2px 6px;
    border-radius: 4px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.15);
}
.user-avatar {
    width: 34px; height: 34px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: var(--deped-blue-dark);
    flex-shrink: 0;
}
.user-name { display: block; color: #fff; font-size: 12.5px; font-weight: 500; }
.user-role { display: block; color: rgba(255,255,255,0.45); font-size: 10.5px; }
.logout-btn { margin-left: auto; color: rgba(255,255,255,0.4); text-decoration: none; font-size: 14px; transition: var(--transition); }
.logout-btn:hover { color: #fff; }

/* ── MAIN WRAP ─────────────────────────────── */
.main-wrap {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}
.sidebar.collapsed ~ .main-wrap { margin-left: var(--sidebar-collapsed); }

.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    position: sticky; top: 0;
    z-index: 50;
    box-shadow: 0 1px 4px rgba(0,71,171,0.06);
}
.sidebar-toggle { background: none; border: none; cursor: pointer; color: var(--text-secondary); font-size: 16px; padding: 6px; }
.topbar-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.cycle-badge {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex; align-items: center; gap: 6px;
}
.notif-btn { background: none; border: none; cursor: pointer; color: var(--text-secondary); font-size: 16px; position: relative; padding: 6px; }
.notif-dot {
    width: 7px; height: 7px;
    background: var(--accent-red);
    border-radius: 50%;
    position: absolute; top: 4px; right: 4px;
    border: 2px solid var(--surface);
}

.content-area { flex: 1; padding: 28px; }

/* ── ALERTS ────────────────────────────────── */
.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13.5px;
}
.alert-success { background: #E8F8F0; color: #1a7a48; border: 1px solid #A8E6C3; }
.alert-error { background: #FEE8E7; color: #8B1A1A; border: 1px solid #F5C0BC; }

/* ── PAGE HEADER ───────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
}
.page-header h1 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: var(--text-primary);
}
.page-header p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 3px;
}

/* ── CARDS ─────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.card-header {
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}
.card-body { padding: 22px; }

/* ── STAT CARDS ────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px 22px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.stat-icon.blue { background: #EEF3FF; color: var(--deped-blue); }
.stat-icon.green { background: #E8F8F0; color: var(--accent-green); }
.stat-icon.amber { background: #FFF8EE; color: var(--accent); }
.stat-icon.red { background: #FEE8E7; color: var(--accent-red); }
.stat-icon.purple { background: #F3EEFF; color: var(--accent-purple); }

.stat-label { font-size: 11.5px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 26px;
    color: var(--text-primary);
    line-height: 1.1;
}
.stat-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.stat-change {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    display: inline-block;
}
.stat-change.up { background: #E8F8F0; color: var(--accent-green); }
.stat-change.down { background: #FEE8E7; color: var(--accent-red); }

/* ── CONTENT GRID ──────────────────────────── */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.content-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.span-2 { grid-column: span 2; }

/* ── TABLE ─────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.data-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    color: var(--text-primary);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }

/* ── BADGES ────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-success { background: #E8F8F0; color: #1a7a48; }
.badge-warning { background: #FFF8EE; color: #B36A00; }
.badge-danger { background: #FEE8E7; color: #8B1A1A; }
.badge-info { background: #EEF3FF; color: var(--deped-blue); }
.badge-purple { background: #F3EEFF; color: #6D28D9; }
.badge-gray { background: #F3F5F8; color: var(--text-secondary); }

/* ── BUTTONS ───────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: var(--transition);
    font-family: 'DM Sans', sans-serif;
}
.btn-primary { background: var(--deped-blue); color: #fff; }
.btn-primary:hover { background: var(--deped-blue-light); }
.btn-accent { background: var(--accent); color: var(--deped-blue-dark); }
.btn-accent:hover { background: #e09400; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--deped-blue); color: var(--deped-blue); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-danger { background: var(--accent-red); color: #fff; }
.btn-danger:hover { background: #c0392b; }

/* ── FORMS ─────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}
.form-control {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text-primary);
    background: var(--surface);
    font-family: 'DM Sans', sans-serif;
    transition: var(--transition);
    outline: none;
}
.form-control:focus { border-color: var(--deped-blue); box-shadow: 0 0 0 3px rgba(0,71,171,0.08); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.three { grid-template-columns: 1fr 1fr 1fr; }

/* ── FLOWCHART PROCESS INDICATOR ───────────── */
.process-steps {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 24px;
}
.process-step {
    display: flex;
    align-items: center;
    gap: 0;
}
.step-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 90px;
}
.step-circle {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-family: 'Syne', sans-serif;
}
.step-circle.done { background: var(--accent-green); border-color: var(--accent-green); color: #fff; }
.step-circle.active { background: var(--deped-blue); border-color: var(--deped-blue); color: #fff; box-shadow: 0 0 0 4px rgba(0,71,171,0.18); }
.step-circle.pending { background: var(--surface-2); }
.step-label { font-size: 10px; color: var(--text-muted); text-align: center; }
.step-label.active { color: var(--deped-blue); font-weight: 600; }
.step-connector { width: 30px; height: 2px; background: var(--border); margin-bottom: 18px; flex-shrink: 0; }
.step-connector.done { background: var(--accent-green); }

/* ── PROGRESS BAR ──────────────────────────── */
.progress-bar-wrap {
    background: var(--border);
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 20px;
    background: var(--deped-blue);
    transition: width 0.6s ease;
}
.progress-bar-fill.green { background: var(--accent-green); }
.progress-bar-fill.amber { background: var(--accent); }
.progress-bar-fill.red { background: var(--accent-red); }

/* ── ANALYTICS ─────────────────────────────── */
.ai-insight-box {
    background: linear-gradient(135deg, #EEF3FF 0%, #F3EEFF 100%);
    border: 1.5px solid #C5D5FF;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.ai-insight-icon {
    width: 40px; height: 40px;
    background: var(--deped-blue);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}
.ai-insight-content h4 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--deped-blue-dark);
    margin-bottom: 4px;
}
.ai-insight-content p { font-size: 13px; color: var(--text-secondary); }

/* ── LOGIN ─────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: var(--deped-blue-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(245,166,35,0.12) 0%, transparent 70%);
    top: -200px; right: -100px;
}
.login-box {
    background: var(--surface);
    border-radius: 20px;
    padding: 44px 40px;
    width: 420px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}
.login-logo {
    display: flex; align-items: center; gap: 14px;
    justify-content: center;
    margin-bottom: 28px;
}
.login-brand-mark {
    width: 50px; height: 50px;
    background: var(--deped-blue);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 22px;
    color: var(--accent);
}
.login-box h2 {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 26px;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 4px;
}
.login-box p {
    text-align: center;
    color: var(--text-muted);
    font-size: 12.5px;
    margin-bottom: 32px;
}
.login-box .btn { width: 100%; justify-content: center; padding: 12px; font-size: 14px; font-weight: 600; margin-top: 6px; }

/* ── EMPTY STATE ───────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state i { font-size: 40px; margin-bottom: 14px; opacity: 0.4; }
.empty-state p { font-size: 13.5px; }

/* ── UTILITY ───────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.fw-600 { font-weight: 600; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }

/* ── RESPONSIVE ────────────────────────────── */
@media (max-width: 1024px) {
    .content-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrap { margin-left: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .content-area { padding: 16px; }
}
