/* static/css/base.css — Refonte Premium HSI Admin */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
    /* Brand Colors */
    --color-primary:        #2563EB;
    --color-primary-hover:  #1D4ED8;
    --color-primary-light:  #EFF6FF;
    --color-primary-muted:  rgba(37, 99, 235, 0.12);

    --color-success:        #059669;
    --color-success-light:  #ECFDF5;
    --color-success-muted:  rgba(5, 150, 105, 0.12);

    --color-warning:        #D97706;
    --color-warning-light:  #FFFBEB;
    --color-warning-muted:  rgba(217, 119, 6, 0.12);

    --color-danger:         #DC2626;
    --color-danger-light:   #FEF2F2;
    --color-danger-muted:   rgba(220, 38, 38, 0.12);

    --color-info:           #0891B2;
    --color-info-light:     #ECFEFF;
    --color-info-muted:     rgba(8, 145, 178, 0.12);

    --color-purple:         #7C3AED;
    --color-purple-light:   #F5F3FF;
    --color-purple-muted:   rgba(124, 58, 237, 0.12);

    /* Surfaces */
    --bg-body:              #F1F5F9;
    --bg-surface:           #FFFFFF;
    --bg-surface-alt:       #F8FAFC;
    --border-color:         #E2E8F0;
    --border-light:         #F1F5F9;

    /* Typography */
    --text-heading:         #0F172A;
    --text-main:            #1E293B;
    --text-muted:           #64748B;
    --text-faint:           #94A3B8;

    /* Sidebar */
    --sidebar-bg:           #0D1117;
    --sidebar-border:       rgba(255, 255, 255, 0.06);
    --sidebar-text:         #8B949E;
    --sidebar-text-hover:   #E6EDF3;
    --sidebar-hover-bg:     rgba(255, 255, 255, 0.06);
    --sidebar-active-bg:    rgba(37, 99, 235, 0.16);
    --sidebar-active-text:  #58A6FF;
    --sidebar-width:        272px;

    /* Gradients */
    --grad-primary:   linear-gradient(135deg, #1D4ED8 0%, #3B82F6 100%);
    --grad-success:   linear-gradient(135deg, #047857 0%, #10B981 100%);
    --grad-warning:   linear-gradient(135deg, #B45309 0%, #F59E0B 100%);
    --grad-danger:    linear-gradient(135deg, #B91C1C 0%, #F87171 100%);
    --grad-info:      linear-gradient(135deg, #0E7490 0%, #22D3EE 100%);
    --grad-purple:    linear-gradient(135deg, #5B21B6 0%, #A78BFA 100%);

    /* Shadows */
    --shadow-xs:   0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
    --shadow-lg:   0 10px 40px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    --shadow-card: 0 2px 12px rgba(15, 23, 42, 0.04);

    /* Radii */
    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   20px;
    --radius-2xl:  24px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

* { font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif; }

body {
    background: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.4); opacity: 0.7; }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    z-index: 1000;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--sidebar-border);
}

/* Header */
.sidebar-header {
    padding: 24px 20px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.logo-wrapper {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #FFFFFF 0%, #EFF6FF 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    flex-shrink: 0;
}

.logo-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.sidebar-header-text h5 {
    color: #E6EDF3;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.3px;
    margin-bottom: 2px;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-user-info small {
    color: var(--sidebar-text);
    font-size: 0.73rem;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.role-badge {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.role-badge.admin    { background: rgba(37, 99, 235, 0.2);  color: #60A5FA; }
.role-badge.rh       { background: rgba(5, 150, 105, 0.2);  color: #34D399; }
.role-badge.supervisor { background: rgba(217, 119, 6, 0.2); color: #FBB F24; }
.role-badge.default  { background: rgba(100, 116, 139, 0.2); color: #94A3B8; }

/* Nav Group Labels */
.nav-group-label {
    padding: 14px 16px 6px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(139, 148, 158, 0.55);
    user-select: none;
}

/* Nav items */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px;
    scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 2px;
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: 0.88rem;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.sidebar .nav-link:hover {
    color: var(--sidebar-text-hover);
    background: var(--sidebar-hover-bg);
}

.sidebar .nav-link.active {
    color: var(--sidebar-active-text);
    background: var(--sidebar-active-bg);
    font-weight: 600;
}

.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    bottom: 25%;
    width: 3px;
    background: var(--color-primary);
    border-radius: 0 3px 3px 0;
    margin-left: -12px;
}

.sidebar .nav-link i {
    width: 18px;
    text-align: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.sidebar .nav-link:hover i {
    transform: scale(1.1);
}

/* Submenu */
.nav-submenu {
    margin: 0 0 4px 28px;
    padding-left: 14px;
    border-left: 1px solid rgba(139, 148, 158, 0.2);
}

.nav-submenu .nav-link {
    padding: 7px 12px;
    font-size: 0.83rem;
    color: rgba(139, 148, 158, 0.8);
}

.nav-submenu .nav-link.active {
    color: var(--sidebar-active-text);
    background: var(--sidebar-active-bg);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 12px 16px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-footer .nav-link {
    color: #6E7681;
    font-size: 0.87rem;
}

.sidebar-footer .nav-link:hover {
    color: #F87171;
    background: rgba(239, 68, 68, 0.1);
}

/* Status dot */
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-success);
    animation: pulse-dot 2s infinite;
    flex-shrink: 0;
}

/* ============================================================
   MOBILE TOGGLE
   ============================================================ */
.menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1100;
    background: var(--sidebar-bg);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 13px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 64px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 900;
    gap: 16px;
}

.topbar-search {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.topbar-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    font-size: 0.85rem;
    pointer-events: none;
}

.topbar-search input {
    width: 100%;
    padding: 9px 16px 9px 38px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-body);
    font-size: 0.88rem;
    color: var(--text-main);
    transition: all 0.2s;
    outline: none;
}

.topbar-search input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-muted);
    background: #FFF;
}

.topbar-search .search-shortcut {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--text-faint);
    background: var(--border-color);
    padding: 2px 6px;
    border-radius: 5px;
    font-weight: 600;
    pointer-events: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-clock {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
}

.topbar-clock i {
    color: var(--color-primary);
    font-size: 0.8rem;
}

.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    flex-shrink: 0;
}

.btn-icon:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 6px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-surface);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.topbar-user:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.topbar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--grad-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.topbar-user-info strong {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.2;
}

.topbar-user-info small {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================================
   PAGE CONTENT & HEADER
   ============================================================ */
.page-content {
    padding: 28px 32px;
    flex: 1;
    animation: fadeInUp 0.35s ease-out;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.page-header h1 {
    font-weight: 800;
    color: var(--text-heading);
    font-size: 1.75rem;
    letter-spacing: -0.6px;
    line-height: 1.2;
}

.page-header .page-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 400;
}

/* ============================================================
   CARDS
   ============================================================ */
.card-premium {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card-premium .card-header-premium {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
}

.card-premium .card-header-premium h5 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0;
}

/* Stats Cards */
.stats-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: 22px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    transition: all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    cursor: pointer;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stats-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--grad-primary);
    opacity: 0;
    transition: opacity 0.25s;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.stats-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(37, 99, 235, 0.2);
}

.stats-card:hover::after { opacity: 1; }

.stats-card.danger::after   { background: var(--grad-danger); }
.stats-card.success::after  { background: var(--grad-success); }
.stats-card.warning::after  { background: var(--grad-warning); }
.stats-card.info::after     { background: var(--grad-info); }
.stats-card.purple::after   { background: var(--grad-purple); }

.stats-card h6 {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stats-card h2, .stats-card .stats-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-heading);
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 8px;
}

/* Icon containers */
.stats-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.25s;
    flex-shrink: 0;
}

.stats-card:hover .stats-icon {
    transform: scale(1.08) rotate(4deg);
}

.icon-primary  { background: var(--color-primary-muted);  color: var(--color-primary); }
.icon-success  { background: var(--color-success-muted);  color: var(--color-success); }
.icon-warning  { background: var(--color-warning-muted);  color: var(--color-warning); }
.icon-danger   { background: var(--color-danger-muted);   color: var(--color-danger); }
.icon-info     { background: var(--color-info-muted);     color: var(--color-info); }
.icon-purple   { background: var(--color-purple-muted);   color: var(--color-purple); }

/* ============================================================
   TABLE
   ============================================================ */
.table-container {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.table-container-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-container-header h5 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0;
}

.table-premium { width: 100%; border-collapse: collapse; }

.table-premium th {
    padding: 12px 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    background: var(--bg-surface-alt);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table-premium td {
    padding: 14px 20px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table-premium tr:last-child td { border-bottom: none; }

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

.table-premium tbody tr:hover {
    background: var(--bg-surface-alt);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 9px 18px;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    line-height: 1.4;
    text-decoration: none;
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

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

.btn-outline-primary:hover {
    background: var(--color-primary-light);
    color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.btn-ghost {
    color: var(--text-muted);
    background: transparent;
    border-color: var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-surface-alt);
    color: var(--text-main);
    border-color: var(--border-color);
}

.btn-sm { padding: 6px 13px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--text-main);
    background: var(--bg-body);
    transition: all 0.2s;
    outline: none;
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-muted);
    background: #FFF;
}

.form-label {
    font-weight: 600;
    font-size: 0.87rem;
    color: var(--text-main);
    margin-bottom: 6px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.73rem;
    letter-spacing: 0.2px;
}

.badge-primary { background: var(--color-primary-muted); color: var(--color-primary); }
.badge-success { background: var(--color-success-muted); color: var(--color-success); }
.badge-warning { background: var(--color-warning-muted); color: var(--color-warning); }
.badge-danger  { background: var(--color-danger-muted);  color: var(--color-danger); }
.badge-info    { background: var(--color-info-muted);    color: var(--color-info); }
.badge-gray    { background: rgba(100,116,139,0.12);      color: var(--text-muted); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-content {
    border: none;
    border-radius: var(--radius-2xl);
    box-shadow: 0 25px 60px rgba(0,0,0,0.15);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 22px 26px 18px;
}

.modal-body { padding: 24px 26px; }

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 26px;
    background: var(--bg-surface-alt);
    border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
}

/* ============================================================
   ALERTS / MESSAGES
   ============================================================ */
.alert {
    border-radius: var(--radius-lg);
    border: none;
    padding: 14px 18px;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 4px solid;
}

.alert-success { background: var(--color-success-light); border-color: var(--color-success); color: #065F46; }
.alert-danger  { background: var(--color-danger-light);  border-color: var(--color-danger);  color: #991B1B; }
.alert-warning { background: var(--color-warning-light); border-color: var(--color-warning); color: #92400E; }
.alert-info    { background: var(--color-info-light);    border-color: var(--color-info);    color: #164E63; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.3); }
    .main-content { margin-left: 0; }
    .topbar { padding-left: 68px; padding-right: 20px; }
    .menu-toggle { display: flex; }
    .page-content { padding: 20px; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }