:root {
    --bg-color: #121212;
    --text-color: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #00d4ff;
    --secondary: #764ba2;
    --accent: #ff9a9e;
    --success: #00b894;
    --danger: #ff7675;
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(118, 75, 162, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 212, 255, 0.15) 0%, transparent 40%);
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glass-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px;
}

/* Screen Management */
.screen {
    display: none;
    height: 100vh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    padding: 20px;
}

.screen.active {
    display: block;
    position: relative;
    height: auto;
    min-height: 100vh;
}

/* Lock Screen */
#lock-screen {
    /* display: flex; - Moved to .active state to allow hiding */
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#lock-screen.active {
    display: flex !important;
    /* Ensure flex is applied when active, overriding .screen display:block */
}

.lock-content {
    width: 100%;
    max-width: 320px;
    padding: 40px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.biometric-icon {
    font-size: 64px;
    color: var(--primary);
    position: relative;
    margin-bottom: 20px;
    cursor: pointer;
    transition: transform 0.2s;
}

.biometric-icon:active {
    transform: scale(0.95);
}

.biometric-icon .scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
    animation: scan 2s infinite linear;
    display: none;
}

.biometric-icon.scanning .scan-line {
    display: block;
}

@keyframes scan {
    0% {
        top: 0%;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

.pin-input-container {
    display: flex;
    gap: 10px;
    width: 100%;
}

#pin-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: 12px;
    color: white;
    text-align: center;
    font-size: 18px;
    letter-spacing: 4px;
}

#unlock-btn {
    background: var(--primary);
    border: none;
    border-radius: 12px;
    width: 48px;
    color: #000;
    font-size: 18px;
    cursor: pointer;
}

.error-msg {
    color: var(--danger);
    font-size: 14px;
    height: 20px;
}

/* Dashboard */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-top: 10px;
}

.user-welcome h1 {
    font-size: 24px;
    font-weight: 600;
}

.user-welcome span {
    color: var(--primary);
}

.user-welcome p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.profile-pic img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary);
}

.icon-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    /* Fix for alignment */
    justify-content: center;
    align-items: center;
}

/* Progress Section */
.progress-section {
    margin-bottom: 24px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.progress-bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 4px;
}

.strikes-container {
    display: flex;
    gap: 16px;
}

.strike-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.strike-item i {
    color: var(--accent);
}

/* Chart */
.chart-bar {
    width: 10%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    position: relative;
    transition: height 0.5s;
}

.chart-bar:hover {
    background: var(--primary);
}

.chart-bar::after {
    content: attr(data-day);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
}

/* Categories */
.categories-section {
    margin-bottom: 24px;
}

.categories-section h3,
.tasks-section h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.categories-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
}

.categories-scroll::-webkit-scrollbar {
    display: none;
}

.category-card {
    min-width: 100px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.category-card.active {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--primary);
}

.icon-box {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
}

/* Tasks List */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 80px;
    /* Space for FAB */
    perspective: 1000px;
}

.task-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 16px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: slideIn 0.4s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation delays for up to 10 items */
.task-item:nth-child(1) {
    animation-delay: 0.05s;
}

.task-item:nth-child(2) {
    animation-delay: 0.1s;
}

.task-item:nth-child(3) {
    animation-delay: 0.15s;
}

.task-item:nth-child(4) {
    animation-delay: 0.2s;
}

.task-item:nth-child(5) {
    animation-delay: 0.25s;
}

.task-item:hover {
    transform: translateY(-4px) scale(1.01);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Confetti Particle */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: var(--primary);
    animation: fall linear forwards;
    z-index: 9999;
    pointer-events: none;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(720deg);
    }
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.task-checkbox i {
    color: var(--bg-color);
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
}

.task-item.completed .task-checkbox {
    background: var(--primary);
}

.task-item.completed .task-checkbox i {
    opacity: 1;
}

.task-content {
    flex: 1;
}

.task-title {
    font-size: 16px;
    margin-bottom: 4px;
    transition: color 0.2s;
}

.task-item.completed .task-title {
    text-decoration: line-through;
    color: rgba(255, 255, 255, 0.4);
}

.task-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    gap: 10px;
}

.task-priority {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.priority-high {
    background-color: var(--danger);
    box-shadow: 0 0 5px var(--danger);
}

.priority-medium {
    background-color: #fdcb6e;
    box-shadow: 0 0 5px #fdcb6e;
}

.priority-low {
    background-color: var(--success);
    box-shadow: 0 0 5px var(--success);
}

.delete-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 8px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.delete-btn:hover {
    opacity: 1;
}

/* FAB */
.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 30px;
    background: var(--primary);
    border: none;
    color: #000;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
}

.fab:active {
    transform: scale(0.9);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: flex-end;
    /* Bottom sheet default */
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 100%;
    background: #1e1e1e;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 24px 24px 40px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.modal-handle {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 0 auto 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.form-group input,
.form-group select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 12px;
    color: white;
    font-size: 16px;
}

.priority-selector {
    display: flex;
    gap: 10px;
}

.priority-opt {
    flex: 1;
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    border: 1px solid transparent;
}

.priority-opt.selected {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    color: #000;
    cursor: pointer;
}

/* Notification Toast */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid var(--primary);
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeInDown 0.3s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Category Management */
.color-picker-row {
    margin-top: 10px;
}

.color-opt {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.color-opt.selected {
    border-color: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.cat-manage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
}

.icon-btn-small {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    opacity: 0.7;
    margin-left: 10px;
}

/* Edit Task Enhancements */
.edit-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.edit-btn:hover {
    opacity: 1;
}

.task-actions {
    display: flex;
    margin-left: auto;
}

/* Mobile Polish */
@media (max-width: 480px) {
    .modal-content {
        padding-bottom: 80px;
        /* Space for mobile nav bars if any */
    }

    /* Focus Screen */
    #focus-screen {
        display: none;
        justify-content: center;
        align-items: center;
        z-index: 1000;
    }

    #focus-screen.active {
        display: flex !important;
    }

    .focus-container {
        width: 100%;
        height: 100%;
        max-width: 400px;
        /* Mobile safe width */
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 40px 20px;
        text-align: center;
    }

    #focus-task-title {
        font-size: 24px;
        margin-bottom: 20px;
        color: var(--primary);
    }

    .timer-display {
        font-size: 48px;
        font-weight: 700;
        font-family: monospace;
        margin-bottom: 30px;
        text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
    }

    .focus-progress-container {
        width: 100%;
        height: 12px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 6px;
        overflow: hidden;
        margin-bottom: 10px;
    }

    .focus-progress-bar {
        height: 100%;
        background: linear-gradient(90deg, var(--success), var(--primary));
        width: 0%;
        transition: width 0.3s ease;
    }

    #focus-percent-text {
        font-size: 14px;
        color: rgba(255, 255, 255, 0.6);
        margin-bottom: 20px;
        display: block;
    }

    .progress-controls {
        display: flex;
        gap: 10px;
        margin-bottom: 30px;
    }

    .prog-btn {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: white;
        padding: 8px 16px;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s;
    }

    .prog-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: translateY(-2px);
    }

    #motivational-msg {
        min-height: 24px;
        font-style: italic;
        color: var(--accent);
        margin-bottom: 40px;
        opacity: 0.8;
    }

    .focus-actions {
        display: flex;
        gap: 15px;
        width: 100%;
        justify-content: center;
    }

    .action-btn {
        border: none;
        padding: 12px 24px;
        border-radius: 12px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .pause-btn {
        background: #fdcb6e;
        color: #000;
    }

    .stop-btn {
        background: var(--danger);
        color: white;
    }

    .complete-btn {
        background: var(--success);
        color: white;
    }

    /* Start Button in Task List */
    .start-btn {
        background: none;
        border: none;
        color: var(--success);
        cursor: pointer;
        padding: 8px;
        opacity: 0.8;
        transition: transform 0.2s;
        margin-right: 5px;
    }

    .start-btn:hover {
        transform: scale(1.1);
        opacity: 1;
    }

    @keyframes pulse {
        0% {
            transform: scale(1);
        }

        50% {
            transform: scale(1.05);
        }

        100% {
            transform: scale(1);
        }
    }