/* CFS - Layout (Sidebar, Topbar, Content) */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: width var(--transition-base);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 64px;
    flex-shrink: 0;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: var(--font-size-lg);
    flex-shrink: 0;
}

.sidebar-brand {
    color: white;
    font-weight: 700;
    font-size: var(--font-size-lg);
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-base) 0;
}

.nav-section {
    margin-bottom: var(--space-sm);
}

.nav-section-title {
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 600;
    white-space: nowrap;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 0.55rem var(--space-lg);
    color: var(--text-sidebar);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin: 1px 0;
    white-space: nowrap;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
    border-left-color: rgba(255, 255, 255, 0.2);
}

.nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    border-left-color: transparent;
    font-weight: 500;
}

.nav-item-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item-text {
    flex: 1;
}

.nav-item-badge {
    background: var(--color-danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
}

/* Main Area */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-base);
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-base);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.topbar-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.topbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    font-size: 1rem;
    position: relative;
}

.topbar-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.topbar-btn .badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--color-danger);
    border-radius: 50%;
    border: 2px solid var(--bg-topbar);
}

.lang-switch {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.lang-btn {
    padding: 0.3rem 0.6rem;
    border: none;
    background: transparent;
    font-size: var(--font-size-xs);
    font-weight: 600;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
    font-family: var(--font-family);
}

.lang-btn.active {
    background: var(--color-primary);
    color: var(--text-on-primary);
}

.theme-switch {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.theme-btn {
    padding: 0.35rem 0.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.theme-btn.active {
    background: var(--color-primary);
    color: var(--text-on-primary);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.3rem 0.75rem 0.3rem 0.3rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: relative;
}

.user-menu:hover {
    background: var(--bg-tertiary);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.user-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
    white-space: nowrap;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 200;
    animation: fadeIn var(--transition-fast);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.6rem var(--space-base);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-dropdown-item:hover {
    background: var(--bg-tertiary);
}

.user-dropdown-item.danger {
    color: var(--color-danger);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-xs) 0;
}

/* Content */
.content-area {
    flex: 1;
    padding: var(--space-xl);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    gap: var(--space-base);
    flex-wrap: wrap;
}

.page-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
}

.page-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: 2px;
}

.page-actions {
    display: flex;
    gap: var(--space-sm);
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: var(--space-xl);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-xl);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.auth-logo-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: var(--font-size-xl);
}

.auth-logo-text {
    font-size: var(--font-size-2xl);
    font-weight: 700;
}

.auth-title {
    text-align: center;
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-xs);
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-xl);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-lg);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--color-primary);
    font-weight: 500;
}

/* Notification Panel */
.notification-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 360px;
    max-height: 480px;
    overflow-y: auto;
    z-index: 200;
    animation: fadeIn var(--transition-fast);
}

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-base) var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.notification-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-base) var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.notification-item:hover {
    background: var(--bg-tertiary);
}

.notification-item.unread {
    background: var(--color-primary-light);
}