:root {
    /* Dark Theme (Default) */
    --bg-color: #0F172A;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --accent-primary: #818CF8;
    --accent-secondary: #C084FC;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --input-bg: rgba(15, 23, 42, 0.6);
    --danger: #EF4444;
    --success: #10B981;

    --font-main: 'Outfit', sans-serif;
}

body.light-mode {
    --bg-color: #F8FAFC;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --accent-primary: #6366F1;
    --accent-secondary: #A855F7;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(0, 0, 0, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    --input-bg: rgba(255, 255, 255, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    /* Hide scrollbar for cleaner look */
    scrollbar-width: none;
}

body::-webkit-scrollbar {
    display: none;
}

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

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite ease-in-out;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent-primary), transparent);
    top: -50px;
    left: -50px;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-secondary), transparent);
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, #4F46E5, transparent);
    top: 40%;
    left: 60%;
    animation-delay: -10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* --- Layout --- */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* --- Header --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-top: 10px;
}

.app-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.current-date {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 400;
}

.icon-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* --- Schedule --- */
.schedule-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.schedule-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.schedule-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

/* --- Date Navigation --- */
.date-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.nav-btn:active {
    transform: scale(0.95);
}

.date-selector {
    position: relative;
    flex: 1;
    max-width: 200px;
}

.date-display {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(129, 140, 248, 0.3);
}

.date-display:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(129, 140, 248, 0.5);
}

.hidden-date-input {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.today-btn {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
    padding: 10px 16px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.today-btn:hover {
    background: rgba(16, 185, 129, 0.25);
    transform: translateY(-2px);
}

.today-btn.active {
    background: var(--success);
    color: white;
}

/* Date badge for future/past indication */
.date-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 10px;
}

.date-badge.future {
    background: rgba(129, 140, 248, 0.15);
    color: var(--accent-primary);
}

.date-badge.past {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
}

.date-badge.today {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

@media (max-width: 480px) {
    .date-navigation {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px;
    }

    .date-selector {
        order: -1;
        flex: 100%;
        max-width: none;
    }

    .today-btn {
        flex: 1;
    }
}

.progress-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    width: 0%;
    /* Updates via JS */
    transition: width 0.5s ease;
}

/* --- Task List --- */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 100px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    background: var(--glass-bg);
    border-radius: 20px;
    border: 1px dashed var(--glass-border);
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.empty-state .sub-text {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Task Card */
.task-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.task-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

.task-time-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding-right: 16px;
}

.task-time {
    font-weight: 600;
    font-size: 1rem;
}

.task-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.task-content {
    flex: 1;
}

.task-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.task-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.task-actions {
    display: flex;
    gap: 8px;
    /* Always show on mobile, hover on desktop */
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
}

.task-card:hover .task-actions {
    opacity: 1;
    transform: translateX(0);
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: color 0.2s;
}

.action-btn.delete:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.action-btn.complete:hover {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

/* Completed State */
.task-card.completed {
    opacity: 0.6;
    border-color: transparent;
}

.task-card.completed .task-title {
    text-decoration: line-through;
}

.task-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--accent-primary);
    opacity: 0.8;
}

.task-card.completed::before {
    background: var(--success);
}

/* --- FAB --- */
.fab-add {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(129, 140, 248, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 100;
}

.fab-add:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 15px 35px rgba(129, 140, 248, 0.8);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    background: var(--bg-color);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    transform: translateY(20px);
    transition: transform 0.3s ease, background-color 0.3s;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

input,
textarea {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, background-color 0.3s, color 0.3s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

textarea {
    resize: vertical;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 10px;
    transition: transform 0.2s;
}

.submit-btn:hover {
    transform: scale(0.98);
}

/* --- Mobile Fixes --- */
@media (max-width: 480px) {
    .app-title {
        font-size: 1.5rem;
    }

    .task-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .task-time-col {
        flex-direction: row;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-bottom: 8px;
        justify-content: space-between;
        padding-right: 0;
    }

    .task-actions {
        opacity: 1;
        transform: none;
        width: 100%;
        justify-content: flex-end;
        margin-top: 8px;
    }
}

.task-emoji {
    font-size: 1.5rem;
    margin-right: 12px;
    background: rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

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

.congrats-container {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 16px;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

.congrats-emoji {
    font-size: 3rem;
    margin-bottom: 8px;
    display: inline-block;
    animation: bounce 1s infinite alternate;
}

.congrats-container h3 {
    margin: 5px 0;
    color: var(--success);
}

.congrats-container p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-10px) scale(1.1);
    }
}