@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Reset & Base */
:root {
    --primary: #4F46E5; /* Indigo 600 */
    --primary-hover: #4338CA; /* Indigo 700 */
    --secondary: #64748B; /* Slate 500 */
    --bg-body: #E0E7FF; /* Indigo 50 (Lebih sejuk) */
    --bg-sidebar: #1E1B4B; /* Indigo 950 (Gelap) */
    --bg-card: #FFFFFF;
    --text-main: #1E293B; /* Slate 800 */
    --text-sidebar: #E0E7FF; /* Teks terang untuk sidebar gelap */
    --text-muted: #64748B; /* Slate 500 */
    --border: #E2E8F0; /* Slate 200 */
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--bg-body); 
    margin: 0; 
    color: var(--text-main); 
    display: flex;
    min-height: 100vh;
    line-height: 1.5;
}

/* Sidebar Layout */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    left: 0;
    top: 0;
    border-right: 1px solid #312E81; /* Indigo 900 */
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.main-content {
    margin-left: 260px;
    padding: 30px;
    width: calc(100% - 260px);
    box-sizing: border-box;
    min-height: 100vh;
    background: linear-gradient(180deg, #EFF6FF 0%, #F8FAFC 100%);
    position: relative;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
}

.page-header h2 {
    margin: 0 0 8px;
    font-size: 1.75rem;
}

.page-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.page-clock {
    min-width: 220px;
    max-width: 280px;
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid rgba(79, 70, 229, 0.15);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 18px 40px -28px rgba(15, 23, 42, 0.15);
    color: #1E293B;
    text-align: right;
}

.page-clock .clock-day {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #4F46E5;
    margin-bottom: 6px;
}

.page-clock .clock-date {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0F172A;
    margin-bottom: 6px;
}

.page-clock .clock-time {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #312E81;
}

/* Sidebar Elements */
.sidebar-header {
    background: rgba(0,0,0,0.2);
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: relative;
}

.user-info {
    padding: 20px 24px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.1);
}

.user-info p {
    margin: 0;
    font-size: 0.9rem;
    color: #E0E7FF;
}

.user-info .role { 
    font-size: 0.75rem; 
    color: #818CF8; /* Indigo 400 */
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    font-weight: 600;
    margin-top: 4px;
    display: inline-block;
    background: rgba(79, 70, 229, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    .nav-links.active { display: block; background: var(--bg-sidebar); }
}

.nav-links {
    list-style: none;
    padding: 18px 16px 24px;
    margin: 0;
}

.nav-links li {
    margin-bottom: 10px;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #CBD5E1; /* Slate 300 */
    text-decoration: none;
    transition: all 0.25s ease;
    font-weight: 500;
    border-radius: 12px;
    font-size: 0.95rem;
}

.nav-links li a:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.nav-links li a.active {
    background: rgba(79, 70, 229, 0.98);
    color: white;
    font-weight: 600;
    box-shadow: 0 12px 30px -18px rgba(79, 70, 229, 0.7);
}

.nav-links .nav-header {
    padding: 18px 16px 8px;
    font-size: 0.72rem;
    color: #A5B4FC; /* Indigo 300 */
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.logout-btn {
    background: #FEF2F2 !important;
    color: var(--danger) !important;
    text-align: center;
    margin: 20px 16px;
    border-radius: 12px !important;
    border: 1px solid #FECACA;
    padding: 12px !important;
    font-weight: 700;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--danger) !important;
    color: white !important;
    border-color: var(--danger);
}

/* Cards & Containers */
.container {
    max-width: 95%; /* Diperlebar dari 1200px atau default */
    margin: 0 auto;
    padding: 20px;
}

/* Responsiveness untuk layar besar */
@media (min-width: 1400px) {
    .container {
        max-width: 90%;
    }
}

.card { 
    background: var(--bg-card);
    padding: 24px; 
    border-radius: 18px; 
    border: 1px solid rgba(226, 232, 240, 0.75);
    box-shadow: 0 18px 40px -24px rgba(15, 23, 42, 0.2);
    margin-bottom: 28px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    border-color: rgba(79, 70, 229, 0.25);
    box-shadow: 0 18px 45px -20px rgba(15, 23, 42, 0.18);
}

/* Stats */
.stat-box { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.stat-item { 
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    text-align: left;
}
.stat-item div:first-child {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}
.stat-value { 
    font-size: 1.75rem; 
    font-weight: 700; 
    color: var(--text-main);
    margin-top: 8px;
}

/* Buttons */
.btn, button[type="submit"] {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary, button[type="submit"] { 
    background-color: var(--primary); 
    color: white; 
    box-shadow: 0 1px 2px 0 rgba(79, 70, 229, 0.4);
}
.btn-primary:hover, button[type="submit"]:hover { background-color: var(--primary-hover); transform: translateY(-1px); }

.btn-secondary { background-color: white; border-color: var(--border); color: var(--text-main); }
.btn-secondary:hover { background-color: #F8FAFC; border-color: #CBD5E1; }

.btn-success { background-color: var(--success); color: white; }
.btn-danger { background-color: var(--danger); color: white; }
.btn-warning { background-color: var(--warning); color: white; }
.btn-info { background-color: var(--info); color: white; }

.btn-sm { padding: 5px 10px; font-size: 0.78rem; border-radius: 6px; }

/* Forms */
input, select, textarea { 
    width: 100%; 
    padding: 12px 14px; 
    margin: 8px 0 18px; 
    border: 1px solid var(--border); 
    border-radius: 14px; 
    font-size: 0.95rem; 
    background-color: #F8FAFC;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
}
input:focus, select:focus, textarea:focus { 
    border-color: var(--primary); 
    outline: none; 
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
    background-color: white;
}
label {
    display: inline-block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

/* Tables */
table { width: 100%; border-collapse: collapse; margin-top: 10px; border-radius: 14px; overflow: hidden; background: white; box-shadow: 0 6px 18px -12px rgba(15, 23, 42, 0.12); }
th { 
    background-color: #F1F5F9;
    color: var(--text-muted); 
    font-weight: 700; 
    padding: 14px 18px; 
    text-align: left; 
    font-size: 0.82rem; 
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}
td { 
    padding: 16px; 
    background: white; 
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    font-size: 0.9rem;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background-color: #F8FAFC; }

/* Alerts */
.alert { 
    padding: 16px; 
    margin-bottom: 24px; 
    border-radius: 8px; 
    border: 1px solid transparent;
    font-size: 0.95rem;
}
.success { background: #ECFDF5; color: #065F46; border-color: #A7F3D0; }
.error { background: #FEF2F2; color: #991B1B; border-color: #FECACA; }
.alert-warning { background: #FFFBEB; color: #92400E; border-color: #FDE68A; }

/* Login */
.login-body {
    background: #F1F5F9;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background: #fff;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    width: 1000px;
    max-width: 100%;
    min-height: 600px;
}

.login-left {
    flex: 1;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form-wrapper {
    max-width: 360px;
    margin: 0 auto;
    width: 100%;
}

.login-left h2 {
    font-size: 1.75rem;
    color: var(--text-main);
    margin-bottom: 8px;
    font-weight: 700;
}

.login-right {
    flex: 1.1;
    background: linear-gradient(135deg, var(--primary) 0%, #4338CA 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    padding: 40px;
}

.login-right h1 {
    font-size: 2.5rem;
    margin-bottom: 16px;
    font-weight: 800;
    color: #FFFFFF;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3); /* Tambahkan shadow agar kontras */
}

.login-right p {
    font-size: 1.1rem;
    opacity: 1; /* Hapus transparansi */
    color: #E0E7FF;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--text-sidebar);
    cursor: pointer;
    padding: 8px;
    position: absolute;
    top: 24px;
    right: 24px;
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: sticky;
        top: 0;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        z-index: 1100;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }
    .mobile-nav-toggle { display: block; }
    .nav-links { display: none; }
    .nav-links.active { display: block; background: var(--bg-sidebar); }
    .login-container { flex-direction: column; max-width: 480px; min-height: auto; }
    .login-right { display: none; }
    .login-left { padding: 40px; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* DataTables Override */

/* Sidebar Dropdown Styling */
.nav-links .nav-dropdown {
    margin-bottom: 6px;
}

.nav-links .nav-dropdown details {
    border-radius: 8px;
    overflow: hidden;
}

.nav-links .nav-dropdown summary {
    list-style: none;
    padding: 10px 16px;
    color: #CBD5E1;
    font-weight: 600;
    font-size: 0.86rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-links .nav-dropdown summary::-webkit-details-marker {
    display: none;
}

.nav-links .nav-dropdown summary::after {
    content: '▾';
    float: right;
    opacity: 0.8;
    transition: transform 0.2s ease;
}

.nav-links .nav-dropdown details[open] summary::after {
    transform: rotate(180deg);
}

.nav-links .nav-dropdown summary:hover {
    background: rgba(255,255,255,0.08);
    color: #E0E7FF;
}

.nav-links .dropdown-menu {
    list-style: none;
    margin: 6px 0 0;
    padding: 0 0 0 8px;
}

.nav-links .dropdown-menu li {
    margin-bottom: 2px;
}

.nav-links .dropdown-menu li a {
    display: block;
    padding: 8px 12px;
    color: #CBD5E1;
    font-size: 0.84rem;
    border-radius: 7px;
}

.nav-links .dropdown-menu li a:hover {
    background: rgba(255,255,255,0.08);
    color: #FFFFFF;
}
.dataTables_wrapper .dataTables_length select { border-radius: 8px; padding: 5px; }
.dataTables_wrapper .dataTables_filter input { border-radius: 8px; padding: 5px 10px; margin-left: 10px; }

/* Print Styles */
@media print {
    .sidebar, .filter-form, .header-section, .btn, .no-print, .dataTables_filter, .dataTables_length, .dataTables_paginate, .dataTables_info, .back-link { 
        display: none !important; 
    }
    .container { margin: 0; padding: 0; max-width: 100%; width: 100%; }
    .main-content { margin: 0; padding: 0; width: 100%; }
    .card { box-shadow: none; border: none; padding: 0; }
    body { background: white; font-size: 12pt; }
    table { width: 100%; border-collapse: collapse; }
    th, td { border: 1px solid #ddd; padding: 8px; font-size: 10pt; }
    a { text-decoration: none; color: black; }
    
    /* Show Print Header */
    .print-header { display: flex !important; }
}

/* Print Header - Visible on Screen too */
.print-header {
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 20px;
    margin-bottom: 30px;
}
.print-header img { height: 50px; width: auto; }
.print-header div h3 { margin: 0; font-size: 1.25rem; color: var(--text-main); text-transform: uppercase; font-weight: 700; }
.print-header div p { margin: 5px 0 0; font-size: 0.85rem; color: var(--text-muted); }

/* Print Styles Override */
@media print {
    .print-header {
        border-bottom: 2px solid #000;
        margin-bottom: 20px;
    }
    .print-header div h3 { color: #000; }
    .print-header div p { color: #000; }
}

/* Mobile refinements: rapikan layout untuk layar kecil */
@media (max-width: 600px) {
    body { display: block; }
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        left: 0;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 12px;
    }
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-bottom: 18px;
    }
    .page-header h2 { font-size: 1.25rem; }
    .page-clock {
        min-width: 0;
        max-width: 100%;
        padding: 12px;
        border-radius: 12px;
        text-align: left;
    }
    .container { padding: 12px; max-width: 100%; }
    .card { padding: 16px; border-radius: 12px; }
    .stat-item { padding: 16px; }
    .btn, button[type="submit"] { width: 100%; box-sizing: border-box; }
    input, select, textarea { padding: 10px; }
    table th, table td { padding: 10px; font-size: 0.85rem; }
    .nav-links { display: none; }
    .mobile-nav-toggle { display: block; position: absolute; top: 12px; right: 12px; }
    img.hero-image, img { max-width: 100%; height: auto; }
    .login-container { width: 100%; padding: 12px; }
    .login-left { padding: 24px; }
}
