/* ============================================================
   sidebar.css — SmartHospital Sidebar Blue Gradient Theme
   ============================================================ */

/* ---- Color Variables ---- */
:root {
    --sb-blue-start: #0ea5e9;
    --sb-blue-mid: #2563eb;
    --sb-blue-end: #4338ca;
    --sb-text: #ffffff;
    --sb-text-muted: rgba(255, 255, 255, 0.6);
    --sb-text-bright: #ffffff;
    --sb-border: rgba(255, 255, 255, 0.12);
    --sb-hover-bg: rgba(255, 255, 255, 0.12);
    --sb-active-bg: rgba(255, 255, 255, 0.18);
    --sb-shadow: rgba(0, 0, 0, 0.2);
}

/* ---- Dashboard Layout ---- */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar Utama ---- */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 265px;
    background: linear-gradient(180deg, #0ea5e9 0%, #2563eb 50%, #4338ca 100%);
    border-right: none;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 50;
    box-shadow: 4px 0 25px rgba(37, 99, 235, 0.25);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
    transition: width 0.3s ease, transform 0.3s ease;
}

/* Custom Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* ---- Main Content Area ---- */
.main-content {
    margin-left: 265px;
    flex: 1;
    padding: 32px;
    transition: margin-left 0.3s ease;
}

/* ---- Brand Header ---- */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 14px;
    border-bottom: 1px solid var(--sb-border);
}

.sidebar-brand span {
    color: #fff !important;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.sidebar-brand .brand-icon {
    background: rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
}

/* ---- User Profile ---- */
.user-profile-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px 16px;
    border-bottom: 1px solid var(--sb-border);
    margin-bottom: 4px;
    transition: all 0.3s ease;
}

.user-profile-mini div:last-child span:first-child {
    color: #fff !important;
}

.user-profile-mini div:last-child span:last-child {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* ---- Avatar ---- */
.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
}

/* ---- Sidebar Nav Wrapper ---- */
.sidebar-menu {
    padding: 4px 12px 24px;
    transition: padding 0.3s ease;
}

/* ---- Section Labels ---- */
.sidebar-menu nav > div[style] {
    color: #ffffff !important;
}

/* ---- Menu Item ---- */
.menu-item {
    cursor: pointer;
    display: flex;
    align-items: center;
    width: 100%;
    border: none;
    background: none;
    text-align: left;
    font-family: inherit;
    font-size: 13px;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    color: #ffffff;
    margin-bottom: 1px;
    transition: all 0.18s ease;
    font-weight: 500;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    white-space: nowrap;
}

/* Hover */
.menu-item:hover {
    background: var(--sb-hover-bg);
    color: #ffffff;
    transform: translateX(2px);
}

/* Active */
.menu-item.active {
    background: var(--sb-active-bg);
    color: #ffffff;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
}

/* Active — indikator kiri */
.menu-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #ffffff;
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Icon kiri */
.menu-item i:first-child {
    width: 18px;
    text-align: center;
    font-size: 13px;
    color: #ffffff;
    flex-shrink: 0;
    transition: color 0.18s;
}

.menu-item:hover i:first-child,
.menu-item.active i:first-child {
    color: #ffffff;
}

/* Chevron kanan */
.menu-icon-right {
    margin-left: auto;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    transition: transform 0.25s ease, color 0.18s;
    flex-shrink: 0;
}

.menu-item:hover .menu-icon-right,
.menu-item.active .menu-icon-right {
    color: rgba(255, 255, 255, 0.8);
}

/* Rotation class untuk chevron */
.rotate-90 {
    transform: rotate(90deg);
}

/* ---- Keluar (Logout) ---- */
a.menu-item[href*="logout"] {
    color: #fca5a5;
}

a.menu-item[href*="logout"] i:first-child {
    color: #fca5a5;
}

a.menu-item[href*="logout"]:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fecaca !important;
}

a.menu-item[href*="logout"]:hover i:first-child {
    color: #fecaca !important;
}

/* ---- Submenu Container ---- */
.submenu-container {
    display: none;
    overflow: hidden;
    transition: all 0.3s ease;
    padding-left: 6px;
    border-left: 2px solid rgba(255, 255, 255, 0.15);
    margin-left: 21px;
    margin-bottom: 2px;
}

.submenu-container.show {
    display: block;
}

/* ---- Submenu Item (level-2) ---- */
.submenu-item {
    padding-left: 22px !important;
    font-size: 13px;
    position: relative;
    white-space: normal !important;
    line-height: 1.4;
}

.submenu-item::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 16px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    transition: background 0.2s;
}

.submenu-item:hover::before {
    background: rgba(255, 255, 255, 0.7);
}

.submenu-item.active::before {
    background: #ffffff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

/* ---- Submenu Item Child ---- */
.submenu-item-child {
    padding-left: 24px !important;
    font-size: 13px;
    position: relative;
    white-space: normal !important;
    line-height: 1.4;
}

.submenu-item-child::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 15px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    transition: all 0.2s;
}

.submenu-item-child:hover::before {
    background: rgba(255, 255, 255, 0.7);
}

.submenu-item-child.active {
    color: #ffffff;
    font-weight: 600;
}

.submenu-item-child.active::before {
    background: #ffffff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

/* ---- Toggle Button ---- */
#sidebar-toggle-btn {
    position: fixed;
    top: 22px;
    left: 251px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2563eb;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.4);
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease,
        left 0.3s ease, transform 0.2s ease;
}

#sidebar-toggle-btn:hover {
    background: #ffffff;
    color: #2563eb;
    border-color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    transform: scale(1.1);
}

#sidebar-toggle-btn i {
    transition: transform 0.3s ease;
}

/* =============================================
   MINI SIDEBAR — Icon Only Mode
   ============================================= */

/* Sidebar menyempit */
body.sidebar-mini .sidebar {
    width: 60px;
}

/* Tombol geser ikut sidebar */
body.sidebar-mini #sidebar-toggle-btn {
    left: 46px;
}

/* Putar chevron */
body.sidebar-mini #sidebar-toggle-btn i {
    transform: rotate(180deg);
}

/* Main content maju */
body.sidebar-mini .main-content {
    margin-left: 60px;
    width: calc(100% - 60px);
}

/* ===== Trik font-size:0 ===== */
body.sidebar-mini .sidebar .menu-item {
    font-size: 0;
    justify-content: center;
    padding: 8px 0;
    overflow: visible;
    gap: 2px;
    transform: none !important;
    flex-direction: column;
    height: auto;
}

body.sidebar-mini .sidebar .menu-item i {
    font-size: 14px !important;
    width: auto !important;
    margin: 0 !important;
}

/* Indikator aktif tetap muncul tapi menggunakan border agar tidak konflik dengan tooltip */
body.sidebar-mini .sidebar .menu-item.active {
    border-left: 3px solid #ffffff !important;
    border-radius: 0 10px 10px 0;
}

body.sidebar-mini .sidebar .menu-item.active::after {
    display: none;
}

/* Sembunyikan chevron kanan */
body.sidebar-mini .sidebar .menu-icon-right {
    display: none !important;
}

/* Sembunyikan semua submenu */
body.sidebar-mini .sidebar .submenu-container {
    display: none !important;
}

/* Tampilkan inisial section labels kecuali yang pertama (Menu Utama) */
body.sidebar-mini .sidebar .sidebar-menu .section-label {
    display: flex !important;
    justify-content: center;
    font-size: 0 !important;
    padding: 14px 0 6px !important;
    opacity: 0.6;
}

body.sidebar-mini .sidebar .sidebar-menu .section-label:first-of-type {
    display: none !important;
}

body.sidebar-mini .sidebar .sidebar-menu .section-label::after {
    content: attr(data-initial);
    font-size: 11px;
    font-weight: 800;
}

body.sidebar-mini .sidebar .sidebar-menu .section-label span {
    display: none !important;
}

body.sidebar-mini .sidebar .sidebar-menu .section-label i {
    display: none !important;
}

/* Sembunyikan brand text tapi tampilkan inisial */
body.sidebar-mini .sidebar .brand-text {
    display: flex !important;
}

body.sidebar-mini .sidebar .brand-text span {
    font-size: 0 !important;
}

body.sidebar-mini .sidebar .brand-text span::after {
    content: attr(data-initial);
    font-size: 16px !important;
    font-weight: 800;
    visibility: visible;
}

body.sidebar-mini .sidebar > div:first-of-type {
    justify-content: center !important;
    padding: 16px 0 !important;
    gap: 0 !important;
}

/* Inisial Menu Item */
.menu-initial {
    display: none;
}

body.sidebar-mini .sidebar .menu-item .menu-initial {
    display: block;
    font-size: 9px;
    font-weight: 700;
    color: rgba(255,255,255,0.8);
    text-transform: uppercase;
}

/* Sembunyikan teks user profile */
body.sidebar-mini .sidebar .user-profile-mini > div:last-child {
    display: none !important;
}

body.sidebar-mini .sidebar .user-profile-mini {
    justify-content: center !important;
    padding: 12px 0 !important;
    gap: 0 !important;
    border-bottom: 1px solid var(--sb-border) !important;
}

/* Kompakkan nav padding */
body.sidebar-mini .sidebar .sidebar-menu {
    padding: 4px 6px 24px;
}

/* Tooltip saat hover */
body.sidebar-mini .sidebar .menu-item[data-tooltip]::after {
    content: attr(data-tooltip);
    position: fixed;
    left: 60px;
    background: #1e3a5f;
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.sidebar-mini .sidebar .menu-item[data-tooltip]:hover::after {
    opacity: 1;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 265px;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}