/* public/assets/css/style.css */

/* ============================================= */
/* == 0. RESET & VARS == */
/* ============================================= */
:root {
    --sidebar-width: 250px;       /* Desktop Expanded */
    --sidebar-mini-width: 80px;   /* Desktop Collapsed */
    --sidebar-bg: #111827;
    --body-bg: #f1f5f9;
    --topbar-height: 70px;
    --transition-speed: 0.25s;
}

/* Reset Box Model Global */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0; padding: 0;
    width: 100%; height: 100%;
    font-family: 'Poppins', sans-serif;
    background-color: var(--body-bg);
    overflow-x: hidden; /* Mencegah scroll horizontal */
}

/* ============================================= */
/* == 1. LAYOUT ARCHITECTURE (Flexbox) == */
/* ============================================= */
#wrapper {
    display: flex;           /* Sidebar & Content Berdampingan */
    width: 100%;
    min-height: 100vh;
    overflow: visible;       /* Allow Sticky Sidebar */
    flex-wrap: nowrap;       /* Jangan turun baris */
}

/* ============================================= */
/* == 2. SIDEBAR (Sticky & Resizable) == */
/* ============================================= */
#sidebar-wrapper {
    width: var(--sidebar-width);
    min-height: 100vh;
    background-color: var(--sidebar-bg);
    flex-shrink: 0;          /* Sidebar tidak boleh mengecil */

    /* Sticky Positioning for Desktop */
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;        /* Scrollable independently */

    display: flex;
    flex-direction: column;
    transition: width var(--transition-speed) ease;
    z-index: 1000;

    /* Glassmorphism effect */
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
}

/* Scrollbar Sidebar Custom */
#sidebar-wrapper::-webkit-scrollbar { width: 5px; }
#sidebar-wrapper::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }

/* ============================================= */
/* == 3. CONTENT WRAPPER (Fluid) == */
/* ============================================= */
#page-content-wrapper {
    flex-grow: 1;            /* Mengisi sisa ruang */
    width: 100%;             /* Basis lebar sebelum shrink */
    min-width: 0;            /* KRUSIAL: Mencegah grid/flex child memaksa parent melebar (Fix grid stacking) */

    display: flex;
    flex-direction: column;
    background-color: var(--body-bg);
    transition: all var(--transition-speed) ease;
}

/* Navbar di dalam Content Wrapper */
.navbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e7e7e7;
    width: 100%;
    padding: 0 1.5rem;
    flex-shrink: 0;
}

/* ============================================= */
/* == 4. DESKTOP TOGGLE LOGIC (Mini Sidebar) == */
/* ============================================= */

/* Desktop only: Saat Body punya class 'sb-sidenav-toggled' (Klik Hamburger) */
@media (min-width: 992px) {
    body.sb-sidenav-toggled #sidebar-wrapper {
        width: var(--sidebar-mini-width);
    }

    /* Elemen Sidebar saat Mini */
    body.sb-sidenav-toggled .sidebar-brand-text,
    body.sb-sidenav-toggled .menu-text,
    body.sb-sidenav-toggled .dropdown-arrow {
        display: none; /* Sembunyikan Teks */
        opacity: 0;
    }

    /* Pusatkan Icon saat Mini */
    body.sb-sidenav-toggled .sidebar-brand { justify-content: center; padding: 0; }
    body.sb-sidenav-toggled .sidebar-brand img { margin-right: 0; }
    body.sb-sidenav-toggled .list-group-item { justify-content: center; padding: 0.8rem 0; }
    body.sb-sidenav-toggled .list-group-item i { margin-right: 0; }

    /* Sembunyikan Submenu saat Mini (UX Choice) */
    body.sb-sidenav-toggled .has-dropdown.open > .submenu { display: none; }
}


/* ============================================= */
/* == 5. MOBILE LAYOUT (< 992px) == */
/* ============================================= */
@media (max-width: 991.98px) {
    /* Mobile wrapper behavior */
    #wrapper {
        position: relative;
    }

    #sidebar-wrapper {
        position: fixed;
        top: 0;
        left: 0;
        width: 85%; /* Responsive width */
        max-width: 320px; /* Maximum width for larger mobile screens */
        height: 100vh;
        z-index: 1050; /* Higher than content */
        transform: translateX(-100%); /* Initially hidden */
        transition: transform 0.3s ease;
        background: rgba(17, 24, 39, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: none;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.4);
        overflow-y: auto;
    }

    /* Show sidebar when toggled */
    body.sb-sidenav-toggled #sidebar-wrapper {
        transform: translateX(0); /* Show sidebar */
    }

    /* Mobile sidebar content */
    .list-group {
        padding: 1.5rem 1rem;
    }

    /* Mobile sidebar brand */
    .sidebar-brand {
        padding: 1.2rem 1rem;
        border-bottom: none;
    }

    /* Mobile menu items */
    .list-group-item {
        padding: 1rem 1.2rem;
        margin-bottom: 0.6rem;
        border-radius: 12px;
        min-height: 52px;
        display: flex;
        align-items: center;
        white-space: nowrap; /* Prevent text wrapping */
        overflow: hidden;
    }

    .list-group-item i {
        margin-right: 16px;
        font-size: 1.25rem;
        min-width: 24px;
        text-align: center;
    }

    /* Mobile submenu */
    .submenu {
        padding: 0.5rem 0 0.5rem 1rem;
        margin-left: 36px;
    }

    .submenu a {
        padding: 0.8rem 1rem 0.8rem 2rem;
        margin: 0.3rem 0;
        border-radius: 10px;
        font-size: 0.9rem;
        white-space: nowrap; /* Ensure text doesn't wrap unnecessarily */
        overflow: hidden;
        text-overflow: ellipsis; /* Add ellipsis if text is still too long */
    }

    /* Mobile backdrop */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        z-index: 1040; /* Lower than sidebar */
    }

    body.sb-sidenav-toggled .sidebar-backdrop {
        display: block;
    }

    /* Prevent body scroll when mobile sidebar is open */
    body.sb-sidenav-toggled {
        overflow: hidden;
    }

    /* Override desktop mini sidebar behavior for mobile - show text and icons */
    body.sb-sidenav-toggled .sidebar-brand-text,
    body.sb-sidenav-toggled .menu-text,
    body.sb-sidenav-toggled .dropdown-arrow {
        display: inline-block !important;
        opacity: 1 !important;
    }

    body.sb-sidenav-toggled .sidebar-brand {
        justify-content: flex-start !important;
        padding: 1.2rem 1rem !important;
    }

    body.sb-sidenav-toggled .list-group-item {
        justify-content: flex-start !important;
        padding: 1rem 1.2rem !important;
    }

    body.sb-sidenav-toggled .list-group-item i {
        margin-right: 16px !important;
    }

    /* Ensure submenu items also have proper text display */
    body.sb-sidenav-toggled .submenu a {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Adjust main content for mobile */
@media (max-width: 991.98px) {
    #page-content-wrapper {
        min-width: 100vw;
        transition: transform 0.3s ease;
    }
}

/* ============================================= */
/* == 6. COMPONENTS STYLING (YOUTUBE STYLE) == */
/* ============================================= */

/* Page content body that grows to push footer down */
.page-content-body {
    flex: 1 1 auto;
    min-height: calc(100vh - var(--topbar-height)); /* Account for topbar height */
}

/* Dashboard footer styling */
.dashboard-footer {
    flex-shrink: 0; /* Prevent footer from shrinking */
    margin-top: auto; /* Push footer to bottom */
    width: 100%;
}

/* Hide dashboard footer on login and register pages */
body.login-page .dashboard-footer,
body.register-page .dashboard-footer {
    display: none;
}

/* ============================================= */

/* Brand */
.sidebar-brand {
    height: var(--topbar-height);
    display: flex; align-items: center;
    padding: 0 1.5rem;
    width: 100%; text-decoration: none; overflow: hidden;
}
.sidebar-brand img { width: 28px; height: 28px; margin-right: 16px; transition: margin 0.2s; }
.sidebar-brand-text { 
    font-size: 1.1rem; font-weight: 500; letter-spacing: -0.5px; 
    color: #f1f1f1; white-space: nowrap; transition: opacity 0.2s; 
}

/* Menu List Container */
.list-group { padding: 12px 12px; margin: 0; list-style: none; }

/* Menu Item (YouTube Style) */
.list-group-item {
    background: transparent;
    color: #f1f1f1;
    padding: 0 12px;
    height: 48px; /* Fixed height for consistency */
    display: flex; align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap; cursor: pointer;
    border-radius: 15px; /* Increased border radius */
    margin-bottom: 4px;
    font-size: 0.95rem;
    font-weight: 400;
    border: none; /* Remove any borders */
    min-height: 48px; /* Better touch target for mobile */
}

/* Hover Effect */
.list-group-item:hover {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15)); /* Gradient hover effect */
    color: #fff;
    transform: translateX(5px); /* Subtle movement on hover */
    border-radius: 15px; /* Matching border radius for hover state */
}

/* Active State (Gradient background using logo colors) */
.list-group-item.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.6), rgba(139, 92, 246, 0.6)); /* Blue to purple gradient */
    color: #fff;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    border-radius: 15px; /* Increased border radius for more rounded effect */
}

/* Icons */
.list-group-item i { 
    font-size: 1.3rem; 
    min-width: 24px; 
    text-align: center; 
    margin-right: 20px; 
    transition: margin 0.2s; 
    color: #e2e8f0;
}

.list-group-item.active i {
    color: #fff; /* Active icon brighter */
}

/* Submenu */
.submenu { 
    list-style: none; padding: 5px 0; margin: 0; 
    /* No darker bg, just indent */
    background: transparent; 
    max-height: 0; overflow: hidden; transition: max-height 0.3s ease; 
}
.has-dropdown.open > .submenu { max-height: 500px; }

.submenu a {
    color: #b3b3b3;
    text-decoration: none;
    display: block;
    padding: 12px 12px 12px 56px; /* Increased padding for better touch target */
    font-size: 0.9rem;
    border-radius: 15px; /* Match active state border radius */
    margin: 0 12px 2px 12px;
    transition: all 0.3s ease;
    border: none; /* Remove any borders */
    min-height: 44px; /* Better touch target for mobile */
}
.submenu a:hover {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
    color: #fff;
    transform: translateX(5px);
    border-radius: 15px; /* Matching border radius for submenu hover */
}
.submenu a.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.6), rgba(139, 92, 246, 0.6));
    color: #fff;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    border-radius: 15px; /* Matching border radius for submenu active items */
}

/* Arrow */
.dropdown-arrow { margin-left: auto; font-size: 0.8rem; transition: transform 0.2s; opacity: 0.7; }
.has-dropdown.open .dropdown-arrow { transform: rotate(180deg); }

/* Separator Line (Optional, add class .nav-separator to li if needed) */
.nav-separator {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 8px 0;
}

/* Utilities */
.toggle-password { cursor: pointer; }

/* Button System Styling */
.btn {
    border-radius: 12px !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:hover::before {
    opacity: 1;
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border: none !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b, #94a3b8);
    border: none !important;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #475569, #64748b);
}

.btn-success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    border: none !important;
}

.btn-success:hover {
    background: linear-gradient(135deg, #15803d, #16a34a);
}

.btn-info {
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    border: none !important;
}

.btn-info:hover {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    border: none !important;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border: none !important;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
}

.btn-outline-primary {
    border: 2px solid #2563eb !important;
    color: #2563eb;
    background: transparent;
}

.btn-outline-primary:hover {
    background: rgba(37, 99, 235, 0.1) !important;
    color: #1d4ed8;
}

.btn-outline-secondary {
    border: 2px solid #64748b !important;
    color: #64748b;
    background: transparent;
}

.btn-outline-secondary:hover {
    background: rgba(100, 116, 139, 0.1) !important;
    color: #475569;
}

.btn-outline-success {
    border: 2px solid #16a34a !important;
    color: #16a34a;
    background: transparent;
}

.btn-outline-success:hover {
    background: rgba(22, 163, 74, 0.1) !important;
    color: #15803d;
}

.btn-outline-info {
    border: 2px solid #0ea5e9 !important;
    color: #0ea5e9;
    background: transparent;
}

.btn-outline-info:hover {
    background: rgba(14, 165, 233, 0.1) !important;
    color: #0284c7;
}

.btn-outline-warning {
    border: 2px solid #f59e0b !important;
    color: #f59e0b;
    background: transparent;
}

.btn-outline-warning:hover {
    background: rgba(245, 158, 11, 0.1) !important;
    color: #d97706;
}

.btn-outline-danger {
    border: 2px solid #dc2626 !important;
    color: #dc2626;
    background: transparent;
}

.btn-outline-danger:hover {
    background: rgba(220, 38, 38, 0.1) !important;
    color: #b91c1c;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 10px !important;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
    border-radius: 14px !important;
}

/* Glassmorphism Button Styling */
.btn-glass {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #495057; /* Warna teks gelap untuk kontras yang lebih baik */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-glass-primary {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(59, 130, 246, 0.2));
    border: 1px solid rgba(37, 99, 235, 0.3);
    color: #1d4ed8; /* Warna teks biru gelap untuk kontras */
}

.btn-glass-primary:hover {
    background: linear-gradient(135deg, rgba(29, 78, 216, 0.3), rgba(37, 99, 235, 0.3));
    color: #1e40af;
}

.btn-glass-secondary {
    background: linear-gradient(135deg, rgba(100, 116, 139, 0.2), rgba(148, 163, 184, 0.2));
    border: 1px solid rgba(100, 116, 139, 0.3);
    color: #475569; /* Warna teks abu gelap untuk kontras */
}

.btn-glass-secondary:hover {
    background: linear-gradient(135deg, rgba(71, 85, 105, 0.3), rgba(100, 116, 139, 0.3));
    color: #334155;
}

/* Glassmorphism Button Styling untuk konteks terang */
.btn-glass-light {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(248, 250, 252, 0.4));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #495057;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.btn-glass-light:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(248, 250, 252, 0.5));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.btn-glass-light-primary {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(59, 130, 246, 0.25));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(37, 99, 235, 0.3);
    color: #1d4ed8;
}

.btn-glass-light-primary:hover {
    background: linear-gradient(135deg, rgba(29, 78, 216, 0.35), rgba(37, 99, 235, 0.35));
    color: #1e40af;
}

.btn-glass-light-secondary {
    background: linear-gradient(135deg, rgba(100, 116, 139, 0.25), rgba(148, 163, 184, 0.25));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(100, 116, 139, 0.3);
    color: #475569;
}

.btn-glass-light-secondary:hover {
    background: linear-gradient(135deg, rgba(71, 85, 105, 0.35), rgba(100, 116, 139, 0.35));
    color: #334155;
}

/* Tombol dengan efek gradient lebih kuat - dengan pendekatan override maksimum */
button.btn-gradient-primary,
.btn.btn-gradient-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 12px !important;
    font-weight: 500 !important;
    padding: 0.5rem 1rem !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    overflow: hidden !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    /* Override Bootstrap defaults */
    background-image: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    background-color: transparent !important;
}

button.btn-gradient-primary:hover,
.btn.btn-gradient-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    color: #fff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4) !important;
    background-image: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
}

button.btn-gradient-secondary,
.btn.btn-gradient-secondary {
    background: linear-gradient(135deg, #94a3b8, #64748b) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 12px !important;
    font-weight: 500 !important;
    padding: 0.5rem 1rem !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    overflow: hidden !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    /* Override Bootstrap defaults */
    background-image: linear-gradient(135deg, #94a3b8, #64748b) !important;
    background-color: transparent !important;
}

button.btn-gradient-secondary:hover,
.btn.btn-gradient-secondary:hover {
    background: linear-gradient(135deg, #64748b, #475569) !important;
    color: #fff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(100, 116, 139, 0.4) !important;
    background-image: linear-gradient(135deg, #64748b, #475569) !important;
}


/* Login Page Extras (Keep) */
.bg-ocean-animated { background: linear-gradient(-45deg, #0f2027, #203a43, #0d6efd, #00c6ff); background-size: 400% 400%; animation: gradientBG 15s ease infinite; }
@keyframes gradientBG { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.glass-card { background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(20px); border-radius: 1.5rem; }
.float-anim { animation: float 6s ease-in-out infinite; }
@keyframes float { 0% { transform: translatey(0px); } 50% { transform: translatey(-20px); } 100% { transform: translatey(0px); } }
.glass-input { background: rgba(255, 255, 255, 0.9); border: 1px solid rgba(0, 0, 0, 0.1); }
