﻿/* =========================================================
   SteelFlow Enterprise Sidebar
   Ready to replace existing CSS
========================================================= */

/* ===== Layout ===== */

.sf-shell {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.sf-header {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.sf-main {
    flex: 1;
    display: flex;
    min-height: 0;
}

.sf-content {
    flex: 1;
    padding: 20px;
    background: #f8fafc;
    overflow: auto;
}


/* =========================================================
   Sidebar
========================================================= */

.sf-sidebar {
    width: 260px;
    background: #eef2f7;
    border-right: 1px solid #dbe3ec;
    position: relative;
    transition: width .25s ease, left .25s ease;
    z-index: 100;
}

.sf-sidebar-scroll {
    height: 100%;
    overflow: auto;
    padding: 12px 10px;
}


/* =========================================================
   Remove UL bullet
========================================================= */

.sf-menu,
.sf-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
}


/* =========================================================
   Collapse mode
========================================================= */

.sf-sidebar.is-collapsed {
    width: 76px;
}

    .sf-sidebar.is-collapsed .sf-text,
    .sf-sidebar.is-collapsed .sf-menu-header,
    .sf-sidebar.is-collapsed .sf-group-title,
    .sf-sidebar.is-collapsed .sf-caret,
    .sf-sidebar.is-collapsed .sf-sidebar-footer {
        display: none;
    }

    .sf-sidebar.is-collapsed .sf-link {
        justify-content: center;
    }

    .sf-sidebar.is-collapsed .sf-icon {
        margin: 0;
    }


/* =========================================================
   Menu Header
========================================================= */

.sf-menu-header {
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 14px 12px 6px;
    font-weight: 700;
}


/* =========================================================
   Menu Item
========================================================= */

.sf-item {
    margin: 2px 0;
}


/* =========================================================
   Link Style
========================================================= */

.sf-link {
    width: 100%;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #1e293b;
    font-size: 14px;
    transition: background .15s ease, transform .05s ease;
}

    .sf-link:hover {
        background: #e8f0ff;
        color: #1e40af;
    }

    .sf-link:active {
        transform: translateY(1px);
    }


/* =========================================================
   Icon alignment
========================================================= */

.sf-icon {
    width: 22px;
    display: inline-flex;
    justify-content: center;
}

    .sf-icon i {
        color: #64748b;
        font-size: 1.05rem;
    }


/* =========================================================
   Text
========================================================= */

.sf-text {
    font-weight: 600;
    font-size: .92rem;
}


/* =========================================================
   Active Menu
========================================================= */

.sf-item.active > .sf-link {
    background: linear-gradient( 135deg, #2563eb, #3b82f6 );
    color: #fff;
    box-shadow: 0 3px 12px rgba(37,99,235,.25);
}

    .sf-item.active > .sf-link .sf-icon i {
        color: #fff;
    }


/* =========================================================
   Submenu
========================================================= */

.sf-submenu {
    display: none; /* ปิดไว้ก่อน */
    padding-left: 22px;
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
}

/* ใช้คลาสที่เจาะจงมากขึ้น และใช้ display: block เพื่อความชัวร์ */
.sf-item.has-sub.expand > .sf-submenu {
    display: block !important; /* บังคับให้แสดง */
    max-height: 2000px !important; /* ให้ค่าสูงๆ ไว้ก่อน */
    visibility: visible !important;
    opacity: 1 !important;
}

.sf-item.expand > .sf-submenu {
    max-height: 700px;
    overflow: visible; /* ยอมให้เนื้อหาแสดงออกมาได้ */
    transition: max-height .3s ease-in-out;
    border: 1px solid red !important;
}

.sf-submenu .sf-link {
    padding: 8px 10px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
}


/* =========================================================
   Caret
========================================================= */

.sf-caret {
    margin-left: auto;
    color: #64748b;
    transition: transform .15s ease;
}

.sf-item.expand .sf-caret {
    transform: rotate(90deg);
}


/* =========================================================
   Group Title
========================================================= */

.sf-group-title {
    font-size: .75rem;
    color: #64748b;
    padding: 10px 10px 6px;
    font-weight: 800;
}


/* =========================================================
   Divider
========================================================= */

.sf-divider {
    height: 1px;
    background: #dbe3ec;
    margin: 10px 12px;
    border-radius: 2px;
}


/* =========================================================
   Badge
========================================================= */

.sf-badge {
    margin-left: auto;
    min-width: 28px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e40af;
}

    .sf-badge.pulse {
        animation: sfPulse 1.2s infinite;
    }

@keyframes sfPulse {

    0% {
        box-shadow: 0 0 0 0 rgba(37,99,235,.45);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(37,99,235,0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37,99,235,0);
    }
}


/* =========================================================
   Footer
========================================================= */

.sf-sidebar-footer {
    margin-top: 14px;
    padding: 10px;
}

.sf-footer-box {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px;
}


/* =========================================================
   Mobile Overlay
========================================================= */

.sf-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.35);
    border: 0;
    z-index: 1040;
}


/* =========================================================
   Mobile Sidebar
========================================================= */

@media (max-width: 768px) {

    .sf-sidebar {
        position: fixed;
        top: 60px;
        bottom: 0;
        left: -260px;
        z-index: 1041;
        box-shadow: 0 10px 30px rgba(0,0,0,.18);
    }

        .sf-sidebar.is-mobile-open {
            left: 0;
        }
}
