/* css/global.css - FINAL STABLE VERSION (REVISED MODAL) */

/* ==========================================================================
   1. CSS Resets & Basics
   ========================================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7fa;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Mengunci scroll saat modal terbuka agar tidak flickering */
body.modal-open {
    overflow: hidden !important;
}

/* ==========================================================================
   2. Layout Structure
   ========================================================================== */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    background: #2c3e50;
    width: 260px;
    min-height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1.5rem 0;
    transition: all 0.3s ease;
}

.main-content {
    flex: 1;
    padding: 2rem;
    background-color: #f4f7fa;
    width: 100%;
}

/* ==========================================================================
   3. Sidebar Menu Styling (PROFESSIONAL FIX)
   ========================================================================== */
.dashboard-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
    padding: 1rem 1.5rem 0.5rem;
    font-weight: bold;
}

.sidebar-item {
    margin: 2px 10px;
}

/* Memperbaiki tampilan link sidebar (Warna & Tanpa Underline) */
.sidebar-link, 
.sidebar-item a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.8) !important;
    text-decoration: none !important;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.sidebar-link:hover, 
.sidebar-item a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff !important;
    transform: translateX(5px);
}

.sidebar-link i, 
.sidebar-item a i {
    width: 25px;
    margin-right: 10px;
    font-size: 1.1rem;
    color: #3498db; 
}

.sidebar-link.text-danger, 
.sidebar-item a.text-danger {
    color: #e74c3c !important;
}

.sidebar select {
    background: #34495e;
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    padding: 5px 10px;
}

/* ==========================================================================
   4. Dashboard Components
   ========================================================================== */
.profile-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.dashboard-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   5. STABLE CUSTOM MODAL (ANTI-TABIR ABU-ABU) - UPDATED
   ========================================================================== */
.custom-modal {
    display: none;
    visibility: hidden; /* Benar-benar menghilangkan elemen dari pandangan */
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    overflow-y: auto;
    pointer-events: none; 
}

.custom-modal.show {
    display: block !important;
    visibility: visible !important; /* Munculkan saat class .show ada */
    pointer-events: auto;
}

.custom-modal-content {
    background-color: white;
    margin: 8vh auto;
    border-radius: 12px;
    width: 90%;
    max-width: 550px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.custom-modal-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fcfcfc;
    border-radius: 12px 12px 0 0;
}

.custom-modal-body { padding: 1.5rem; }
.custom-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.custom-modal-close {
    background: none; border: none; font-size: 1.8rem; color: #aaa; cursor: pointer;
}

/* ==========================================================================
   6. Responsiveness (Overlay Mode)
   ========================================================================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        transition: left 0.3s ease;
    }
    .sidebar.active { left: 0; }
    .main-content { width: 100%; padding: 1rem; padding-top: 80px; }
    
    .menu-toggle {
        display: flex !important;
        position: fixed; top: 15px; left: 15px; z-index: 10001;
        background: white; border: 2px solid #2c3e50; 
        width: 45px; height: 45px; align-items: center; justify-content: center;
        border-radius: 8px; cursor: pointer;
    }
}

/* Pastikan sidebar bisa discroll di perangkat mobile */
.sidebar {
    overflow-y: auto;
    max-height: 100vh;
    padding-bottom: 20px; /* ruang ekstra di bawah */
}

/* Atur transisi dan posisi sidebar saat aktif (mobile) */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        width: 260px;
        transition: left 0.3s ease;
        z-index: 1000;
    }
    .sidebar.active {
        left: 0;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
}

/* Agar tombol logout terlihat jelas */
.sidebar-item:last-child {
    margin-bottom: 20px;
}