/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #2563eb;
    --topbar-bg: #ffffff;
    --content-bg: #f1f5f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0891b2;
    --sidebar-width: 240px;
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--content-bg); color: var(--text); }

/* ===== LAYOUT ===== */
.sidebar {
    position: fixed; top: 0; left: 0; height: 100vh;
    width: var(--sidebar-width); background: var(--sidebar-bg);
    display: flex; flex-direction: column; z-index: 1000;
    overflow-y: auto; transition: transform .3s;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 20px 16px; color: #fff;
    font-size: 20px; font-weight: 700; border-bottom: 1px solid #1e293b;
}
.sidebar-brand i { color: var(--primary); font-size: 24px; }
.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-section {
    font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
    color: #475569; padding: 16px 20px 6px; text-transform: uppercase;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px; color: var(--sidebar-text);
    text-decoration: none; font-size: 14px; font-weight: 500;
    transition: all .2s; border-left: 3px solid transparent;
}
.nav-item:hover { background: #1e293b; color: #fff; }
.nav-item.active { background: #1e3a8a; color: #fff; border-left-color: var(--primary); }
.nav-item i { width: 18px; text-align: center; font-size: 15px; }

.main-wrapper { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    background: var(--topbar-bg); border-bottom: 1px solid var(--border);
    padding: 0 24px; height: 60px; display: flex; align-items: center;
    gap: 16px; position: sticky; top: 0; z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.sidebar-toggle { background: none; border: none; font-size: 18px; color: var(--text-muted); cursor: pointer; padding: 6px; }
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text); flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user { font-size: 14px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.topbar-user i { font-size: 20px; color: var(--primary); }
.btn-logout {
    background: none; border: 1px solid var(--border); color: var(--text-muted);
    padding: 6px 14px; border-radius: 6px; font-size: 13px; cursor: pointer;
    transition: all .2s;
}
.btn-logout:hover { background: #fee2e2; color: var(--danger); border-color: var(--danger); }

.content-area { padding: 24px; flex: 1; }

/* ===== ALERTS ===== */
.alert-success-custom {
    background: #dcfce7; color: #166534; border: 1px solid #bbf7d0;
    padding: 12px 16px; border-radius: 8px; margin-bottom: 20px;
    display: flex; align-items: center; gap: 8px; font-size: 14px;
}
.alert-error-custom {
    background: #fee2e2; color: #991b1b; border: 1px solid #fecaca;
    padding: 12px 16px; border-radius: 8px; margin-bottom: 20px;
    display: flex; align-items: center; gap: 8px; font-size: 14px;
}

/* ===== DASHBOARD ===== */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px;
}
.stat-card {
    background: var(--card-bg); border-radius: 12px; padding: 20px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06); border: 1px solid var(--border);
}
.stat-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: #fff; flex-shrink: 0;
}
.stat-card.blue .stat-icon { background: #2563eb; }
.stat-card.green .stat-icon { background: #16a34a; }
.stat-card.orange .stat-icon { background: #ea580c; }
.stat-card.purple .stat-icon { background: #7c3aed; }
.stat-card.red .stat-icon { background: #dc2626; }
.stat-card.teal .stat-icon { background: #0891b2; }
.stat-number { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.quick-actions { display: flex; flex-wrap: wrap; gap: 12px; padding: 4px 0; }
.quick-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 18px; border-radius: 8px; text-decoration: none;
    font-size: 14px; font-weight: 500; color: #fff; transition: opacity .2s;
}
.quick-btn:hover { opacity: .85; color: #fff; }
.quick-btn.blue { background: #2563eb; }
.quick-btn.green { background: #16a34a; }
.quick-btn.orange { background: #ea580c; }
.quick-btn.purple { background: #7c3aed; }
.quick-btn.teal { background: #0891b2; }
.quick-btn.red { background: #dc2626; }

/* ===== CARDS ===== */
.section-card {
    background: var(--card-bg); border-radius: 12px;
    border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.06);
    overflow: hidden;
}
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.section-header h5 { font-size: 15px; font-weight: 600; margin: 0; color: var(--text); }
.btn-view-all {
    font-size: 13px; color: var(--primary); text-decoration: none; font-weight: 500;
}
.btn-view-all:hover { text-decoration: underline; }

/* ===== TABLES ===== */
.data-table {
    width: 100%; border-collapse: collapse; font-size: 14px;
}
.data-table thead tr { background: #f8fafc; }
.data-table th {
    padding: 12px 16px; text-align: left; font-size: 12px;
    font-weight: 600; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .5px; border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 12px 16px; border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }

.table-sm-custom { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-sm-custom th {
    padding: 10px 16px; font-size: 11px; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
    border-bottom: 1px solid var(--border); background: #f8fafc;
}
.table-sm-custom td { padding: 10px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table-sm-custom tbody tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge-status {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
}
.badge-status.active { background: #dcfce7; color: #166534; }
.badge-status.inactive { background: #fee2e2; color: #991b1b; }
.badge-status.pending { background: #fef9c3; color: #854d0e; }
.badge-status.approved { background: #dbeafe; color: #1e40af; }
.badge-status.paid { background: #dcfce7; color: #166534; }
.badge-status.present { background: #dcfce7; color: #166534; }
.badge-status.absent { background: #fee2e2; color: #991b1b; }
.badge-status.late { background: #fef9c3; color: #854d0e; }
.badge-status.leave { background: #f3e8ff; color: #6b21a8; }

.badge-id {
    background: #eff6ff; color: #1d4ed8; padding: 2px 8px;
    border-radius: 4px; font-size: 12px; font-weight: 600; font-family: monospace;
}
.badge-grade {
    display: inline-block; width: 32px; height: 32px; border-radius: 50%;
    background: #2563eb; color: #fff; font-size: 12px; font-weight: 700;
    text-align: center; line-height: 32px;
}
.badge-grade.A { background: #16a34a; }
.badge-grade.B { background: #2563eb; }
.badge-grade.C { background: #d97706; }
.badge-grade.D { background: #ea580c; }
.badge-grade.F { background: #dc2626; }

/* ===== AVATAR ===== */
.avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--primary);
    color: #fff; font-size: 12px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.name-cell { display: flex; align-items: center; gap: 10px; }

/* ===== ACTION BUTTONS ===== */
.action-btns { display: flex; gap: 4px; }
.btn-action {
    width: 30px; height: 30px; border-radius: 6px; border: none;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; cursor: pointer; text-decoration: none; transition: all .2s;
}
.btn-action.view { background: #eff6ff; color: #2563eb; }
.btn-action.view:hover { background: #2563eb; color: #fff; }
.btn-action.edit { background: #fef9c3; color: #854d0e; }
.btn-action.edit:hover { background: #d97706; color: #fff; }
.btn-action.delete { background: #fee2e2; color: #dc2626; }
.btn-action.delete:hover { background: #dc2626; color: #fff; }
.btn-action.pay { background: #dcfce7; color: #16a34a; }
.btn-action.pay:hover { background: #16a34a; color: #fff; }

/* ===== PAGE ACTIONS ===== */
.page-actions { display: flex; justify-content: flex-end; margin-bottom: 16px; gap: 8px; }
.btn-primary-custom {
    background: var(--primary); color: #fff; padding: 9px 18px;
    border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px; border: none; cursor: pointer;
    transition: background .2s;
}
.btn-primary-custom:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary-custom {
    background: #fff; color: var(--text); padding: 9px 18px;
    border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--border); cursor: pointer; transition: all .2s;
}
.btn-secondary-custom:hover { background: #f8fafc; color: var(--text); }
.btn-danger-custom {
    background: #dc2626; color: #fff; padding: 9px 18px;
    border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px; border: none; cursor: pointer;
}
.btn-success-custom {
    background: #16a34a; color: #fff; padding: 9px 18px;
    border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px; border: none; cursor: pointer;
}

/* ===== FILTER BAR ===== */
.filter-bar { padding: 16px 20px; border-bottom: 1px solid var(--border); background: #f8fafc; }
.filter-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-input, .filter-select {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 14px; background: #fff; color: var(--text); min-width: 180px;
}
.filter-input:focus, .filter-select:focus { outline: none; border-color: var(--primary); }
.btn-filter {
    background: var(--primary); color: #fff; border: none; padding: 8px 16px;
    border-radius: 6px; font-size: 14px; cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.btn-clear {
    color: var(--text-muted); text-decoration: none; font-size: 14px; padding: 8px 12px;
}
.btn-clear:hover { color: var(--danger); }

/* ===== FORMS ===== */
.form-page { max-width: 900px; }
.form-card {
    background: var(--card-bg); border-radius: 12px;
    border: 1px solid var(--border); overflow: hidden;
}
.form-card-header {
    padding: 16px 24px; background: #f8fafc; border-bottom: 1px solid var(--border);
    font-size: 16px; font-weight: 600; color: var(--text);
}
.form-body { padding: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid .full-width { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-control {
    padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 14px; color: var(--text); background: #fff; transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-select {
    padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 14px; color: var(--text); background: #fff;
}
.form-select:focus { outline: none; border-color: var(--primary); }
.form-footer {
    padding: 16px 24px; background: #f8fafc; border-top: 1px solid var(--border);
    display: flex; gap: 10px; justify-content: flex-end;
}

/* ===== DETAILS PAGE ===== */
.details-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.detail-row { display: flex; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.detail-row:last-child { border-bottom: none; }
.detail-label { width: 160px; font-size: 13px; color: var(--text-muted); font-weight: 500; flex-shrink: 0; }
.detail-value { font-size: 14px; color: var(--text); font-weight: 500; }

/* ===== PAYSLIP ===== */
.payslip {
    max-width: 700px; margin: 0 auto; background: #fff;
    border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.payslip-header {
    background: var(--primary); color: #fff; padding: 24px 32px;
    display: flex; justify-content: space-between; align-items: center;
}
.payslip-header h2 { font-size: 22px; font-weight: 700; margin: 0; }
.payslip-header p { margin: 4px 0 0; opacity: .85; font-size: 14px; }
.payslip-body { padding: 24px 32px; }
.payslip-section { margin-bottom: 20px; }
.payslip-section h4 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 10px; }
.payslip-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.payslip-row:last-child { border-bottom: none; }
.payslip-total {
    background: #f8fafc; border-radius: 8px; padding: 16px 20px;
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 16px;
}
.payslip-total .label { font-size: 15px; font-weight: 600; }
.payslip-total .amount { font-size: 24px; font-weight: 700; color: var(--primary); }
.payslip-footer { padding: 16px 32px; background: #f8fafc; border-top: 1px solid var(--border); text-align: center; font-size: 12px; color: var(--text-muted); }

/* ===== SUMMARY CARDS ===== */
.summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.summary-card {
    background: var(--card-bg); border-radius: 10px; padding: 16px 20px;
    border: 1px solid var(--border); text-align: center;
}
.summary-card .label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.summary-card .value { font-size: 22px; font-weight: 700; color: var(--text); margin-top: 4px; }
.summary-card.green .value { color: #16a34a; }
.summary-card.red .value { color: #dc2626; }
.summary-card.blue .value { color: #2563eb; }

/* ===== LOGIN PAGE ===== */
.login-body {
    min-height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    display: flex; align-items: center; justify-content: center;
}
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card {
    background: #fff; border-radius: 16px; padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo {
    width: 64px; height: 64px; background: var(--primary); border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; color: #fff; margin: 0 auto 16px;
}
.login-header h2 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.login-header p { color: var(--text-muted); font-size: 14px; }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; }
.input-icon .form-control { padding-left: 36px; }
.btn-login {
    background: var(--primary); color: #fff; border: none; padding: 12px;
    border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer;
    transition: background .2s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-login:hover { background: var(--primary-dark); }
.login-hint { text-align: center; color: var(--text-muted); }

/* ===== ATTENDANCE ===== */
.attendance-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.attendance-table th { padding: 12px 16px; background: #f8fafc; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; border-bottom: 1px solid var(--border); }
.attendance-table td { padding: 10px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.attendance-table select { padding: 5px 10px; border: 1px solid var(--border); border-radius: 5px; font-size: 13px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .details-grid { grid-template-columns: 1fr; }
    .summary-cards { grid-template-columns: 1fr; }
}
