/* ==========================================================================
   HRM System - Application Styles (Light theme)
   ========================================================================== */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #4f46e5;
    --sidebar-text: #cbd5e1;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --info: #0ea5e9;
    --sidebar-width: 260px;
    --navbar-height: 64px;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 4px 12px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    background: var(--body-bg);
    color: var(--text-dark);
    font-size: 14px;
}
a { text-decoration: none; }

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

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
}
.sidebar-brand {
    height: var(--navbar-height);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-link { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 16px; overflow: hidden; }
.brand-icon { font-size: 24px; color: #818cf8; }
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-close { color: #fff; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav .nav-section {
    text-transform: uppercase; font-size: 11px; letter-spacing: .06em;
    color: #64748b; padding: 16px 20px 6px; font-weight: 600;
}
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 12px;
    color: var(--sidebar-text);
    padding: 11px 20px; font-weight: 500; border-left: 3px solid transparent;
    transition: all .15s;
}
.sidebar-nav .nav-link i { font-size: 18px; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active {
    background: rgba(79,70,229,.15); color: #fff; border-left-color: var(--sidebar-active);
}
.sidebar-footer { padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.08); color: #64748b; }

.sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035;
}

.app-main {
    flex: 1; margin-left: var(--sidebar-width);
    display: flex; flex-direction: column; min-width: 0;
    transition: margin .25s ease;
}

/* ---------------- Navbar ---------------- */
.app-navbar {
    height: var(--navbar-height);
    background: #fff; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
    padding: 0 24px; position: sticky; top: 0; z-index: 1030;
}
.navbar-toggle { font-size: 22px; color: var(--text-dark); display: none; padding: 4px 8px; }
.global-search { flex: 1; max-width: 460px; }
.global-search .form-control:focus { box-shadow: none; }
.global-search .input-group-text, .global-search .form-control { background: #f8fafc; border-color: var(--border); }
.navbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.nav-icon { color: var(--text-muted); font-size: 20px; padding: 6px; border-radius: 8px; }
.nav-icon:hover { background: var(--primary-light); color: var(--primary); }

.user-menu { display: flex; align-items: center; gap: 10px; border: none; background: transparent; }
.user-menu::after { display: none; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--primary); color: #fff; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.user-info { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.user-name { font-weight: 600; font-size: 13px; color: var(--text-dark); }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ---------------- Content ---------------- */
.app-content { padding: 24px; flex: 1; }
.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.page-header h1 { font-size: 22px; font-weight: 700; margin: 0; }
.page-header .subtitle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.breadcrumb { background: transparent; margin: 0; padding: 0; font-size: 13px; }
.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-dark); }

/* ---------------- Cards ---------------- */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { background: #fff; border-bottom: 1px solid var(--border); font-weight: 600; padding: 16px 20px; }
.card-body { padding: 20px; }

.stat-card {
    background: var(--card-bg); border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px; height: 100%;
}
.stat-icon {
    width: 54px; height: 54px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
}
.stat-info .stat-value { font-size: 24px; font-weight: 700; line-height: 1; }
.stat-info .stat-label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.bg-soft-primary { background: #eef2ff; color: #4f46e5; }
.bg-soft-success { background: #dcfce7; color: #16a34a; }
.bg-soft-danger  { background: #fee2e2; color: #dc2626; }
.bg-soft-warning { background: #fef3c7; color: #d97706; }
.bg-soft-info    { background: #e0f2fe; color: #0284c7; }
.bg-soft-secondary { background: #f1f5f9; color: #475569; }

/* ---------------- Tables ---------------- */
.table { margin: 0; }
.table > :not(caption) > * > * { padding: 12px 14px; vertical-align: middle; }
.table thead th { background: #f8fafc; color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--border); }
.table-hover tbody tr:hover { background: #f8fafc; }
.table-responsive { border-radius: var(--radius); }

.emp-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--primary-light); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }

/* ---------------- Badges / buttons ---------------- */
.badge { font-weight: 600; padding: .4em .7em; border-radius: 6px; }
.btn { border-radius: 8px; font-weight: 500; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-icon { display: inline-flex; align-items: center; gap: 6px; }
.btn-sm { border-radius: 6px; }

/* ---------------- Forms ---------------- */
.form-label { font-weight: 600; font-size: 13px; margin-bottom: 6px; color: #334155; }
.form-control, .form-select { border-radius: 8px; border-color: var(--border); padding: .55rem .75rem; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.required::after { content: " *"; color: var(--danger); }

/* ---------------- Footer ---------------- */
.app-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: #fff; color: var(--text-muted); font-size: 13px; display: flex; justify-content: space-between; }

/* ---------------- Auth ---------------- */
.auth-body { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); min-height: 100vh; display: flex; align-items: center; }
.auth-wrapper { width: 100%; max-width: 420px; margin: 0 auto; padding: 20px; }
.auth-card { background: #fff; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.25); padding: 36px 32px; }
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-brand i { font-size: 44px; color: var(--primary); }
.auth-brand h1 { font-size: 20px; font-weight: 700; margin: 10px 0 2px; }
.auth-brand p { color: var(--text-muted); font-size: 13px; margin: 0; }
.auth-footer { text-align: center; color: rgba(255,255,255,.8); font-size: 12px; margin-top: 18px; }
.auth-demo { background: var(--primary-light); border-radius: 8px; padding: 10px 14px; font-size: 12px; color: #4338ca; margin-top: 16px; }

/* ---------------- Toasts / loader ---------------- */
.page-loader { position: fixed; inset: 0; background: rgba(255,255,255,.6); display: none; align-items: center; justify-content: center; z-index: 2000; }
.page-loader.show { display: flex; }
.spinner { width: 44px; height: 44px; border: 4px solid var(--primary-light); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Salary slip (print) ---------------- */
.slip { max-width: 800px; margin: 0 auto; background: #fff; }
@media print {
    .app-sidebar, .app-navbar, .app-footer, .no-print, .sidebar-backdrop { display: none !important; }
    .app-main { margin: 0 !important; }
    .app-content { padding: 0 !important; }
    body { background: #fff; }
    .card { box-shadow: none !important; border: none !important; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.show { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .navbar-toggle { display: inline-block; }
    .sidebar-backdrop.show { display: block; }
}
@media (max-width: 575.98px) {
    .app-content { padding: 16px; }
    .global-search { max-width: none; }
    .app-navbar { padding: 0 14px; gap: 10px; }
}

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; opacity: .4; }
