/* =====================================================
   ESS — Employee Self Service Portal Stylesheet
   Light theme with blue accents
   ===================================================== */

/* ── Variables ─────────────────────────────────────── */
:root {
    --ess-primary:   #2563eb;
    --ess-primary-d: #1d4ed8;
    --ess-sidebar:   #1e3a5f;
    --ess-sidebar-d: #162d49;
    --ess-accent:    #0ea5e9;
    --ess-success:   #10b981;
    --ess-danger:    #ef4444;
    --ess-warning:   #f59e0b;
    --ess-info:      #06b6d4;
    --ess-bg:        #f0f4f8;
    --ess-card:      #ffffff;
    --ess-border:    #e2e8f0;
    --ess-text:      #1e293b;
    --ess-muted:     #64748b;
    --ess-topbar-h:  60px;
    --ess-sidebar-w: 250px;
    --radius:        10px;
    --shadow:        0 2px 12px rgba(0,0,0,0.08);
    --shadow-md:     0 4px 20px rgba(0,0,0,0.12);
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--ess-bg);
    color: var(--ess-text);
    font-size: 14px;
    line-height: 1.5;
}
a { color: var(--ess-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
img { max-width: 100%; }

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

/* ── Sidebar ─────────────────────────────────────────── */
.ess-sidebar {
    width: var(--ess-sidebar-w);
    background: var(--ess-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: transform 0.3s ease;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.ess-sidebar::-webkit-scrollbar { width: 4px; }
.ess-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.ess-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    background: var(--ess-sidebar-d);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.ess-brand i { color: var(--ess-accent); font-size: 1.3rem; }
.ess-brand small { display: block; font-size: 0.65rem; font-weight: 400; color: rgba(255,255,255,0.55); letter-spacing: 0.5px; }

/* Employee info card in sidebar */
.ess-emp-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    background: rgba(0,0,0,0.15);
}
.ess-emp-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 2px solid var(--ess-accent);
    object-fit: cover;
    background: var(--ess-primary);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 1rem;
    flex-shrink: 0;
    overflow: hidden;
}
.ess-emp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ess-emp-info { overflow: hidden; }
.ess-emp-name { color: #fff; font-weight: 600; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ess-emp-code { color: rgba(255,255,255,0.5); font-size: 0.7rem; }

.ess-sidebar-section {
    padding: 14px 18px 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.35);
}
.ess-sidebar-nav { padding: 2px 10px 6px; }
.ess-sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: rgba(255,255,255,0.72);
    border-radius: 7px;
    font-size: 0.85rem;
    transition: all 0.18s;
    text-decoration: none;
}
.ess-sidebar-nav li a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.ess-sidebar-nav li.active a {
    background: var(--ess-primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37,99,235,0.4);
}
.ess-sidebar-nav li a i { width: 18px; text-align: center; font-size: 0.9rem; opacity: 0.85; }
.ess-sidebar-footer {
    margin-top: auto;
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.ess-sidebar-footer a {
    display: flex; align-items: center; gap: 8px;
    color: rgba(255,255,255,0.55);
    font-size: 0.8rem;
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 6px;
    transition: color 0.18s;
}
.ess-sidebar-footer a:hover { color: #fff; text-decoration: none; }

/* ── Sidebar Backdrop (mobile) ────────────────────── */
.ess-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
}
.ess-backdrop.open { display: block; }

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

/* ── Top Bar ──────────────────────────────────────── */
.ess-topbar {
    position: sticky;
    top: 0;
    height: var(--ess-topbar-h);
    background: var(--ess-card);
    border-bottom: 1px solid var(--ess-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.ess-topbar-left { display: flex; align-items: center; gap: 12px; }
.ess-hamburger {
    display: none;
    background: none; border: none; cursor: pointer;
    color: var(--ess-muted);
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.ess-hamburger:hover { background: var(--ess-bg); }
.ess-page-title { font-size: 1rem; font-weight: 700; color: var(--ess-text); }
.ess-topbar-right { display: flex; align-items: center; gap: 10px; }

/* ── Content Area ─────────────────────────────────── */
.ess-content { padding: 24px; flex: 1; }

/* ── Cards ─────────────────────────────────────────── */
.ess-card {
    background: var(--ess-card);
    border-radius: var(--radius);
    border: 1px solid var(--ess-border);
    box-shadow: var(--shadow);
}
.ess-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--ess-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.ess-card-header h5 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ess-text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.ess-card-header h5 i { color: var(--ess-primary); }
.ess-card-body { padding: 20px; }

/* ── Stat Cards ─────────────────────────────────────── */
.ess-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.ess-stat {
    background: var(--ess-card);
    border-radius: var(--radius);
    padding: 18px;
    border: 1px solid var(--ess-border);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ess-stat-icon {
    width: 38px; height: 38px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 4px;
}
.ess-stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.ess-stat-icon.green  { background: #d1fae5; color: #059669; }
.ess-stat-icon.orange { background: #fff7ed; color: #ea580c; }
.ess-stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.ess-stat-icon.red    { background: #fee2e2; color: #dc2626; }
.ess-stat-icon.teal   { background: #ccfbf1; color: #0d9488; }
.ess-stat-val { font-size: 1.6rem; font-weight: 800; color: var(--ess-text); line-height: 1; }
.ess-stat-lbl { font-size: 0.75rem; color: var(--ess-muted); font-weight: 500; }

/* ── Tables ─────────────────────────────────────────── */
.ess-table-wrap { overflow-x: auto; border-radius: var(--radius); }
.ess-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.ess-table thead th {
    background: #f8fafc;
    padding: 10px 14px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--ess-muted);
    border-bottom: 1px solid var(--ess-border);
    white-space: nowrap;
}
.ess-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--ess-text);
    vertical-align: middle;
}
.ess-table tbody tr:last-child td { border-bottom: none; }
.ess-table tbody tr:hover td { background: #f8fafc; }

/* ── Badges ─────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.badge-success  { background: #d1fae5; color: #065f46; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-warning  { background: #fef3c7; color: #92400e; }
.badge-info     { background: #cffafe; color: #164e63; }
.badge-primary  { background: #dbeafe; color: #1d4ed8; }
.badge-secondary{ background: #f1f5f9; color: #475569; }
.badge-purple   { background: #ede9fe; color: #5b21b6; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none; cursor: pointer;
    transition: all 0.18s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: 0.92; }
.btn-primary  { background: var(--ess-primary); color: #fff; }
.btn-primary:hover { background: var(--ess-primary-d); }
.btn-success  { background: var(--ess-success); color: #fff; }
.btn-danger   { background: var(--ess-danger);  color: #fff; }
.btn-warning  { background: var(--ess-warning); color: #fff; }
.btn-secondary{ background: #e2e8f0; color: #475569; }
.btn-outline  { background: transparent; border: 1.5px solid var(--ess-primary); color: var(--ess-primary); }
.btn-outline:hover { background: var(--ess-primary); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 0.78rem; border-radius: 6px; }
.btn-xs { padding: 3px 8px; font-size: 0.72rem; border-radius: 5px; }

/* ── Forms ─────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--ess-text);
}
.form-control {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--ess-border);
    border-radius: 7px;
    font-size: 0.88rem;
    color: var(--ess-text);
    background: #fff;
    transition: border-color 0.18s, box-shadow 0.18s;
    outline: none;
    font-family: inherit;
}
.form-control:focus {
    border-color: var(--ess-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.form-control[readonly] { background: #f8fafc; color: var(--ess-muted); cursor: not-allowed; }
.form-text { font-size: 0.75rem; color: var(--ess-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Alerts ─────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex; align-items: flex-start; gap: 8px;
    margin-bottom: 16px;
}
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid #10b981; }
.alert-danger  { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid #f59e0b; }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid #2563eb; }

/* ── Announcement Cards ──────────────────────────────── */
.announcement-card {
    border-radius: 9px;
    padding: 14px 16px;
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
    border-left: 4px solid;
}
.announcement-card.info    { background: #eff6ff; border-color: #2563eb; }
.announcement-card.success { background: #f0fdf4; border-color: #10b981; }
.announcement-card.warning { background: #fffbeb; border-color: #f59e0b; }
.announcement-card.alert   { background: #fff1f2; border-color: #ef4444; }
.announcement-icon { font-size: 1.3rem; margin-top: 2px; }
.announcement-card.info    .announcement-icon { color: #2563eb; }
.announcement-card.success .announcement-icon { color: #10b981; }
.announcement-card.warning .announcement-icon { color: #f59e0b; }
.announcement-card.alert   .announcement-icon { color: #ef4444; }
.announcement-title { font-weight: 700; font-size: 0.88rem; margin-bottom: 4px; }
.announcement-msg   { font-size: 0.82rem; color: var(--ess-muted); }
.announcement-date  { font-size: 0.7rem; color: var(--ess-muted); margin-top: 6px; }

/* ── Dashboard grid ─────────────────────────────────── */
.ess-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ess-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }

/* ── Login Page ─────────────────────────────────────── */
.ess-login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #0ea5e9 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.ess-login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}
.ess-login-header {
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
    padding: 32px 30px 24px;
    text-align: center;
    color: #fff;
}
.ess-login-header .logo-icon { font-size: 2.5rem; margin-bottom: 10px; }
.ess-login-header h2 { font-size: 1.3rem; font-weight: 700; }
.ess-login-header p  { font-size: 0.8rem; opacity: 0.75; margin-top: 4px; }
.ess-login-body-inner { padding: 28px 30px; }
.ess-login-body-inner .form-control { padding: 11px 14px; }

/* ── Profile ─────────────────────────────────────────── */
.profile-avatar-wrap { text-align: center; padding: 24px 0; }
.profile-avatar {
    width: 90px; height: 90px;
    border-radius: 50%;
    border: 4px solid var(--ess-primary);
    object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700;
    background: var(--ess-primary); color: #fff;
    overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-name { margin-top: 10px; font-weight: 700; font-size: 1.1rem; }
.profile-avatar-code { color: var(--ess-muted); font-size: 0.8rem; }

.info-list { display: flex; flex-direction: column; gap: 0; }
.info-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
}
.info-row:last-child { border-bottom: none; }
.info-lbl { width: 170px; flex-shrink: 0; color: var(--ess-muted); font-weight: 500; }
.info-val { flex: 1; color: var(--ess-text); font-weight: 600; }

/* ── Calendar Grid (Attendance) ──────────────────────── */
.att-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-top: 12px;
}
.cal-head {
    text-align: center;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--ess-muted);
    text-transform: uppercase;
    padding: 4px 0;
}
.cal-day {
    aspect-ratio: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: default;
    position: relative;
    min-height: 38px;
}
.cal-day .day-num { font-size: 0.82rem; font-weight: 700; }
.cal-day .day-tag { font-size: 0.55rem; font-weight: 700; letter-spacing: 0.4px; margin-top: 1px; }
.cal-day.empty        { }
.cal-day.present      { background: #d1fae5; color: #065f46; }
.cal-day.absent       { background: #fee2e2; color: #991b1b; }
.cal-day.sunday       { background: #f1f5f9; color: #94a3b8; }
.cal-day.holiday      { background: #ede9fe; color: #5b21b6; }
.cal-day.leave        { background: #fef3c7; color: #92400e; }
.cal-day.today        { border: 2px solid var(--ess-primary) !important; }
.cal-day.future       { color: #cbd5e1; }

/* ── Leave Status ─────────────────────────────────────── */
.leave-balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.leave-bal-card {
    background: #f8fafc;
    border: 1px solid var(--ess-border);
    border-radius: 9px;
    padding: 14px;
    text-align: center;
}
.leave-bal-card .lbl  { font-size: 0.72rem; color: var(--ess-muted); font-weight: 600; text-transform: uppercase; margin-bottom: 6px; }
.leave-bal-card .avail { font-size: 1.6rem; font-weight: 800; color: var(--ess-primary); }
.leave-bal-card .total { font-size: 0.7rem; color: var(--ess-muted); }

/* ── Documents ──────────────────────────────────────── */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}
.doc-card {
    border: 1px solid var(--ess-border);
    border-radius: 9px;
    padding: 16px;
    text-align: center;
    background: #fff;
    transition: box-shadow 0.18s;
}
.doc-card:hover { box-shadow: var(--shadow-md); }
.doc-card .doc-icon { font-size: 2rem; margin-bottom: 8px; }
.doc-card .doc-icon.pdf  { color: #ef4444; }
.doc-card .doc-icon.img  { color: #2563eb; }
.doc-card .doc-icon.file { color: #64748b; }
.doc-card .doc-name { font-weight: 600; font-size: 0.82rem; margin-bottom: 4px; word-break: break-word; }
.doc-card .doc-meta { font-size: 0.7rem; color: var(--ess-muted); }
.doc-card .doc-actions { margin-top: 10px; display: flex; gap: 6px; justify-content: center; }

/* ── Salary Slip Print ───────────────────────────────── */
@media print {
    .ess-sidebar, .ess-topbar, .ess-content .no-print { display: none !important; }
    .ess-main { margin-left: 0 !important; }
    .ess-content { padding: 0 !important; }
}

/* ── Spinner ─────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 3px solid rgba(37,99,235,0.2);
    border-top-color: var(--ess-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utilities ──────────────────────────────────────── */
.text-muted   { color: var(--ess-muted); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-small   { font-size: 0.78rem; }
.fw-bold      { font-weight: 700; }
.gap-8        { gap: 8px; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.flex-wrap    { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.w-100        { width: 100%; }
.mt-8  { margin-top: 8px; }
.mb-12 { margin-bottom: 12px; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 900px) {
    .ess-sidebar { transform: translateX(-100%); }
    .ess-sidebar.open { transform: translateX(0); }
    .ess-main { margin-left: 0; }
    .ess-hamburger { display: block; }
    .ess-grid-2, .ess-grid-3 { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .ess-stats-grid { grid-template-columns: repeat(2,1fr); }
    .ess-content { padding: 16px; }
    .att-calendar { gap: 4px; }
}
@media (max-width: 480px) {
    .ess-stats-grid { grid-template-columns: 1fr 1fr; }
    .leave-balance-grid { grid-template-columns: 1fr 1fr; }
}
