/* =========================================================
   PANGKALAN UTAMA: TEMA KORPORAT PREMIUM (V2 HIJRAH)
========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
    --primary-blue: #0ea5e9;     /* Biru Elektrik (Aksen V2) */
    --primary-light: #38bdf8;
    --sidebar-bg: #0b1121;       /* Dark Navy Premium */
    --sidebar-text: #94a3b8;
    --sidebar-hover: #1e293b;
    --bg-body: #f8fafc;          /* Latar Dashboard (Lebih cerah/bersih) */
    --bg-surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-width: 260px;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

.app-container { display: flex; height: 100vh; overflow: hidden; }

/* Rangka Utama */
#sidebar-container {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    z-index: 999; background-color: var(--sidebar-bg);
    box-shadow: 4px 0 24px rgba(0,0,0,0.05);
}

.main-content {
    position: absolute; top: 0; left: var(--sidebar-width); right: 0;
    min-height: 100vh; padding: 32px 40px;
    background-color: var(--bg-body); overflow-y: auto; box-sizing: border-box;
}

/* =========================================================
   2. TEMA GELAP SIDEBAR (DARK NAVY) & MENU PREMIUM
========================================================= */
.sidebar {
    width: 100%; height: 100%; background-color: var(--sidebar-bg);
    display: flex; flex-direction: column; color: var(--sidebar-text);
}

.sidebar-header {
    padding: 2rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-header h2 { margin: 0; font-size: 1.15rem; font-weight: 800; color: #ffffff; letter-spacing: 0.5px; }

.sidebar-nav { flex: 1; padding: 1.5rem 1rem 2rem 1rem; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.nav-section-title {
    font-size: 0.65rem; font-weight: 700; color: #475569;
    text-transform: uppercase; letter-spacing: 0.15em;
    margin: 1.5rem 0.5rem 0.8rem 0.5rem;
}

.nav-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 16px; margin-bottom: 6px;
    color: var(--sidebar-text); text-decoration: none;
    border-radius: 10px; transition: all 0.25s ease;
    border: 1px solid transparent;
}

.nav-item:hover { 
    background-color: rgba(255,255,255,0.03); 
    color: #e2e8f0; 
}

/* GAYA AKTIF (GLOW V2) */
.nav-item.active {
    background: linear-gradient(90deg, #1d4ed8 0%, #0ea5e9 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px -3px rgba(14, 165, 233, 0.4);
    border: 1px solid rgba(255,255,255,0.1);
}

/* Susunan Teks & Subtitle Menu */
.nav-item-text { display: flex; flex-direction: column; }
.nav-item-title { font-size: 0.85rem; font-weight: 600; }
.nav-item-subtitle { font-size: 0.65rem; font-weight: 400; color: #64748b; margin-top: 2px; }
.nav-item:hover .nav-item-subtitle { color: #94a3b8; }
.nav-item.active .nav-item-subtitle { color: rgba(255,255,255,0.8); }

.sidebar-profile { display: none; /* Dipindahkan ke Top Header dalam V2 */ }
.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,0.05); }
.btn-logout {
    width: 100%; padding: 12px; background: transparent;
    border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
    color: var(--sidebar-text); cursor: pointer; font-size: 0.8rem; font-weight: 600;
    transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-logout:hover { border-color: rgba(255,255,255,0.3); color: white; background: rgba(255,255,255,0.05); }

/* =========================================================
   3. KOTAK KAD (GLACIER) & BUTANG
========================================================= */
.glacier-card, .chart-card, .card {
    background: var(--bg-surface); border-radius: 12px; padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.02);
    border: 1px solid #f1f5f9; margin-bottom: 24px; width: 100%; box-sizing: border-box;
}

.btn-primary, .btn-add-row {
    background-color: var(--primary-blue) !important; color: white !important;
    border: none !important; border-radius: 8px !important;
    padding: 10px 20px !important; font-size: 0.85rem !important; font-weight: 600 !important;
    cursor: pointer; box-shadow: 0 4px 6px -1px rgba(29, 78, 216, 0.2); transition: 0.2s;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.btn-primary:hover, .btn-add-row:hover { background-color: #1e40af !important; }

/* =========================================================
   4. JADUAL (TABLES) KORPORAT
========================================================= */
.table-container { width: 100%; overflow-x: auto; }
.team-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.team-table th { 
    font-size: 0.75rem; font-weight: 700; color: #64748b; 
    text-transform: uppercase; padding: 16px; border-bottom: 1px solid #e2e8f0; 
    background: #f8fafc; text-align: left; letter-spacing: 0.5px;
}
.team-table td { padding: 16px; border-bottom: 1px solid #f1f5f9; font-size: 0.85rem; vertical-align: middle; }
.team-table tr:hover { background: #f8fafc; }

/* Himpit Nama Pekerja & Susunan Avatar Kiri */
.team-table th:nth-child(2), .team-table td:nth-child(2) { text-align: left !important; padding-left: 20px !important; }
.member-info { display: flex !important; align-items: center !important; justify-content: flex-start !important; gap: 15px !important; }
.member-info > div:not(.avatar) { text-align: left !important; }
.m-name { font-weight: 700; color: var(--text-main); text-transform: capitalize; }
.m-email, .m-meta { color: #64748b; font-size: 0.75rem; margin-top: 2px; }
.avatar { 
    width: 36px; height: 36px; border-radius: 50%; 
    background: #eff6ff; color: var(--primary-light); 
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; 
}

/* Badges Status */
.status-badge { 
    padding: 6px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; 
    text-transform: capitalize; display: inline-flex; align-items: center; gap: 6px; 
}
.status-active { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.status-active::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #22c55e; }
.status-inactive, .status-idle { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.status-inactive::before, .status-idle::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #f59e0b; }
.action-btn { background: none; border: none; cursor: pointer; color: #94a3b8; font-size: 1.2rem; padding: 4px 8px; border-radius: 4px; }
.action-btn:hover { background: #e2e8f0; color: var(--text-main); }

/* =========================================================
   5. DASHBOARD & KPI (GRAFIK & STATISTIK)
========================================================= */
.kpi-section, .kpi-grid { 
    display: flex; gap: 24px; margin-bottom: 24px; background: white; padding: 20px 24px; 
    border-radius: 12px; border: 1px solid #f1f5f9; box-shadow: 0 1px 3px rgba(0,0,0,0.05); flex-wrap: wrap; 
}
.kpi-item { flex: 1; border-right: 1px solid #e2e8f0; min-width: 150px; }
.kpi-item:last-child { border-right: none; }
.kpi-label { font-size: 0.75rem; font-weight: 700; color: #64748b; text-transform: uppercase; margin-bottom: 8px; letter-spacing: 0.5px; }
.kpi-value { font-size: 1.8rem; font-weight: 800; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chart-header { font-size: 0.85rem; font-weight: 700; color: var(--text-main); text-transform: uppercase; margin-bottom: 16px; margin-top: 0; letter-spacing: 0.5px; }
.main-chart-container { height: 350px; width: 100%; position: relative; }
.distribution-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; margin-bottom: 24px; }
.donut-container { height: 250px; position: relative; display: flex; justify-content: center; align-items: center; }
.donut-center-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.donut-center-val { font-size: 1.2rem; font-weight: 800; color: var(--text-main); }
.donut-center-lbl { font-size: 0.7rem; color: #64748b; text-transform: uppercase; font-weight: 700; }

.ranking-list { max-height: 250px; overflow-y: auto; padding-right: 10px; }
.ranking-item { display: flex; align-items: center; justify-content: space-between; font-size: 0.85rem; padding: 12px 0; border-bottom: 1px dashed #e2e8f0; }
.ranking-item:last-child { border-bottom: none; }
.r-name { flex: 2; color: var(--text-main); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.r-dur { flex: 1; text-align: right; color: #64748b; font-family: monospace; font-size: 0.9rem; font-weight: 600;}
.r-perc { width: 60px; text-align: right; color: #94a3b8; font-size: 0.8rem; font-weight: 600;}
.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

.act-title { font-weight: 600; color: var(--text-main); margin-bottom: 4px; }
.act-proj { color: #64748b; font-size: 0.8rem; }
.prog-bar-bg { width: 100%; max-width: 200px; height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden; margin-top: 6px; display: flex; }
.prog-bar-segment { height: 100%; }

/* =========================================================
   6. PAGINATION & SORTING (INTERAKTIF)
========================================================= */
.sortable-header { cursor: pointer; transition: background-color 0.2s ease; user-select: none; padding: 16px !important; }
.sortable-header:hover { background-color: #f1f5f9 !important; }
.sort-content { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; font-weight: 700; color: #64748b; text-transform: uppercase; }
.sort-icon { font-size: 1rem; color: #cbd5e1; transition: color 0.2s; }
.sortable-header:hover .sort-icon { color: var(--primary-light); }
.sortable-header.asc .sort-icon { color: var(--primary-light); content: "↑"; }
.sortable-header.desc .sort-icon { color: var(--primary-light); content: "↓"; }

.glacier-pagination { 
    display: flex; justify-content: flex-start; align-items: center; gap: 24px; padding-top: 20px; 
    margin-top: 10px; border-top: 1px solid #e2e8f0; flex-wrap: wrap; font-size: 0.85rem; color: #475569; font-weight: 500;
}
.pagination-select { 
    padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 6px; outline: none; background: white; 
    font-family: inherit; font-size: 0.85rem; color: var(--text-main); font-weight: 600; cursor: pointer; 
}
.page-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-buttons { display: flex; align-items: center; gap: 4px; }
.page-btn { 
    background: white; border: 1px solid #cbd5e1; color: #475569; padding: 6px 12px; border-radius: 6px; 
    cursor: pointer; font-size: 1rem; font-weight: 600; display: flex; align-items: center; justify-content: center; 
    min-width: 36px; transition: all 0.2s ease; 
}
.page-btn:hover { background: #eff6ff; border-color: var(--primary-light); color: var(--primary-blue); }
.page-btn:disabled { background: #f1f5f9; border-color: #e2e8f0; color: #94a3b8; cursor: not-allowed; }
.page-input { 
    width: 50px; padding: 6px; text-align: center; border: 1px solid #cbd5e1; border-radius: 6px; 
    font-family: inherit; font-size: 0.85rem; font-weight: 600; outline: none; -moz-appearance: textfield; 
}
.page-input::-webkit-outer-spin-button, .page-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.page-input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1); }
.total-records-text { margin-left: 8px; color: #64748b; }

/* =========================================================
   7. MODALS (Tetingkap Pop-Up / Slide-In)
========================================================= */
.modal-overlay { 
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(15, 23, 42, 0.6); z-index: 1000; justify-content: center; align-items: center; backdrop-filter: blur(2px); 
}
.modal-content { 
    background: white; width: 100%; max-width: 500px; max-height: 90vh; padding: 32px; 
    border-radius: 12px; box-sizing: border-box; overflow-y: auto; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); 
    animation: popIn 0.3s forwards; 
}
@keyframes popIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; border-bottom: 1px solid #e2e8f0; padding-bottom: 16px; }
.modal-title { font-size: 1.25rem; font-weight: 800; color: var(--text-main); margin: 0; }
.close-btn { background: none; border: none; font-size: 1.5rem; color: #94a3b8; cursor: pointer; transition: color 0.2s; }
.close-btn:hover { color: #ef4444; }

.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 700; color: #475569; margin-bottom: 8px; }
.form-input, .form-select, .form-textarea { 
    width: 100%; padding: 10px 14px; border: 1px solid #cbd5e1; border-radius: 8px; 
    font-size: 0.9rem; font-family: inherit; box-sizing: border-box; outline: none; transition: border-color 0.2s; 
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.form-row { display: flex; gap: 16px; margin-bottom: 20px;}
.form-row .form-group { flex: 1; margin-bottom: 0;}

.btn-save { 
    width: 100%; background: #10b981; color: white; border: none; padding: 12px; 
    border-radius: 8px; font-size: 0.9rem; font-weight: 700; cursor: pointer; margin-top: 10px; transition: 0.2s;
}
.btn-save:hover { background: #059669; }

/* =========================================================
   8. EXTRA: TIME TRACKER COMPONENT
========================================================= */
.tracker-bar {
    display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1.5rem; background: white;
    border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    margin-bottom: 2rem; flex-wrap: wrap;
}
.tracker-selects { display: flex; flex: 1; gap: 1rem; min-width: 300px; }
.tracker-selects select {
    flex: 1; padding: 0.6rem; border: 1px solid var(--border-color); border-radius: 6px;
    font-family: inherit; font-size: 0.85rem; color: var(--text-main); background-color: #f8fafc; outline: none; transition: border 0.2s;
}
.tracker-selects select:focus { border-color: var(--primary-light); background-color: white; }
.timer-display { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-main); min-width: 120px; text-align: center; letter-spacing: -0.02em; }
.btn-start {
    background-color: var(--primary-blue); color: white; border: none; border-radius: 8px;
    padding: 10px 30px; font-size: 0.9rem; font-weight: 700; cursor: pointer; transition: background-color 0.2s;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.btn-start:hover { background-color: #1e40af; }
.btn-start.stop-mode { background-color: #ef4444; }
.btn-start.stop-mode:hover { background-color: #dc2626; }
.btn-chase { background: #fee2e2; color: #ef4444; border: 1px solid #fca5a5; padding: 6px 12px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; cursor: pointer; transition: 0.2s; }
.btn-chase:hover { background: #fecaca; }


/* =========================================================
   9. FUNGSI HIDE/COLLAPSE SIDEBAR (MATA)
========================================================= */
/* Animasi lembut apabila sidebar dilipat */
#sidebar-container, .main-content {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Apabila kelas .sidebar-collapsed aktif di body */
body.sidebar-collapsed #sidebar-container { width: 80px; }
body.sidebar-collapsed .main-content { left: 80px; }

/* Sembunyikan elemen teks */
body.sidebar-collapsed .hide-on-collapse {
    display: none !important;
}

/* Betulkan susunan logo, avatar & butang apabila tiada teks */
body.sidebar-collapsed .sidebar-header {
    padding: 1.5rem 0;
    justify-content: center;
    flex-direction: column;
    gap: 15px;
}
body.sidebar-collapsed .sidebar-profile { justify-content: center; padding: 1.5rem 0; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 12px 0; }
body.sidebar-collapsed .btn-logout { justify-content: center; }

/* Kawalan Ikon Mata Terbuka & Tertutup */
.eye-closed { display: none; }
body.sidebar-collapsed .eye-open { display: none; }
body.sidebar-collapsed .eye-closed { display: block; }


/* =========================================================
   11. STATUS BADGES & ICONS (KLON V2)
========================================================= */
.badge-status { 
    padding: 6px 12px; border-radius: 6px; font-size: 0.75rem; 
    font-weight: 600; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; 
}
.badge-inprogress { background: #ecfdf5; color: #10b981; }
.badge-inprogress::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #10b981; }
.badge-inaday { background: #fff7ed; color: #f59e0b; }
.badge-inaday::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; }
.badge-hoursago { background: #f1f5f9; color: #64748b; }
.badge-hoursago::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #64748b; }
.badge-noactivity { background: #fef2f2; color: #ef4444; }
.badge-noactivity::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; }

.proj-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.timer-active-dot { 
    display: inline-block; width: 6px; height: 6px; border-radius: 50%; 
    background: #ef4444; margin-left: 8px; vertical-align: middle;
}


/* =========================================================
   12. TIMESHEET UI KHUSUS (KLON V2)
========================================================= */
.timesheet-table th { background: #ffffff !important; border-bottom: 1px solid #f1f5f9 !important; color: #64748b; }
.timesheet-table td { padding: 12px 10px !important; vertical-align: middle; }
.ts-date { font-weight: 500; font-size: 0.65rem; color: #94a3b8; display: block; margin-top: 4px; }

/* Kotak Jam */
.ts-input-time {
    width: 100%; text-align: center; padding: 10px 4px; border: 1px solid #e2e8f0;
    border-radius: 6px; font-size: 0.85rem; font-weight: 600; color: #0f172a;
    outline: none; transition: border 0.2s; background: white;
}
.ts-input-time:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1); }
.ts-input-time.zero { color: #94a3b8; font-weight: 500; } /* Kelabu bila kosong */

/* Dropdown & Remark */
.ts-select, .ts-input-remark {
    width: 100%; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 6px;
    font-size: 0.85rem; color: #475569; outline: none; background: white;
}
.ts-select:focus, .ts-input-remark:focus { border-color: #3b82f6; }

/* Butang Toggle "Show Weekends" */
.toggle-switch {
    width: 36px; height: 20px; background: #cbd5e1; border-radius: 20px;
    position: relative; cursor: pointer; transition: background 0.2s;
}
.toggle-switch.active { background: #3b82f6; }
.toggle-switch::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px; background: white; border-radius: 50%; transition: transform 0.2s;
}
.toggle-switch.active::after { transform: translateX(16px);}

/* Custom Dropdown Copy Last Week */
.copy-dropdown-item {
    padding: 8px 12px; 
    font-size: 0.8rem; 
    font-weight: 500; 
    color: #475569; 
    cursor: pointer; 
    border-bottom: 1px solid #f1f5f9; 
    transition: all 0.2s;
}
.copy-dropdown-item:last-child { border-bottom: none; }
.copy-dropdown-item:hover { background-color: #f8fafc; color: #3b82f6; }

/* Dropdown Menu 3 Titik */
.action-dropdown {
    position: relative;
    display: inline-block;
}

.action-menu-popup {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    width: 200px;
    z-index: 9999;
    overflow: hidden;
    text-align: left;
}

.action-menu-popup.show {
    display: block;
    animation: fadeIn 0.15s ease-in-out;
}

.action-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.825rem;
    color: #334155;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
}

.action-menu-item:hover {
    background-color: #f8fafc;
    color: #1d4ed8;
}

.action-menu-item.danger:hover {
    background-color: #fef2f2;
    color: #ef4444;
}



