/* ========================================
   FLOW — A Beautiful Todo Experience
   ======================================== */

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

:root {
    --bg-primary: #0a0a1a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #f0f0f5;
    --text-secondary: rgba(255, 255, 255, 0.5);
    --text-muted: rgba(255, 255, 255, 0.3);
    --accent: #7c5cfc;
    --accent-glow: rgba(124, 92, 252, 0.4);
    --accent-2: #00d4aa;
    --accent-3: #ff6b9d;
    --danger: #ff4757;
    --warning: #ffa502;
    --success: #2ed573;
    --glass: rgba(255, 255, 255, 0.02);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 60px rgba(124, 92, 252, 0.15);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-full: 100px;
    --transition: cubic-bezier(0.16, 1, 0.3, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== ANIMATED BACKGROUND ===== */

.bg-aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    filter: blur(120px) saturate(1.5);
    opacity: 0.6;
}

.aurora-blob {
    position: absolute;
    border-radius: 50%;
    animation: aurora 15s ease-in-out infinite alternate;
}

.aurora-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #7c5cfc 0%, transparent 70%);
    top: -20%;
    left: -10%;
    animation-delay: 0s;
    animation-duration: 18s;
}

.aurora-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #00d4aa 0%, transparent 70%);
    top: 40%;
    right: -15%;
    animation-delay: -5s;
    animation-duration: 22s;
}

.aurora-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #ff6b9d 0%, transparent 70%);
    bottom: -10%;
    left: 20%;
    animation-delay: -10s;
    animation-duration: 20s;
}

.aurora-4 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #4834d4 0%, transparent 70%);
    top: 20%;
    left: 50%;
    animation-delay: -7s;
    animation-duration: 25s;
}

@keyframes aurora {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    33% { transform: translate(80px, -60px) scale(1.2) rotate(120deg); }
    66% { transform: translate(-40px, 40px) scale(0.8) rotate(240deg); }
    100% { transform: translate(60px, 20px) scale(1.1) rotate(360deg); }
}

#particleCanvas {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ===== APP WRAPPER ===== */

.app-wrapper {
    position: relative;
    z-index: 10;
    max-width: 560px;
    margin: 0 auto;
    padding: 40px 20px 60px;
    animation: fadeInUp 0.8s var(--transition) both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== HEADER ===== */

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    animation: fadeInUp 0.8s var(--transition) 0.1s both;
}

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

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px var(--accent-glow);
    animation: iconPulse 3s ease-in-out infinite;
}

.brand-icon svg {
    width: 22px;
    height: 22px;
    color: white;
}

@keyframes iconPulse {
    0%, 100% { box-shadow: 0 4px 20px var(--accent-glow); }
    50% { box-shadow: 0 4px 35px rgba(124, 92, 252, 0.6); }
}

.brand h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.dot {
    color: var(--accent);
    font-size: 2.4rem;
}

.time-display {
    text-align: right;
}

.time-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.time-clock {
    font-family: 'Space Grotesk', monospace;
    font-size: 1.6rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

/* ===== STATS BAR ===== */

.stats-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    animation: fadeInUp 0.8s var(--transition) 0.2s both;
}

.stat {
    flex: 1;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    text-align: center;
    transition: all 0.4s var(--transition);
}

.stat:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.stat-number {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat:nth-child(2) .stat-number { color: var(--success); }
.stat:nth-child(3) .stat-number { color: var(--accent-3); }

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.progress-stat {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.progress-ring-container {
    position: relative;
    width: 50px;
    height: 50px;
}

.progress-ring {
    width: 50px;
    height: 50px;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 3;
}

.progress-ring-fill {
    fill: none;
    stroke: url(#progressGradient);
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 0.8s var(--transition);
    filter: drop-shadow(0 0 6px var(--accent-glow));
}

.progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
    font-family: 'Space Grotesk', sans-serif;
}

/* ===== INPUT ===== */

.input-container {
    margin-bottom: 20px;
    animation: fadeInUp 0.8s var(--transition) 0.3s both;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    transition: all 0.4s var(--transition);
    position: relative;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.15), var(--shadow-glow);
    background: rgba(255, 255, 255, 0.04);
}

.input-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.input-icon svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.input-wrapper:focus-within .input-icon svg {
    color: var(--accent);
}

#todoInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    padding: 12px 0;
    min-width: 0;
}

#todoInput::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.time-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    padding: 8px 10px;
    width: 110px;
    margin-right: 4px;
    outline: none;
    transition: all 0.3s ease;
    color-scheme: dark;
}

.time-input:focus {
    border-color: var(--accent);
    background: rgba(124, 92, 252, 0.08);
}

#addBtn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s var(--transition);
    padding: 0;
}

#addBtn svg {
    width: 20px;
    height: 20px;
    color: white;
    transition: transform 0.3s var(--transition);
}

#addBtn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 20px var(--accent-glow);
}

#addBtn:hover svg {
    transform: rotate(90deg);
}

#addBtn:active {
    transform: scale(0.95);
}

/* ===== FILTER TABS ===== */

.filter-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    animation: fadeInUp 0.8s var(--transition) 0.35s both;
}

.filter-btn {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--transition);
    letter-spacing: 0.3px;
}

.filter-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* ===== TODO LIST ===== */

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.4s var(--transition);
    position: relative;
    overflow: hidden;
    animation: taskSlideIn 0.5s var(--transition) both;
}

@keyframes taskSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    opacity: 0;
    transition: opacity 0.3s ease;
}

li:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateX(4px);
}

li:hover::before {
    opacity: 1;
}

/* Custom checkbox */
.custom-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s var(--transition);
    position: relative;
}

.custom-checkbox svg {
    width: 12px;
    height: 12px;
    color: white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s var(--transition);
}

li:hover .custom-checkbox {
    border-color: var(--accent);
}

li.completed .custom-checkbox {
    background: linear-gradient(135deg, var(--success), #20bf6b);
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(46, 213, 115, 0.3);
}

li.completed .custom-checkbox svg {
    opacity: 1;
    transform: scale(1);
}

.todo-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.todo-content span:first-child {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

li.completed .todo-content span:first-child {
    color: var(--text-muted);
    text-decoration: line-through;
    text-decoration-color: var(--text-muted);
}

.task-time {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    letter-spacing: 0.3px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.3s ease;
}

.task-time.due-soon {
    color: var(--warning);
    background: rgba(255, 165, 2, 0.1);
    border-color: rgba(255, 165, 2, 0.2);
    animation: pulse-warning 2s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 165, 2, 0); }
    50% { box-shadow: 0 0 0 4px rgba(255, 165, 2, 0.1); }
}

.task-time.overdue {
    color: var(--danger);
    background: rgba(255, 71, 87, 0.1);
    border-color: rgba(255, 71, 87, 0.2);
    animation: pulse-danger 1.5s ease-in-out infinite;
}

@keyframes pulse-danger {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); }
    50% { box-shadow: 0 0 0 4px rgba(255, 71, 87, 0.1); }
}

.delete-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--transition);
    flex-shrink: 0;
    font-size: 0.85rem;
    padding: 0;
    opacity: 0;
}

li:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: rgba(255, 71, 87, 0.1);
    border-color: rgba(255, 71, 87, 0.2);
    color: var(--danger);
    transform: scale(1.1);
}

.delete-btn:active {
    transform: scale(0.9);
}

/* Completed task line through animation */
li.completed {
    opacity: 0.6;
}

li.completed:hover {
    opacity: 0.8;
}

/* Task removing animation */
li.removing {
    animation: taskRemove 0.4s var(--transition) forwards;
}

@keyframes taskRemove {
    to {
        opacity: 0;
        transform: translateX(40px) scale(0.9);
        margin-bottom: -60px;
    }
}

/* ===== EMPTY STATE ===== */

.empty-state {
    text-align: center;
    padding: 50px 20px;
    animation: fadeInUp 0.6s var(--transition) both;
}

.empty-state.hidden {
    display: none;
}

.empty-illustration {
    margin-bottom: 16px;
    animation: float 5s ease-in-out infinite;
}

.empty-illustration svg {
    width: 80px;
    height: 80px;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== CUSTOM SCROLLBAR ===== */

::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* ===== RESPONSIVE ===== */

@media (max-width: 600px) {
    .app-wrapper {
        padding: 24px 16px 40px;
    }

    .app-header {
        flex-direction: column;
        gap: 16px;
    }

    .time-display {
        text-align: left;
    }

    .stats-bar {
        gap: 8px;
    }

    .stat {
        padding: 10px 8px;
    }

    .stat-number {
        font-size: 1.2rem;
    }

    .input-wrapper {
        flex-wrap: wrap;
    }

    .time-input {
        width: 100%;
        margin: 4px 8px;
    }

    .brand h1 {
        font-size: 1.6rem;
    }

    .filter-tabs {
        gap: 4px;
    }

    .filter-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
}

/* Selection color */
::selection {
    background: rgba(124, 92, 252, 0.3);
    color: white;
}
