/* Layout CSS - Grid, Sidebar, Topbar */

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
    /* For mobile overlay */
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform var(--transition-smooth);
    z-index: 50;
}

.sidebar-header {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
    color: #fff;
    justify-content: space-between;
}


.sidebar-nav {
    flex: 1;
    padding: var(--space-md) var(--space-sm);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Nav Section Headers */
.nav-section-label {
    padding: var(--space-md) var(--space-md) var(--space-xs);
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-sidebar-muted);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-sidebar-muted);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-item.active {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.nav-icon {
    font-size: 24px;
}

/* Updated Sidebar Footer for Icon Layout */
.sidebar-footer {
    padding: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.sidebar-footer-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-sidebar-muted);
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.sidebar-footer-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-2px);
}

.sidebar-footer-btn.profile {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.sidebar-footer-btn.logout:hover {
    background-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}


/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-body);
    width: 100%;
    /* For mobile */
}

.topbar {
    height: 64px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.menu-toggle {
    display: none;
    /* Desktop default */
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.content-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xl);
}

.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: 80%;
        max-width: 300px;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .menu-toggle {
        display: block;
    }

    .topbar {
        padding: 0 var(--space-md);
    }

    .topbar-title {
        font-size: 1rem;
    }

    .content-scrollable {
        padding: var(--space-md);
    }

    /* Hide text labels on narrow screens in topbar actions if plenty */
    .topbar-actions .btn span:not(.material-symbols-outlined) {
        display: none;
    }

    .topbar-actions .btn {
        padding: 8px;
        /* Icon only style mostly */
    }

    /* Bring back text for critical buttons if needed or rely on icons */
    .topbar-actions .btn-primary span:not(.material-symbols-outlined) {
        display: inline;
        /* Keep New Plan text if possible */
    }
}

/* LOGIN PAGE PREMIUM STYLE - DARK VERSION */
body.login-page {
    /* Głębokie tło */
    background-color: #0f172a;
    /* Slate 900 */
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(160, 60%, 40%, 1) 0, transparent 50%);
    /* Greenish for finance money */
    background-size: 150% 150%;
    animation: gradientMove 15s ease infinite alternate;
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

body.login-page .app-container {
    background: transparent;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100%;
}

body.login-page .card {
    background: rgba(255, 255, 255, 0.95);
    /* Lekka przezroczystość */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    color: #1e293b;
    width: 100%;
    max-width: 400px;
}

body.login-page .card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: transparent;
}

body.login-page .card-title {
    text-align: center;
    width: 100%;
    color: #1e293b;
    font-size: 1.5rem;
}

body.login-page .btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    /* Indigo to Cyan */
    border: none;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 12px;
}

body.login-page .btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}