/* ==================== Layout Structure ==================== */
body {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* ==================== Sidebar ==================== */
.sidebar {
    width: 240px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-image {
    height: 27px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

/* ==================== Search Box ==================== */
.sidebar-search {
    padding: 16px 20px;
}

.sidebar-search-input {
    width: 100%;
    padding: 10px 14px 10px 36px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.sidebar-search-input::placeholder {
    color: var(--text-muted);
}

.sidebar-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* ==================== Sidebar Navigation ==================== */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}

.nav-group {
    margin-bottom: 8px;
}

.nav-group-title {
    padding: 12px 12px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 2px 0;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
    opacity: 0.85;
}

.nav-text {
    flex: 1;
}

.nav-badge {
    padding: 2px 8px;
    background: var(--accent-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
}

/* ==================== Sidebar Footer ==================== */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.theme-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-size: 14px;
}

.theme-switch:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.theme-icon {
    font-size: 18px;
    opacity: 0.85;
}

/* ==================== Main Wrapper ==================== */
.main-wrapper {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ==================== Topbar ==================== */
.topbar {
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.menu-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.breadcrumb .separator {
    color: var(--border-color);
}

.breadcrumb .current {
    color: var(--text-primary);
    font-weight: 500;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Notification Button */
.notification-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    position: relative;
    transition: all 0.2s;
}

.notification-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    background: var(--accent-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
}

.user-btn:hover {
    background: var(--bg-tertiary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 600;
}

.user-name {
    font-weight: 500;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--bg-tertiary);
    color: var(--accent-red);
    border-color: var(--accent-red);
}

/* ==================== Main Content ==================== */
.main-content {
    flex: 1;
    background: var(--bg-primary);
    overflow: hidden;
}

.main-content iframe {
    width: 100%;
    height: calc(100vh - 60px);
    border: none;
}

/* ==================== Sidebar Collapsed State ==================== */
.sidebar-collapsed .sidebar {
    width: 72px;
}

.sidebar-collapsed .nav-text,
.sidebar-collapsed .nav-group-title,
.sidebar-collapsed .theme-text,
.sidebar-collapsed .nav-badge,
.sidebar-collapsed .sidebar-search {
    display: none;
}

.sidebar-collapsed .logo-image {
    height: 20px;
}

.sidebar-collapsed .sidebar-header {
    padding: 20px 18px;
    justify-content: center;
}

.sidebar-collapsed .logo {
    justify-content: center;
}

.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}

.sidebar-collapsed .nav-icon {
    font-size: 20px;
}

.sidebar-collapsed .theme-switch {
    justify-content: center;
}

.sidebar-collapsed .main-wrapper {
    margin-left: 72px;
}

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

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

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

    .sidebar-collapsed .sidebar {
        transform: translateX(0);
        width: 240px;
    }

    .user-name {
        display: none;
    }

    .logout-btn span {
        display: none;
    }
}
