/* Modern HR & Attendance Management System Stylesheet */
:root {
    --primary: #3b82f6;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --accent: #6366f1;
    --success: #10b981;
    --success-light: #ecfdf5;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;
    --dark: #0f172a;
    --dark-muted: #334155;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --white: #ffffff;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f8fafc;
    color: var(--dark);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography & Links */
a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}
a:hover {
    color: var(--primary-dark);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--dark);
    line-height: 1.25;
}

/* Layout Container */
.container {
    max-width: 1380px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    width: 100%;
}

/* Header & Navbar */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.nav-container {
    max-width: 1380px;
    margin: 0 auto;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.brand-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.25rem;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.35);
}

.brand-text h1 {
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    color: var(--dark);
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 500;
    display: block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}

.nav-item a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.95rem;
    border-radius: var(--radius-md);
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.92rem;
    transition: var(--transition);
}

.nav-item a:hover {
    background: var(--gray-100);
    color: var(--dark);
}

.nav-item.active a {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
}

.nav-item-icon {
    font-size: 1.1rem;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #0f172a;
}

.page-subtitle {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}

/* KPI / Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.stat-icon.primary { background: #dbeafe; color: #1d4ed8; }
.stat-icon.success { background: #d1fae5; color: #047857; }
.stat-icon.danger { background: #fee2e2; color: #b91c1c; }
.stat-icon.purple { background: #ede9fe; color: #6d28d9; }
.stat-icon.amber { background: #fef3c7; color: #b45309; }

.stat-content {
    flex-grow: 1;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--dark);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 500;
    margin-top: 0.2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.25;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.25);
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--white);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.35);
}

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

.btn-danger {
    background: var(--danger);
    color: var(--white);
}
.btn-danger:hover {
    background: #dc2626;
    color: var(--white);
}

.btn-outline {
    background: var(--white);
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}
.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--dark);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Form Controls */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.4rem;
}

.form-control, .form-select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    color: var(--dark);
    background-color: var(--white);
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

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

.table td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.9rem;
    vertical-align: middle;
}

.table tbody tr {
    transition: background-color 0.15s;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.badge-present {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.badge-absent {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.badge-halfday {
    background-color: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.badge-holiday {
    background-color: #f5f3ff;
    color: #5b21b6;
    border: 1px solid #ddd6fe;
}

.badge-leave {
    background-color: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.badge-secondary {
    background-color: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
}

.badge-active {
    background-color: #ecfdf5;
    color: #047857;
}

.badge-inactive {
    background-color: #f1f5f9;
    color: #475569;
}

/* Notice / Alerts */
.alert {
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.92rem;
    border-left: 4px solid transparent;
}

.alert-success {
    background-color: #ecfdf5;
    color: #065f46;
    border-left-color: #10b981;
}

.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border-left-color: #ef4444;
}

.alert-warning {
    background-color: #fffbeb;
    color: #92400e;
    border-left-color: #f59e0b;
}

.alert-info {
    background-color: #eff6ff;
    color: #1e40af;
    border-left-color: #3b82f6;
}

/* Attendance Day Matrix Table */
.matrix-container {
    max-height: 600px;
    overflow: auto;
    position: relative;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
}

.matrix-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
    width: 100%;
}

.matrix-table th, .matrix-table td {
    padding: 0.5rem 0.4rem;
    text-align: center;
    border-right: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
}

.matrix-table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 20;
    font-weight: 700;
}

.matrix-table .sticky-col {
    position: sticky;
    left: 0;
    background: var(--white);
    z-index: 10;
    text-align: left;
    padding-left: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    border-right: 2px solid var(--gray-300);
}

.matrix-table thead .sticky-col {
    z-index: 30;
    background: #f1f5f9;
}

.cell-p {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    font-weight: 700;
}

.cell-a {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
    font-weight: 700;
}

.cell-hd {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    font-weight: 700;
}

.cell-h {
    background-color: #ede9fe !important;
    color: #5b21b6 !important;
    font-weight: 600;
}

.cell-sun {
    background-color: #f1f5f9 !important;
    color: #64748b !important;
    font-weight: 600;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 540px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--gray-400);
    line-height: 1;
    transition: color 0.15s;
}

.modal-close:hover {
    color: var(--dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Quick attendance toggle switches */
.attendance-toggle-group {
    display: inline-flex;
    background: var(--gray-100);
    padding: 3px;
    border-radius: var(--radius-md);
    gap: 2px;
}

.att-btn {
    border: none;
    padding: 5px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
    color: var(--gray-600);
    transition: var(--transition);
}

.att-btn:hover {
    color: var(--dark);
}

.att-btn.active-p {
    background: var(--success);
    color: var(--white);
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
}

.att-btn.active-a {
    background: var(--danger);
    color: var(--white);
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
}

.att-btn.active-hd {
    background: var(--warning);
    color: var(--white);
}

.att-btn.active-l {
    background: #0284c7;
    color: var(--white);
}

/* Footer */
footer {
    margin-top: auto;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: 1.25rem 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* Print Stylesheet */
@media print {
    .navbar, .btn, .page-header .actions, .filter-card, footer, .no-print {
        display: none !important;
    }
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .card {
        border: none !important;
        box-shadow: none !important;
    }
    .container {
        max-width: 100% !important;
        padding: 0 !important;
    }
    .matrix-container {
        max-height: none !important;
        overflow: visible !important;
        border: 1px solid #000 !important;
    }
    .matrix-table th, .matrix-table td {
        border: 1px solid #999 !important;
    }
}
