/* ===== LAYOUT ===== */

/* Auth pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0F172A 0%, #1E3A8A 50%, #1E40AF 100%);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
    top: -200px;
    right: -200px;
}

.auth-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(30, 64, 175, 0.25) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
}

.auth-card {
    background: rgba(255, 255, 255, 0.97);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
    gap: 0.5rem;
}

.auth-logo .logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 8px 24px rgba(30, 64, 175, 0.35);
}

.auth-logo h1 {
    font-size: 1.2rem;
    color: var(--text-primary);
    text-align: center;
}

.auth-logo p {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

.auth-divider {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 1.5rem 0;
    position: relative;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border);
}

.auth-divider::before {
    left: 0;
}

.auth-divider::after {
    right: 0;
}

/* ===== APP SHELL ===== */
#app {
    display: none;
    min-height: 100vh;
}

#app.visible {
    display: flex;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: var(--transition-slow);
    overflow: hidden;
}

.sidebar-brand {
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sidebar-brand .brand-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.sidebar-brand .brand-text {
    flex: 1;
    overflow: hidden;
}

.sidebar-brand .brand-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--white);
    white-space: nowrap;
    line-height: 1.2;
}

.sidebar-brand .brand-sub {
    font-size: 0.68rem;
    color: var(--sidebar-text);
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-section-label {
    padding: 0.5rem 1.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.5);
    margin-top: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    margin: 0.1rem 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    width: calc(100% - 1rem);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-accent);
    font-weight: 600;
}

.nav-item.active .nav-icon {
    color: var(--sidebar-accent);
}

.nav-icon {
    font-size: 1rem;
    width: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-text {
    flex: 1;
}

.nav-badge {
    background: var(--danger);
    color: white;
    font-size: 0.62rem;
    font-weight: 700;
    border-radius: 99px;
    padding: 0.1rem 0.45rem;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.75rem 0.5rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-user:hover {
    background: var(--sidebar-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
}

.user-role {
    font-size: 0.67rem;
    color: var(--sidebar-text);
    white-space: nowrap;
}

/* Header */
.main-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: var(--header-h);
    background: var(--surface-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 100;
    gap: 1rem;
    transition: var(--transition-slow);
}

.header-hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.header-hamburger:hover {
    background: var(--surface);
}

.header-breadcrumb {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    overflow: hidden;
}

.breadcrumb-sep {
    margin: 0 0.1rem;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-card);
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.header-btn:hover {
    background: var(--surface);
    color: var(--primary);
}

.notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
}

.header-profile:hover {
    background: var(--surface);
}

.header-profile .user-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.65rem;
}

.header-profile-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-w);
    margin-top: var(--header-h);
    min-height: calc(100vh - var(--header-h));
    padding: 1.75rem;
    transition: var(--transition-slow);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.visible {
    display: block;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-header {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 1.25rem;
    }

    .header-hamburger {
        display: flex;
    }
}

@media (max-width: 640px) {
    .main-content {
        padding: 1rem;
    }

    .main-header {
        padding: 0 1rem;
    }
}