/* =====================================================
   SIDEBAR STYLES - Modern Dashboard Layout
   ===================================================== */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --sidebar-bg-start: #111827;
    /* Gray 900 */
    --sidebar-bg-end: #1f2937;
    /* Gray 800 */
    --header-height: 70px;
    --content-bg: #F3F4F6;
    --sidebar-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== App Container ==================== */
.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--content-bg);
}

/* ==================== Sidebar ==================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: all var(--sidebar-transition);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.sidebar-brand-text {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
    flex: 1;
}

.sidebar-brand-version {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.7;
    margin-top: 2px;
}

/* ==================== Sidebar Navigation ==================== */
.sidebar-nav {
    padding: 1.5rem 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav-item {
    margin: 0.25rem 0.75rem;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
    gap: 12px;
    position: relative;
}

.sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(3px);
}

.sidebar-nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 600;
}

.sidebar-nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: white;
    border-radius: 0 4px 4px 0;
}

.sidebar-nav-icon {
    font-size: 1.25rem;
    min-width: 24px;
    text-align: center;
}

.sidebar-nav-text {
    flex: 1;
}

/* Submenu */
.sidebar-submenu {
    padding-left: 2.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-nav-item.has-submenu.open .sidebar-submenu {
    max-height: 500px;
}

.sidebar-submenu-link {
    display: block;
    padding: 0.6rem 1rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    margin: 0.2rem 0;
}

.sidebar-submenu-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    padding-left: 1.2rem;
}

.sidebar-submenu-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    font-weight: 600;
}

/* Chevron for submenu */
.sidebar-nav-link.has-submenu-toggle::after {
    content: '›';
    font-size: 1.5rem;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.sidebar-nav-item.has-submenu.open .sidebar-nav-link.has-submenu-toggle::after {
    transform: rotate(90deg);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem 0.75rem 1.5rem;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-footer-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
    gap: 12px;
}

.sidebar-footer-link:hover {
    background: rgba(255, 0, 0, 0.2);
    color: white;
}

/* ==================== Main Content Area ==================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--sidebar-transition);
}

/* ==================== Top Header ==================== */
.top-header {
    background: white;
    height: var(--header-height);
    border-bottom: 1px solid #E5E7EB;
    position: sticky;
    top: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    gap: 2rem;
}

.header-search {
    flex: 1;
    max-width: 500px;
}

.header-search-input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: #F9FAFB;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

.header-search-input:focus {
    outline: none;
    border-color: var(--sidebar-bg-start);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: auto;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.header-user:hover {
    background: #F9FAFB;
}

.header-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sidebar-bg-start), var(--sidebar-bg-end));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.header-user-info {
    display: flex;
    flex-direction: column;
}

.header-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1F2937;
}

.header-user-role {
    font-size: 0.75rem;
    color: #6B7280;
}

/* ==================== Content Area ==================== */
.content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* ==================== Mobile Responsive ==================== */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .top-header {
        padding: 0 1rem;
    }

    .header-search {
        max-width: none;
    }

    .content-area {
        padding: 1rem;
    }

    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        background: transparent;
        cursor: pointer;
        color: #1F2937;
        margin-right: 1rem;
    }

    .mobile-menu-toggle span {
        font-size: 1.5rem;
    }
}

@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none;
    }
}

/* ==================== Sidebar Collapsed State (opcional) ==================== */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-nav-text,
.sidebar.collapsed .sidebar-brand-version {
    display: none;
}

.sidebar.collapsed+.main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-nav-link {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .sidebar-submenu {
    display: none;
}