:root {
    --bg-dark: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;

    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    --accent-primary: #6366f1;
    /* Indigo */
    --accent-glow: rgba(99, 102, 241, 0.4);

    --font-family: 'Cairo', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Dynamic Background Globes */
.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
}

.globe-1 {
    width: 300px;
    height: 300px;
    background: #4f46e5;
    top: -50px;
    left: -50px;
}

.globe-2 {
    width: 400px;
    height: 400px;
    background: #c026d3;
    bottom: -100px;
    right: -100px;
}

.globe-3 {
    width: 200px;
    height: 200px;
    background: #06b6d4;
    top: 40%;
    left: 40%;
    opacity: 0.4;
}

/* Layout & Sidebar */
.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    /* Sidebar + Content */
    gap: 20px;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 40px;
    flex-grow: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
    text-align: right;
    font-family: var(--font-main);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.nav-btn i {
    width: 25px;
    text-align: center;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
    /* Space for scrollbar */
    position: relative;
}

.content-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
}

/* Glass Utility Class */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    color: var(--accent-primary);
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: var(--accent-primary);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Bento Grid Layout */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto 1fr;
    gap: 20px;
    flex: 1;
}

/* Widget Styles */
.widget {
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.widget-header h3 {
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.add-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.2s;
}

.add-btn:hover {
    color: var(--text-primary);
}

/* Specific Widget Sizing */
.widget-focus {
    grid-column: span 1;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.widget-brain {
    grid-column: span 2;
}

.widget-tasks {
    grid-column: span 2;
    grid-row: span 2;
    overflow-y: auto;
}

.widget-finance {
    grid-column: span 1;
    grid-row: span 2;
    overflow-y: auto;
}

/* Timer styles */
.timer-display {
    font-size: 3.5rem;
    font-weight: 700;
    margin: 10px 0;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
}

/* Brain Dump Textarea */
#brainDumpArea {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: 10px;
    padding: 15px;
    color: var(--text-primary);
    font-family: inherit;
    resize: none;
    outline: none;
    font-size: 1rem;
    line-height: 1.5;
}

#brainDumpArea::placeholder {
    color: rgba(148, 163, 184, 0.4);
}

/* Task List */
.task-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 3px solid var(--accent-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
}

.task-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

/* Task Tags */
.task-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-inline-end: 8px;
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .bento-grid {
        display: flex;
        flex-direction: column;
    }

    .widget-tasks,
    .widget-brain,
    .widget-finance,
    .widget-focus {
        grid-column: span 1;
        min-height: 300px;
    }

    .app-container {
        height: auto;
    }
}

/* Login Overlay */
#loginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(15px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}

#loginOverlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    background: rgba(30, 41, 59, 0.6);
    padding: 3rem;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.login-card h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    background: white;
    color: #333;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.google-btn:hover {
    transform: scale(1.02);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
}

.login-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}

.login-input:focus {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.1);
}

/* --- Mobile Responsive (Bottom Navigation) --- */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column-reverse;
        /* Nav at bottom, content on top */
        height: 100vh;
        gap: 0;
        padding: 0;
    }

    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        padding: 10px 20px;
        align-items: center;
        background: rgba(15, 23, 42, 0.95);
        /* Solid background for legibility */
        backdrop-filter: blur(20px);
        border-radius: 20px 20px 0 0;
        z-index: 1000;
        border: 1px solid var(--glass-border);
        border-bottom: none;
    }

    .logo,
    .sidebar-footer {
        display: none;
        /* Hide logo and profile on mobile nav to save space */
    }

    .nav-menu {
        flex-direction: row;
        margin-top: 0;
        justify-content: space-around;
        width: 100%;
    }

    .nav-btn {
        flex-direction: column;
        gap: 5px;
        padding: 8px;
        font-size: 0.8rem;
        border-radius: 10px;
        text-align: center;
    }

    .nav-btn i {
        font-size: 1.2rem;
        margin-bottom: 2px;
    }

    .main-content {
        padding: 20px;
        padding-bottom: 100px;
        /* Space for bottom nav */
    }

    .bento-grid {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    /* Widget adjustments for mobile */
    .widget-focus,
    .widget-brain,
    .widget-today,
    .widget-tasks,
    .widget-finance {
        grid-column: span 1;
    }

    .login-card {
        width: 95%;
        padding: 2rem 1rem;
    }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #1e293b;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    position: relative;
    border: 1px solid var(--glass-border);
}

.close-modal {
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.close-modal:hover {
    color: var(--text-primary);
}

.hidden {
    display: none !important;
}