@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
    --bg-main: #f8fafc;
    --sidebar-bg: #1e293b;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-width: 260px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1001; /* Always on top */
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
}

.logo-emoji {
    font-size: 28px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Sidebar Header */
.sidebar-header {
    padding: 32px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-close {
    display: none;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
}

body.sidebar-open .sidebar-backdrop {
    display: block;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-emoji {
    font-size: 28px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}

.user-profile {
    margin: 0 16px 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.user-role {
    font-size: 12px;
    color: #94a3b8;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
    scrollbar-width: none; /* Hide for Firefox */
}

.sidebar-nav::-webkit-scrollbar {
    display: none; /* Hide for Chrome/Safari */
}

.nav-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    margin: 24px 12px 8px;
    letter-spacing: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-icon {
    font-size: 18px;
}

.sidebar-footer {
    padding: 24px 24px 40px; /* Extra bottom padding for mobile safe area */
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #ef4444;
    color: #fff;
}

/* --- TOP HEADER (NAVBAR INDUK) --- */
.top-header {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    
    /* Flexbox Engine */
    display: flex;
    align-items: center;
    justify-content: space-between;
    
    padding: 0 24px;
    z-index: 1000;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.sidebar-collapsed .top-header {
    left: 0;
}

.sidebar-toggle {
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-main);
    transition: all 0.2s;
    margin-right: 16px;
}

.sidebar-toggle:hover {
    background: #e2e8f0;
}

.breadcrumb {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

.sidebar-collapsed .top-header {
    left: 0;
}

.sidebar-collapsed .main-content {
    margin-left: 0;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 102px 32px 32px;
    min-height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: #fff;
    border-radius: 16px 16px 0 0;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
}

.card-body {
    padding: 24px;
}

/* Dashboard Stats */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.stat-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }

.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.btn-warning:hover { background: var(--warning); color: #fff; }

.btn-info { background: rgba(14, 165, 233, 0.1); color: var(--info); }
.btn-info:hover { background: var(--info); color: #fff; }

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.table th {
    background: #f8fafc;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 16px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: #f1f5f9;
}

/* Forms */
.form-group {
    margin-bottom: 32px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 32px;
    margin-bottom: 12px;
}

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: #fff;
    font-family: inherit;
    font-size: 15px;
    transition: all 0.2s;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: #fff;
    max-width: 700px;
    margin: 40px auto;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.3s ease-out;
}

.modal-content form {
    padding: 32px 32px 48px 32px;
}

@keyframes modalSlide {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

/* Login Page Styling */
.login-container {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    background: #fff;
    padding: 48px;
    border-radius: 32px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- RESPONSIVE MOBILE FIX (ANDROID & iOS) --- */
@media (max-width: 768px) {
    /* Layout & Sidebar */
    .sidebar {
        transform: translateX(-100%);
        width: 85%; /* Lebih lebar di mobile */
        max-width: 300px;
    }
    
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
    
    .mobile-close {
        display: flex; /* Show only on mobile */
    }
    
    /* BLOK KHUSUS SELULER (ANDROID/iOS) */
    .top-header {
        left: 0 !important;
        width: 100% !important;
        height: 60px !important;
        padding: 0 16px !important;
        justify-content: space-between !important;
        box-sizing: border-box;
        z-index: 1000 !important;
        background: #fff !important; /* Force solid bg on mobile */
    }

    .sidebar-toggle {
        width: 40px;
        height: 40px;
        background: #f8fafc;
        border: 1px solid #e2e8f0 !important;
        color: #1e293b !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        display: flex !important;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .breadcrumb {
        flex: 1;
        text-align: right;
        font-size: 12px;
        padding-right: 4px;
        color: var(--text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-left: 10px;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 75px 12px 20px !important;
        width: 100% !important;
        overflow-x: hidden;
        background: var(--bg-main);
    }

    .container {
        padding: 0 !important;
        width: 100% !important;
    }

    /* Typography */
    h2 { font-size: 20px; margin-bottom: 12px; line-height: 1.3; }
    .logo-text { font-size: 18px; }

    /* Stats Cards - Paksa 1 Kolom & Centered */
    .stats-container {
        grid-template-columns: 1fr !important;
        gap: 12px;
        margin-bottom: 20px;
    }
    .stat-card { 
        padding: 20px !important; 
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    .stat-card .value { 
        font-size: 28px !important; 
        margin: 8px 0;
    }
    .stat-card h3 {
        font-size: 12px;
        margin-bottom: 8px;
    }

    /* Forms - Paksa 1 Kolom per baris */
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }
    .form-group { margin-bottom: 15px; }

    /* Tables - Aktifkan scroll horizontal */
    .card-body {
        padding: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table {
        min-width: 500px;
    }

    /* Buttons */
    .btn-group {
        flex-direction: column;
        gap: 10px;
    }
    .btn { width: 100%; justify-content: center; height: 45px; }

    /* Modal - Biar pas di layar HP */
    .modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
        border-radius: 15px;
    }
    .modal-content form { padding: 20px; }

    /* Hide redundant info on mobile tables if needed */
    .hide-mobile { display: none; }

    /* DASHBOARD RESPONSIVE FIX */
    .welcome-section {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px;
        margin-bottom: 25px;
    }
    .date-section { 
        text-align: left !important; 
        padding-top: 10px;
        border-top: 1px solid #eee;
        width: 100%;
    }
    .dashboard-grid { 
        grid-template-columns: 1fr !important; 
        gap: 15px !important;
    }

    @media (max-width: 480px) {
        .breadcrumb { font-size: 12px; }
        .stat-card .value { font-size: 20px !important; }
    }
}

/* Utils */
.badge {
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-info { background: rgba(14, 165, 233, 0.1); color: var(--info); }

