/* =========================================================
   EduManage Web - Light & Clean Professional Theme
   Navy / White palette
   ========================================================= */

:root {
    --navy: #14213D;
    --navy-light: #1F3157;
    --navy-soft: #EAF0FB;
    --gold: #C9A24B;
    --bg: #F4F6FA;
    --card: #FFFFFF;
    --border: #E3E8F0;
    --text-dark: #1B1F2A;
    --text-muted: #6B7280;
    --success: #2E9E5B;
    --success-bg: #E3F6EA;
    --danger: #D64550;
    --danger-bg: #FCEAEA;
    --warning: #E0A53B;
    --warning-bg: #FCF1DE;
    --sidebar-width: 235px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text-dark);
}

a { text-decoration: none; color: inherit; }

/* ===================== LOGIN PAGE ===================== */

.login-page {
    min-height: 100vh;
    display: flex;
}

.login-brand {
    flex: 1.1;
    background: linear-gradient(135deg, #14213D, #1F3157 60%, #2A4373);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 40px;
}

.login-brand .emoji { font-size: 64px; margin-bottom: 10px; }
.login-brand h1 { font-size: 36px; margin: 0 0 6px; }
.login-brand p { margin: 0; opacity: 0.85; }
.login-brand .credit { margin-top: 28px; font-size: 11px; opacity: 0.55; }

.login-formside {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.login-card {
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    padding: 45px 50px;
    width: 100%;
    max-width: 380px;
}

.login-card h2 { margin: 0 0 4px; color: var(--navy); font-size: 24px; }
.login-card .subtitle { margin: 0 0 22px; color: var(--text-muted); font-size: 13px; }

.demo-box {
    background: var(--bg);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 16px;
    font-size: 11px;
    color: var(--text-muted);
}
.demo-box strong { display: block; color: var(--text-dark); margin-bottom: 3px; }

/* ===================== APP SHELL ===================== */

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--navy);
    overflow-y: auto;
    z-index: 100;
}

.sidebar-logo {
    padding: 26px 22px 18px;
}
.sidebar-logo .title { color: white; font-size: 18px; font-weight: bold; }
.sidebar-logo .sub { color: var(--gold); font-size: 10px; letter-spacing: 0.5px; }

.sidebar hr { border: none; border-top: 1px solid rgba(255,255,255,0.08); margin: 0; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 22px;
    color: #C7D1E6;
    font-size: 18px;
    cursor: pointer;
    border-left: 4px solid transparent;
}
.nav-link:hover { background: var(--navy-light); color: white; }
.nav-link.active {
    background: var(--navy-light);
    color: white;
    font-weight: bold;
    border-left-color: var(--gold);
}

.sidebar-footer { padding: 10px 0 18px; margin-top: 12px; }

.topbar {
    position: fixed;
    top: 0; right: 0;
    left: var(--sidebar-width);
    height: 64px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    z-index: 90;
}
.topbar h1 { font-size: 19px; font-weight: bold; margin: 0; flex: 1; }
.topbar .user-block { text-align: right; }
.topbar .user-name { font-size: 13px; font-weight: bold; }
.topbar .user-role { font-size: 11px; color: var(--text-muted); }

.content {
    margin-left: var(--sidebar-width);
    margin-top: 64px;
    padding: 24px 28px 50px;
}

.menu-toggle { display: none; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.2s; }
    .sidebar.open { transform: translateX(0); }
    .topbar, .content { margin-left: 0; left: 0; }
    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px; height: 36px;
        border-radius: 8px;
        background: var(--navy-soft);
        color: var(--navy);
        font-size: 18px;
        margin-right: 12px;
        cursor: pointer;
        border: none;
    }
}

/* ===================== CARDS ===================== */

.page-header { margin-bottom: 18px; }
.page-header h2 { margin: 0 0 2px; font-size: 22px; }
.page-header p { margin: 0; color: var(--text-muted); font-size: 12.5px; }

.section-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 18px;
    box-shadow: 0 2px 10px rgba(20,33,61,0.05);
}

.section-title { font-size: 16px; font-weight: bold; margin: 0 0 14px; }

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

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(20,33,61,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-icon {
    width: 46px; height: 46px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.stat-label { font-size: 11.5px; color: var(--text-muted); font-weight: bold; letter-spacing: 0.3px; }
.stat-value { font-size: 24px; font-weight: bold; }

/* ===================== BUTTONS ===================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 7px;
    padding: 9px 18px;
    font-size: 12.5px;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
}
.btn-sm { padding: 6px 13px; font-size: 11.5px; border-radius: 6px; }

.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-light); }

.btn-secondary { background: var(--navy-soft); color: var(--navy); }
.btn-secondary:hover { background: #dde6f8; }

.btn-gold { background: var(--gold); color: white; }
.btn-gold:hover { filter: brightness(0.93); }

.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #f9d9da; }

.btn-edit { background: var(--navy-soft); color: var(--navy); }
.btn-edit:hover { background: #dde6f8; }

/* ===================== FORMS ===================== */

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: bold; margin-bottom: 5px; }

.form-control, select.form-control, textarea.form-control {
    width: 100%;
    background: #FAFBFD;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 9px 12px;
    font-size: 13px;
    font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--navy); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }

.search-bar {
    display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.search-bar .form-control { max-width: 320px; }

/* ===================== TABLES ===================== */

.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data-table th {
    background: var(--navy-soft);
    color: var(--navy);
    text-align: left;
    padding: 11px 12px;
    font-size: 11.5px;
    font-weight: bold;
    white-space: nowrap;
}
table.data-table th:first-child { border-radius: 8px 0 0 0; }
table.data-table th:last-child { border-radius: 0 8px 0 0; }
table.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.data-table tr:hover td { background: #FBFCFE; }

.photo-thumb {
    width: 34px; height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--border);
}
.photo-frame {
    width: 90px; height: 90px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid var(--border);
    background: #F4F6FA;
}

/* ===================== BADGES ===================== */

.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
}
.badge-active, .badge-present { background: var(--success-bg); color: var(--success); }
.badge-inactive, .badge-absent { background: var(--danger-bg); color: var(--danger); }
.badge-late { background: var(--warning-bg); color: var(--warning); }
.badge-neutral { background: var(--navy-soft); color: var(--navy); }

/* ===================== ALERTS / FLASH ===================== */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: #92660b; }

/* ===================== TABS ===================== */

.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab-link {
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--navy-soft);
    color: var(--navy);
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
}
.tab-link.active { background: var(--navy); color: white; }

/* ===================== PRINTABLE (report cards / receipts) ===================== */

.print-page {
    background: white;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.print-actions { max-width: 800px; margin: 0 auto 16px; display: flex; justify-content: flex-end; gap: 10px; }

@media print {
    .sidebar, .topbar, .print-actions, .no-print { display: none !important; }
    .content { margin: 0; padding: 0; }
    .print-page { border: none; box-shadow: none; max-width: 100%; }
    body { background: white; }
}
