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

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

body {
    font-family: 'Inter', sans-serif;
    background: #f0f2f5;
    color: #1a1d23;
    min-height: 100vh;
}

/* ─── Variables ─── */
:root {
    --primary: #C80E13;
    --primary-dk: #a00b10;
    --secondary: #660135;
    --accent: #FF6A2A;
    --sidebar-w: 260px;
    --nav-h: 64px;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-400: #9ca3af;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --info-bg: #eff6ff;
    --info-border: #bfdbfe;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);
    --radius: 10px;
    --radius-sm: 6px;
}

/* ─── Layout ─── */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #1a0a0c 0%, #3b0012 40%, #660135 100%);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
}

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo img {
    width: 100%;
    max-width: 170px;
    height: 44px;
    object-fit: contain;
    /* filter: brightness(0) invert(1); */
}

.sidebar-logo .app-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    margin-top: 10px;
    display: block;
}

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

.nav-section-label {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    padding: 0 8px;
    margin: 16px 0 6px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar-nav a.active {
    background: rgba(200, 14, 19, 0.8);
    color: #fff;
    box-shadow: 0 2px 8px rgba(200, 14, 19, 0.4);
}

.sidebar-nav a .nav-icon {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

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

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-footer a:hover {
    background: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
}

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

/* ─── Top Bar ─── */
.topbar {
    background: var(--white);
    height: var(--nav-h);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--gray-800);
}

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

.admin-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-800);
}

.admin-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

/* ─── Page Content ─── */
.page-body {
    padding: 28px;
    flex: 1;
}

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

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
}

.page-header p {
    font-size: 0.875rem;
    color: var(--gray-400);
    margin-top: 4px;
}

/* ─── Cards ─── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

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

.card-header-custom h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-800);
}

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

/* ─── Form Controls ─── */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--gray-600);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.form-control,
.form-select {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--gray-800);
    background: var(--white);
    outline: none;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(200, 14, 19, 0.1);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 4px;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    line-height: 1;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dk);
    border-color: var(--primary-dk);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border-color: var(--gray-200);
    color: var(--gray-600);
}

.btn-outline:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

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

.btn-success:hover {
    background: #047857;
    color: var(--white);
}

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

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

.btn-block {
    width: 100%;
    justify-content: center;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

table thead th {
    background: var(--gray-50);
    padding: 11px 16px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gray-600);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

table tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s;
}

table tbody tr:hover {
    background: #faf5f5;
}

table tbody td {
    padding: 12px 16px;
    color: var(--gray-800);
    white-space: nowrap;
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge-primary {
    background: #fef2f2;
    color: var(--primary);
}

.badge-success {
    background: #d1fae5;
    color: var(--success);
}

.badge-warning {
    background: #fef3c7;
    color: var(--warning);
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-600);
}

.badge-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

/* ─── Attendance Grid ─── */
.att-table thead th {
    background: var(--secondary);
    color: #fff;
}

.att-table thead th.weekend {
    background: #7a1940;
    color: rgba(255, 255, 255, 0.5);
}

.att-table tbody td.cell-present {
    background: #d1fae5;
    color: var(--success);
    font-weight: 800;
    text-align: center;
}

.att-table tbody td.cell-absent {
    background: #fee2e2;
    color: var(--danger);
    font-weight: 800;
    text-align: center;
}

.att-table tbody td.cell-weekend {
    background: var(--gray-100);
    color: var(--gray-400);
    text-align: center;
}

/* ─── Stat Cards ─── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.red {
    background: #fff1f2;
}

.stat-icon.green {
    background: #f0fdf4;
}

.stat-icon.blue {
    background: #eff6ff;
}

.stat-icon.orange {
    background: #fff7ed;
}

.stat-info .value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--gray-800);
    line-height: 1;
}

.stat-info .label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-400);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ─── Alerts ─── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 20px;
    border-left: 4px solid transparent;
}

.alert-success {
    background: #f0fdf4;
    border-color: var(--success);
    color: #15803d;
}

.alert-danger {
    background: #fef2f2;
    border-color: var(--danger);
    color: var(--danger);
}

.alert-info {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: #1d4ed8;
}

/* ─── Login Page ─── */
.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.login-left {
    background: linear-gradient(135deg, #1a0a0c 0%, #660135 50%, var(--primary) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    top: -100px;
    right: -100px;
}

.login-left::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    bottom: -80px;
    left: -60px;
}

.login-left img {
    width: 220px;
    object-fit: contain;
    /* filter: brightness(0) invert(1); */
    margin-bottom: 32px;
    z-index: 1;
}

.login-left h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    text-align: center;
    z-index: 1;
    line-height: 1.3;
}

.login-left p {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.9rem;
    text-align: center;
    margin-top: 10px;
    z-index: 1;
    max-width: 300px;
}

.login-right {
    background: var(--gray-50);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--white);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.login-box h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 6px;
}

.login-box p {
    font-size: 0.85rem;
    color: var(--gray-400);
    margin-bottom: 28px;
}

/* ─── Utilities ─── */
.text-primary {
    color: var(--primary);
}

.text-muted {
    color: var(--gray-400);
    font-size: 0.82rem;
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.flex {
    display: flex;
    align-items: center;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.justify-between {
    justify-content: space-between;
}

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .login-page {
        grid-template-columns: 1fr;
    }

    .login-left {
        display: none;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }
}