/* ===================================================================
   SIDEBAR — HYBRID PRO CLEAN FINAL
   =================================================================== */

/* COLORS */
:root {
    --sidebar-bg: #0B5736;
    --sidebar-bg-light: rgba(255,255,255,0.12);
    --sidebar-bg-hover: rgba(255,255,255,0.22);
    --sidebar-border: rgba(255,255,255,0.35);
    --sidebar-text: #ffffff;
    --sidebar-icon-active: #4ade80;
}

/* ===================================================================
    SIDEBAR ROOT
=================================================================== */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 240px;
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    overflow-y: auto;
    transition: width .28s ease, padding .28s ease;
    z-index: 1000;
}

/* COLLAPSED */
.sidebar.closed {
    width: 90px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 8px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.25);
    border-radius: 6px;
}

/* ===================================================================
    PROFILE AREA
=================================================================== */
.sidebar-header,
.sidebar-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.masjid-logo {
    width: 64px; height: 64px;
    border-radius: 8px;
    margin-bottom: 6px;
}

.user-photo {
    width: 76px; height: 76px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--sidebar-text);
    margin-bottom: 8px;
}

.user-name {
    font-size: 15px;
    font-weight: 600;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===================================================================
    MENU
=================================================================== */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 14px 0 0 0;
}

.sidebar-menu li {
    width: 100%;
}

.sidebar-menu a,
.dropdown-toggle-sidebar {
    width: 90%;
    margin: 0 auto 10px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--sidebar-bg-light);
    border-radius: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background .18s ease;
}

.sidebar-menu a:hover,
.dropdown-toggle-sidebar:hover {
    background: var(--sidebar-bg-hover);
}

/* ACTIVE ITEM */
.sidebar-menu a.active {
    background: var(--sidebar-bg-hover);
    border-left: 3px solid var(--sidebar-text);
}

/* ICON ROTATE */
.arrow-icon {
    margin-left: auto;
    transition: transform .25s ease;
}
.sidebar-dropdown.open .arrow-icon {
    transform: rotate(180deg);
}

/* ===================================================================
    SUBMENU (FULL MODE)
=================================================================== */
.sidebar-submenu {
    display: flex;
    flex-direction: column;
    width: 90%;
    margin: 0 auto;
    padding-left: 14px;
    border-left: 2px solid var(--sidebar-border);

    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height .35s ease, opacity .25s ease;
}

.sidebar-dropdown.open .sidebar-submenu {
    max-height: 600px;
    opacity: 1;
}

.sidebar-submenu li a {
    padding: 9px 12px;
    border-radius: 8px;
}
.sidebar-submenu li a:hover {
    background: var(--sidebar-bg-hover);
}

/* ===================================================================
    COLLAPSED MODE (HIDE LABELS)
=================================================================== */
.sidebar.closed .user-name,
.sidebar.closed .masjid-logo,
.sidebar.closed .sidebar-header h2,
.sidebar.closed .sidebar-menu a span,
.sidebar.closed .logout-btn span,
.sidebar.closed .arrow-icon {
    display: none !important;
}

.sidebar.closed .sidebar-menu a,
.sidebar.closed .dropdown-toggle-sidebar,
.sidebar.closed .logout-btn {
    width: 60px !important;
    justify-content: center !important;
}

/* === Submenu Floating ketika Collapsed === */
.sidebar.closed .sidebar-dropdown {
    position: relative;
}

.sidebar.closed .sidebar-dropdown .sidebar-submenu {
    position: fixed;
    left: 100px; /* sedikit menjauh dari sidebar */
    top: var(--submenu-top, 0);
    width: 240px;
    padding: 10px 0;
    background: var(--sidebar-bg);
    border-radius: 12px; /* biar lebih soft */
    box-shadow: 0 8px 20px rgba(0,0,0,0.28);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 5000 !important;

    transform: translateY(0) translateX(8px);
    transition: opacity .25s ease, visibility .25s ease, transform .25s ease;
}

.sidebar.closed .sidebar-dropdown.open > .sidebar-submenu {
    opacity: 1;
    margin-top: 6px;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) translateX(8px);
}

/* Default submenu item */
.sidebar.closed .sidebar-submenu li a {
    width: 100% !important;
    padding: 12px 18px !important;
    gap: 12px !important;
    justify-content: flex-start !important;
    background: transparent;
    transform: translateX(0);
    transition: background .18s ease, transform .15s ease;
}

/* Hover submenu item */
.sidebar.closed .sidebar-submenu li a:hover {
    background: var(--sidebar-bg-hover);
    transform: translateX(6px);
}

.sidebar.closed .sidebar-dropdown.open > .sidebar-submenu li:last-child a {
    border-radius: 0 0 10px 10px;
}

/* ===================================================================
    LOGOUT BUTTON
=================================================================== */
.sidebar-bottom {
    margin-top: auto;
    display: flex;
    justify-content: center;
}

.logout-btn {
    width: 90%;
    padding: 12px;
    justify-content: center;
    background: var(--sidebar-bg-light);
    border-radius: 10px;
    text-decoration: none;
    color: var(--sidebar-text);
}
.logout-btn:hover {
    background: var(--sidebar-bg-hover);
}

/* ===================================================================
    ICON CUSTOM COLORS (KEEPED)
=================================================================== */
.pria-item i { color: #60a5fa !important; }
.wanita-item i { color: #f472b6 !important; }
.subuh-item i { color: #93c5fd !important; }
.dzuhur-item i { color: #facc15 !important; }
.ashar-item i { color: #fb923c !important; }
.maghrib-item i { color: #a78bfa !important; }
.isya-item i { color: #22d3ee !important; }
.diluar-item i { color: #94a3b8 !important; }

.listrik-item i { color: #facc15 !important; }
.air-item i { color: #38bdf8 !important; }
.suhu-item i { color: #fb923c !important; }
.kelembapan-item i { color: #2dd4bf !important; }

.keuangan-masuk-item i { color: #4ade80 !important; }
.keuangan-keluar-item i { color: #ef4444 !important; }

.kegiatan-7hari-item i { color: #38bdf8 !important; }
.kegiatan-semua-item i { color: #34d399 !important; }
.kegiatan-tambah-item i { color: #22c55e !important; }
.kegiatan-riwayat-item i { color: #a78bfa !important; }

.semua-kritik-saran i { color: #34d399 !important; }      /* Hijau cerah */
.kritik-saran-baru i { color: #f87171 !important; }       /* Merah lembut */
.kritik-saran-dibaca i { color: #60a5fa !important; }     /* Biru muda */
.riwayat-kritik-saran i { color: #a78bfa !important; }    /* Ungu pastel */

/* ===================================================================
    RESPONSIVE
=================================================================== */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
}

/* SHIFT CONTENT COLLAPSED */
.sidebar.closed ~ #content-wrapper {
    margin-left: 90px !important;
    transition: margin-left .28s ease;
}