:root {
    --bg-color: #f0f4f8;
    /* Fallback */
    --card-bg: rgba(255, 255, 255, 0.65);
    --card-border: rgba(255, 255, 255, 0.4);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-color: #38bdf8;
    --accent-gradient: linear-gradient(135deg, #38bdf8, #818cf8, #c084fc);
    --accent-glow: rgba(56, 189, 248, 0.5);
    --border-radius: 24px;
    --font-family: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Light mode gradient */
    --gradient-1: hsla(28, 100%, 74%, 1);
    --gradient-2: hsla(189, 100%, 56%, 1);
    --gradient-3: hsla(340, 100%, 76%, 1);
    --gradient-4: hsla(240, 100%, 70%, 1);
    --gradient-5: hsla(22, 100%, 77%, 1);
    --gradient-6: hsla(242, 100%, 70%, 1);
    --gradient-7: hsla(343, 100%, 76%, 1);
    --bg-base: #e0e7ff;
}

/* Dark mode variables */
body.dark-mode {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(51, 65, 85, 0.6);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    --accent-gradient: linear-gradient(135deg, #38bdf8, #818cf8, #c084fc);
    --accent-glow: rgba(56, 189, 248, 0.4);

    /* Dark mode gradient */
    --gradient-1: hsla(220, 60%, 20%, 1);
    --gradient-2: hsla(240, 65%, 25%, 1);
    --gradient-3: hsla(260, 50%, 20%, 1);
    --gradient-4: hsla(280, 55%, 25%, 1);
    --gradient-5: hsla(200, 60%, 20%, 1);
    --gradient-6: hsla(220, 65%, 25%, 1);
    --gradient-7: hsla(240, 50%, 20%, 1);
    --bg-base: #1e293b;
}

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

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0;

    /* Animated Mesh Gradient Background */
    background-color: var(--bg-base);
    background-image:
        radial-gradient(at 40% 20%, var(--gradient-1) 0px, transparent 50%),
        radial-gradient(at 80% 0%, var(--gradient-2) 0px, transparent 50%),
        radial-gradient(at 0% 50%, var(--gradient-3) 0px, transparent 50%),
        radial-gradient(at 80% 50%, var(--gradient-4) 0px, transparent 50%),
        radial-gradient(at 0% 100%, var(--gradient-5) 0px, transparent 50%),
        radial-gradient(at 80% 100%, var(--gradient-6) 0px, transparent 50%),
        radial-gradient(at 0% 0%, var(--gradient-7) 0px, transparent 50%);
    background-size: 200% 200%;
    animation: meshGradient 20s ease infinite alternate;
    will-change: background-position;
    transition: background-color 0.3s ease;
}

@keyframes meshGradient {
    0% {
        background-position: 0% 0%;
    }

    100% {
        background-position: 100% 100%;
    }
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    width: 100%;
    position: relative;
    background: transparent;
    z-index: 10;
}

.date-container {
    flex: 1;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.clock-container {
    flex: 1;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.05em;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.weather-container {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
    flex-wrap: wrap;
    min-width: 0;
}

/* Theme Toggle Button */
.theme-toggle {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    margin-right: 12px;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

body.dark-mode .theme-toggle {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(51, 65, 85, 0.8);
}

.location-text {
    margin-right: 8px;
    color: var(--text-primary);
    font-weight: 500;
    opacity: 0.8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
    padding: 20px 40px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    align-items: start;
    z-index: 1;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Main Column */
.main-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Insights Column */
.insights-column {
    display: flex;
    flex-direction: column;
    padding-top: 36px;
}

/* Header & Progress */
header {
    width: 100%;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar-bg {
    flex: 1;
    height: 16px;
    /* Slightly thicker */
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    background-size: 200% 100%;
    width: 0%;
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 15px var(--accent-glow);
    animation: liquidFlow 3s linear infinite;
}

@keyframes liquidFlow {
    0% {
        background-position: 100% 0%;
    }

    100% {
        background-position: -100% 0%;
    }
}

.progress-text {
    font-weight: 800;
    font-size: 0.875rem;
    color: var(--text-primary);
    min-width: 40px;
    text-align: right;
}

/* Glass Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--card-border);
    width: 100%;
    padding: 32px;
    border-radius: var(--border-radius);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.02),
        0 2px 4px -1px rgba(0, 0, 0, 0.02),
        0 20px 40px -10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 40px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.05),
        0 4px 6px -2px rgba(0, 0, 0, 0.025),
        0 25px 50px -12px rgba(0, 0, 0, 0.1);
    will-change: transform, box-shadow;
}

.main-column .card {
    min-height: 500px;
}

.insights-card {
    padding: 24px;
    gap: 24px;
    min-height: 300px;
}

/* Focus Area */
.focus-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 20px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.5s ease;
}

.focus-area .label {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #6366f1;
    /* Indigo for pop */
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.focus-area h2 {
    font-size: 2.5rem;
    /* Larger */
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    letter-spacing: -0.02em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body.dark-mode .focus-area h2 {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.task-row {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.task-timer {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
    white-space: nowrap;
    display: none;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Liquid Button */
.primary-btn {
    background: var(--accent-gradient);
    background-size: 200% 200%;
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 99px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy */
    box-shadow: 0 10px 20px -5px var(--accent-glow);
    min-width: 160px;
    position: relative;
    overflow: hidden;
    animation: liquidFlow 4s ease infinite;
    will-change: transform, box-shadow;
}

.primary-btn:hover:not(:disabled) {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 15px 30px -5px var(--accent-glow);
    filter: brightness(1.1);
}

.primary-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.primary-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
    color: #94a3b8;
    animation: none;
}

/* Queue Area */
.queue-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.queue-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.text-btn {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
}

body.dark-mode .text-btn {
    background: rgba(51, 65, 85, 0.6);
    border-color: rgba(71, 85, 105, 0.5);
    color: var(--text-secondary);
}

.text-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}


.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.task-list::-webkit-scrollbar {
    width: 4px;
}

.task-list::-webkit-scrollbar-track {
    background: transparent;
}

.task-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    will-change: transform, opacity;
    gap: 12px;
}

.task-item>span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dark-mode .task-item {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(51, 65, 85, 0.7);
}

.task-item:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: translateX(4px);
}

.task-item.completed {
    text-decoration: line-through;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.2);
    border-color: transparent;
}

.task-item.active {
    border-color: #818cf8;
    background: rgba(129, 140, 248, 0.1);
    box-shadow: 0 4px 12px rgba(129, 140, 248, 0.15);
}

/* Add Task Input */
.add-task-container {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.add-task-container input {
    flex: 1;
    padding: 14px 20px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.5);
    font-family: var(--font-family);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.add-task-container input:focus {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    border: none;
    background: white;
    color: var(--accent-color);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.icon-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    color: #818cf8;
}

/* Insights Styles */
.insights-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stats-row {
    display: flex;
    gap: 20px;
}

.stat-item {
    flex: 1;
    background: rgba(255, 255, 255, 0.7);
    padding: 18px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.dark-mode .stat-item {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(51, 65, 85, 0.8);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

body.dark-mode .stat-label {
    color: #94a3b8;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 900;
    color: #1e293b;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    letter-spacing: -0.02em;
}

body.dark-mode .stat-value {
    color: #f1f5f9;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.chart-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.chart-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.chart-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 100px;
}

.empty-chart-msg {
    font-size: 0.875rem;
    color: #94a3b8;
    text-align: center;
    margin-top: 20px;
    font-style: italic;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
}

.bar-label {
    width: 80px;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
    font-weight: 500;
}

.bar-track {
    flex: 1;
    height: 24px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    background-size: 200% 100%;
    border-radius: 8px;
    min-width: 6px;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: liquidFlow 3s linear infinite;
}

.bar-value {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

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

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

/* Confetti */
.confetti {
    position: fixed;
    width: 8px;
    height: 8px;
    background-color: var(--accent-color);
    border-radius: 2px;
    pointer-events: none;
    z-index: 9999;
    animation: confetti-fall 1s ease-out forwards;
    will-change: transform, opacity;
}

@keyframes confetti-fall {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) rotate(var(--r));
        opacity: 0;
    }
}

/* Task Clearing Animation */
.task-item.clearing {
    transform: scale(0.9) translateX(-20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}



/* Mobile Responsiveness */
@media (max-width: 600px) {
    .top-bar {
        padding: 16px 20px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .clock-container {
        order: 1;
        flex-basis: 100%;
        margin-bottom: 10px;
    }

    .date-container,
    .weather-container {
        order: 2;
        flex: 1;
        font-size: 0.9rem;
    }

    .dashboard-grid {
        padding: 16px 20px;
        gap: 16px;
    }

    .card {
        padding: 24px;
    }

    .focus-area h2 {
        font-size: 2rem;
    }
}

/* Utility */
.hidden {
    display: none !important;
}

/* Start Session Styles */
.start-session-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.active-task-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}



.pulse-btn {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(56, 189, 248, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
    }
}

/* Countdown Overlay */
.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.countdown-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.countdown-number {
    font-size: 15rem;
    font-weight: 900;
    color: var(--accent-color);
    text-shadow: 0 10px 30px rgba(56, 189, 248, 0.5);
    animation: countdownPop 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    will-change: transform, opacity;
}

@keyframes countdownPop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0;
    }
}