/* ============================================= */
/* SafetyTraining - Layout Styles               */
/* Sidebar, Navigation, Main Content, Drawer    */
/* ============================================= */

/* ==================== */
/* App Layout Container */
/* ==================== */
.app-layout {
    min-height: 100vh;
    display: flex;
}

/* ==================== */
/* Sidebar              */
/* ==================== */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--gray-900) 0%, var(--bg-dark-secondary) 100%);
    color: var(--text-inverse);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: var(--z-sticky);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border-dark);
}

/* ==================== */
/* Brand                */
/* ==================== */
.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-inverse);
}

.brand-icon {
    font-size: 1.5rem;
}

.brand-text {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-inverse);
}

/* ==================== */
/* Sidebar Navigation   */
/* ==================== */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all var(--transition-normal);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-inverse);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-inverse);
    border-left-color: var(--primary-light);
}

.nav-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.nav-text {
    white-space: nowrap;
}

.nav-section {
    padding: 1.5rem 1rem 0.5rem;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
}

/* ==================== */
/* Sidebar Footer       */
/* ==================== */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-dark);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-inverse);
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-inverse);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition-normal);
    text-decoration: none;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.8);
    color: var(--text-inverse);
}

/* ==================== */
/* Main Content Wrapper */
/* ==================== */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 2rem;
    background: var(--bg-primary);
}

/* ==================== */
/* App Footer           */
/* ==================== */
.app-footer {
    padding: 1rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
}

/* ==================== */
/* Page Container       */
/* ==================== */
.page-container {
    padding: 0.375rem;
    height: calc(100vh - 48px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ==================== */
/* MudBlazor AppBar     */
/* ==================== */
::deep .modern-appbar {
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--bg-dark-secondary) 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

::deep .modern-appbar .mud-toolbar {
    overflow: visible;
}

::deep .modern-appbar .brand-text {
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* User Menu Button */
::deep .user-menu-btn {
    background: rgba(255, 255, 255, 0.08) !important;
    border-radius: 24px !important;
    padding: 4px 12px 4px 6px !important;
    text-transform: none !important;
    transition: background var(--transition-normal);
}

::deep .user-menu-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

.user-name-text {
    color: var(--text-inverse) !important;
    font-weight: 500;
    font-size: 0.875rem;
}

.user-icon {
    color: var(--text-inverse) !important;
    opacity: 0.7;
}

/* ==================== */
/* MudBlazor Drawer     */
/* ==================== */
::deep .modern-drawer {
    background: linear-gradient(180deg, var(--bg-dark-secondary) 0%, var(--gray-900) 100%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

::deep .modern-drawer .mud-drawer-content {
    display: flex;
    flex-direction: column;
    background: transparent;
    height: 100%;
}

/* Drawer Profile Section */
.drawer-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem 1rem;
    text-align: center;
    flex-shrink: 0;
}

.profile-avatar {
    width: 64px !important;
    height: 64px !important;
    font-size: 1.5rem !important;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%) !important;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.4);
}

.profile-name {
    color: var(--gray-50);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.profile-role {
    font-size: 0.7rem !important;
    border-color: rgba(13, 148, 136, 0.5) !important;
    color: var(--primary-light) !important;
}

.divider-subtle {
    margin: 0.5rem 0;
    border-color: rgba(255, 255, 255, 0.05) !important;
}

/* Drawer Navigation */
::deep .modern-nav {
    padding: 0.5rem;
    margin-top: 0;
    flex-shrink: 0;
}

::deep .nav-section-title {
    color: var(--gray-500);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    padding: 0.75rem 1rem 0.5rem;
    margin-top: 0.25rem;
    text-transform: uppercase;
}

::deep .modern-nav .mud-nav-link {
    color: var(--gray-400);
    border-radius: var(--radius-md);
    margin: 2px 0;
    padding: 0.625rem 1rem;
    transition: all var(--transition-normal);
    font-weight: 500;
}

::deep .modern-nav .mud-nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--gray-100);
}

::deep .modern-nav .mud-nav-link.active {
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.15) 0%, rgba(13, 148, 136, 0.08) 100%);
    color: var(--primary-light);
    font-weight: 600;
}

::deep .modern-nav .mud-nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary-light);
    border-radius: 0 3px 3px 0;
}

::deep .modern-nav .mud-nav-link .mud-icon-root {
    color: inherit;
    opacity: 0.8;
}

/* Drawer Footer */
.drawer-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    overflow: hidden;
}

.drawer-legal-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-top: 8px;
}

::deep .logout-btn {
    opacity: 0.8;
    transition: opacity var(--transition-normal);
}

::deep .logout-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

/* Main Content Area */
::deep .modern-main-content {
    background: var(--bg-primary);
    min-height: 100vh;
}

/* ==================== */
/* Responsive Layout    */
/* ==================== */
@media (max-width: 1279.98px) {
    .page-container {
        padding: 0.375rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }

    .sidebar .brand-text,
    .sidebar .nav-text,
    .sidebar .nav-section-title,
    .sidebar .user-details,
    .sidebar .logout-btn span {
        display: none;
    }

    .main-wrapper {
        margin-left: 70px;
    }

    .main-content {
        padding: 1rem;
    }
}
