/* style.css - Core Design System */
:root {
    /* Light Mode Tokens */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.1);
    --secondary: #10b981;
    --secondary-light: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    --bg-main: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --gradient: linear-gradient(135deg, #4f46e5, #8b5cf6);
    --gradient-warm: linear-gradient(135deg, #f59e0b, #ef4444);
    --gradient-cool: linear-gradient(135deg, #06b6d4, #10b981);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.12);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
}

[data-theme="dark"] {
    /* Dark Mode Tokens */
    --bg-main: #0f172a;
    --surface: #1e293b;
    --surface-2: #162032;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --border: #2d3f55;
    --gradient: linear-gradient(135deg, #6366f1, #a855f7);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
    --glass-bg: rgba(15, 23, 42, 0.85);
    --primary-light: rgba(99, 102, 241, 0.15);
    --secondary-light: rgba(16, 185, 129, 0.15);
    --danger-light: rgba(239, 68, 68, 0.15);
    --warning-light: rgba(245, 158, 11, 0.15);
}

[data-theme="dark"] #login-screen {
    background: radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0, transparent 50%),
                radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.05) 0, transparent 50%),
                radial-gradient(at 100% 100%, rgba(99, 102, 241, 0.1) 0, transparent 50%),
                radial-gradient(at 0% 100%, rgba(168, 85, 247, 0.05) 0, transparent 50%),
                #0f172a;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
}

.view {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.view.active {
    display: block;
    opacity: 1;
}

#app-screen.active {
    display: flex;
}

/* === Login Screen === */
#login-screen {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.15) 0, transparent 50%),
                radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.1) 0, transparent 50%),
                radial-gradient(at 100% 100%, rgba(79, 70, 229, 0.15) 0, transparent 50%),
                radial-gradient(at 0% 100%, rgba(16, 185, 129, 0.1) 0, transparent 50%),
                var(--bg-main);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

#login-screen::before {
    content: "";
    position: absolute;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%234f46e5' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
    animation: moveBackground 60s linear infinite;
    z-index: 0;
}

@keyframes moveBackground {
    from { transform: translate(0, 0); }
    to { transform: translate(-10%, -10%); }
}

.login-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 50px 40px;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 440px;
    text-align: center;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.4);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-header h1 {
    font-size: 28px;
    font-weight: 800;
    margin-top: 15px;
    letter-spacing: -1px;
    color: var(--text-primary);
}

.login-header p {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 35px;
    font-weight: 500;
}

.gradient-icon {
    font-size: 70px;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 5px 15px rgba(79, 70, 229, 0.2));
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 22px;
    transition: color 0.3s;
    z-index: 2;
}

.input-group input {
    width: 100%;
    padding: 16px 20px 16px 52px;
    border: 1.5px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
}

.input-group input:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    transform: translateY(-1px);
}

.input-group input:focus + i {
    color: var(--primary);
}

/* === Buttons === */
.btn-primary {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.25);
    font-family: inherit;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary.full-width {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    border-radius: 16px;
    margin-top: 10px;
}

.error-msg {
    color: var(--danger);
    font-size: 14px;
    margin-top: 20px;
    height: 20px;
    font-weight: 500;
    display: block;
    text-align: center;
}

/* === Layout === */
#app-screen {
    display: flex;
    height: 100vh;
}
.sidebar {
    display: flex;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 2000;
    transform: translateX(-100%);
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    flex-direction: column;
    padding: 24px 0;
    box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.sidebar.mobile-open {
    transform: translateX(0);
}
.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.sidebar-logo {
    padding: 0 20px 32px;
    font-size: 19px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
    letter-spacing: -0.5px;
}
.sidebar-logo i {
    font-size: 30px;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-nav {
    flex: 1;
    padding: 0 12px;
}
.nav-link {
    display: flex;
    align-items: center;
    padding: 13px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 14px;
    border-radius: 14px;
    margin-bottom: 4px;
}
.nav-link i {
    font-size: 20px;
    transition: transform 0.25s;
}
.nav-link:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
}
.nav-link:hover i {
    transform: translateX(2px);
}
.nav-link.active {
    background: rgba(79, 70, 229, 0.12);
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}
.sidebar-footer {
    padding: 20px;
}

.theme-btn, .logout-btn {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    transition: 0.2s;
    font-family: inherit;
    font-weight: 500;
}
.theme-btn:hover, .logout-btn:hover {
    background: var(--bg-main);
}
.logout-btn {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}
.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
    padding-bottom: 80px; /* space for bottom nav */
}

/* Header */
.top-header {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}
.top-header h2 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}
.icon-btn {
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.icon-btn:hover {
    background: rgba(79, 70, 229, 0.08);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}
.icon-btn:active {
    transform: scale(0.92);
}
.notifications-trigger::after {
    content: attr(data-badge);
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Content wrapper */
.content-wrapper {
    padding: 10px;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}
.app-view {
    display: none;
    animation: fadeIn 0.3s ease;
}
.app-view.active {
    display: block;
}

/* Stats Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 30px;
}
.glass-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    gap: 24px;
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    border-color: var(--primary);
}
.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    transition: all 0.3s;
}
.glass-card:hover .stat-icon {
    transform: scale(1.1) rotate(-5deg);
}
.stat-icon.income { background: rgba(16, 185, 129, 0.1); color: var(--secondary); box-shadow: 0 10px 20px rgba(16, 185, 129, 0.15); }
.stat-icon.users { background: rgba(79, 70, 229, 0.1); color: var(--primary); box-shadow: 0 10px 20px rgba(79, 70, 229, 0.15); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); box-shadow: 0 10px 20px rgba(245, 158, 11, 0.15); }

.stat-info h3 {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-info p {
    font-size: 26px;
    font-weight: 800;
    margin-top: 4px;
    letter-spacing: -1px;
    line-height: 1.1;
}
.stat-info .stat-delta {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
    opacity: 0.7;
}

/* Bottom Nav (Mobile) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 72px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -1px 0 var(--border), 0 -10px 30px rgba(0,0,0,0.06);
    z-index: 100;
    border-top: 1px solid var(--border);
    padding: 0 8px;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    width: 20%;
    padding: 8px 0;
    border-radius: 14px;
    gap: 3px;
}
.nav-item i {
    font-size: 23px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-item.active {
    color: var(--primary);
    background: rgba(79, 70, 229, 0.08);
}
.nav-item.active i {
    transform: translateY(-2px) scale(1.1);
}
.action-button {
    position: relative;
    top: -14px;
}
.floating-btn {
    width: 56px;
    height: 56px;
    background: var(--gradient);
    border-radius: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.45);
    margin-bottom: 4px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid var(--bg-main);
}
.action-button:hover .floating-btn {
    transform: scale(1.08) rotate(-5deg);
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.55);
}
.action-button i {
    color: white;
    font-size: 26px;
    margin: 0;
}

/* Animations */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Media Queries */
@media (min-width: 768px) {
    .bottom-nav { display: none; }
    .sidebar { 
        position: relative;
        transform: translateX(0) !important;
        box-shadow: none;
        width: 260px;
    }
    .sidebar-overlay { display: none !important; }
    .mobile-only { display: none !important; }
    .main-content { padding-bottom: 0; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .login-container { max-width: 450px; }
}
