@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ==========================================================================
   ZenFinance Core Design System & Theme Variable Declarations
   ========================================================================== */
:root {
    /* Color Palette */
    --bg-primary: #080b11;
    --bg-secondary: #0f131e;
    --bg-card: rgba(17, 22, 34, 0.65);
    --bg-card-hover: rgba(25, 32, 48, 0.8);
    --bg-nav: rgba(11, 15, 25, 0.85);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-active: rgba(99, 102, 241, 0.4);
    
    /* Accents & States */
    --accent-indigo: #6366f1;
    --accent-cyan: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
    --accent-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #0891b2 100%);
    
    --color-success: #10b981;
    --color-success-bg: rgba(16, 185, 129, 0.12);
    --color-danger: #ef4444;
    --color-danger-bg: rgba(239, 68, 68, 0.12);
    --color-warning: #f59e0b;
    --color-warning-bg: rgba(245, 158, 11, 0.12);
    
    /* Typography & Text */
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Layout Dimensions */
    --sidebar-width: 260px;
    --border-radius-sm: 8px;
    --border-radius-md: 14px;
    --border-radius-lg: 20px;
    --box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Base Elements Reset & HTML Level Constraints
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    font-size: 15px;
}

/* Base custom scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    background: transparent;
    border: none;
    outline: none;
    color: inherit;
}

/* ==========================================================================
   Master App Structure & Grids
   ========================================================================== */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
}

/* 1. Sidebar Panel (Desktop Layout) */
.app-sidebar {
    width: var(--sidebar-width);
    height: 100%;
    background-color: var(--bg-nav);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    backdrop-filter: blur(20px);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: var(--accent-gradient);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.4);
}

.brand-name {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--border-radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.nav-item a:hover,
.nav-item.active a {
    color: var(--text-primary);
    background-color: var(--bg-card-hover);
}

.nav-item.active a {
    border-left: 3px solid var(--accent-indigo);
    background-color: rgba(99, 102, 241, 0.08);
}

.nav-icon {
    font-size: 1.2rem;
}

.user-profile-section {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--accent-indigo);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
}

.user-details {
    display: flex;
    flex-direction: column;
    max-width: 140px;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* 2. Main Work Viewport */
.app-main {
    flex-grow: 1;
    height: 100%;
    overflow-y: auto;
    padding: 2.5rem;
    padding-bottom: 6rem; /* extra space to account for mobile navigation */
}

/* 3. Floating Bottom Nav (Shown only on Mobile) */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    right: 1.25rem;
    height: 64px;
    background-color: var(--bg-nav);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    z-index: 100;
    backdrop-filter: blur(24px);
    box-shadow: var(--box-shadow);
    justify-content: space-around;
    align-items: center;
    padding: 0 0.5rem;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    gap: 0.2rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.mobile-nav-item.active {
    color: var(--accent-cyan);
}

.mobile-nav-icon {
    font-size: 1.35rem;
}

/* ==========================================================================
   Overlay Dialog Panels (Native HTML5 Modals)
   ========================================================================== */
dialog {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    max-width: 480px;
    width: 90%;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(20px);
}

dialog[open] {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

dialog::backdrop {
    background-color: rgba(4, 6, 10, 0.75);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

dialog[open]::backdrop {
    opacity: 1;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.dialog-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.dialog-close-btn {
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.dialog-close-btn:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* ==========================================================================
   Global Screen Responsiveness Settings
   ========================================================================== */
@media (max-width: 991px) {
    .app-sidebar {
        display: none;
    }
    
    .mobile-nav {
        display: flex;
    }
    
    .app-main {
        padding: 1.5rem;
        padding-bottom: 7rem;
    }
}
