:root {
    --primary: #7c3aed;
    --primary-light: #8b5cf6;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --light: #f8fafc;
    --dark: #1e293b;
    --gray: #64748b;
    --gray-light: #e2e8f0;
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.15);

    /* Day mode colors (default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --input-bg: #ffffff;
    --motivation-bg: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    --motivation-text: #ffffff;
    --motivation-btn-bg: rgba(255, 255, 255, 0.2);
}

/* Night mode colors - Premium Midnight Aesthetic */
.night-mode {
    /* Primary brand colors shifted to softer Neons */
    --primary: #a78bfa;
    --primary-light: #c4b5fd;
    --secondary: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;

    /* Surface Colors - Deep & Layered */
    --bg-primary: #0b0f1a;
    /* Deepest black-blue */
    --bg-secondary: #111827;
    /* Slightly lighter for body bg */
    --bg-tertiary: #1f2937;
    /* Elevated surfaces */

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;

    /* Card Styles */
    --card-bg: #1e293b;
    --card-border: #334155;
    --input-bg: #0f172a;

    /* THE FIX: Elegant Dark Motivation Section */
    --motivation-bg: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    --motivation-text: #e2e8f0;
    --motivation-btn-bg: rgba(255, 255, 255, 0.05);

    /* Shadows - Glowing rather than dark */
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--text-primary);
    transition: var(--transition);
}

.container {
    width: 100%;
    max-width: 900px;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    padding: 40px;
    position: relative;
    transition: var(--transition);
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
}

/* Theme Toggle Switch */
.theme-toggle {
    position: absolute;
    top: 30px;
    right: 30px;
    z-index: 100;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 70px;
    height: 36px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #e2e8f0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-radius: 50px;
    border: 2px solid rgba(0, 0, 0, 0.05);
}

.toggle-slider:before {
    position: absolute;
    content: "☀️";
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    width: 28px;
    left: 4px;
    bottom: 2px;
    background: white;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-radius: 50%;
    font-size: 14px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

input:checked+.toggle-slider {
    background: #312e81;
    border-color: rgba(255, 255, 255, 0.1);
}

input:checked+.toggle-slider:before {
    transform: translateX(32px);
    content: "🌙";
    background: #1e1b4b;
    color: #fcd34d;
    box-shadow: 0 0 15px rgba(167, 139, 250, 0.4);
}

.toggle-switch:hover .toggle-slider {
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.2);
}

.night-mode .toggle-switch:hover .toggle-slider {
    box-shadow: 0 0 15px rgba(167, 139, 250, 0.3);
}

/* Motivation Section */
.motivation-section {
    background: var(--motivation-bg);
    border-radius: var(--border-radius);
    padding: 25px 30px;
    margin-bottom: 35px;
    color: var(--motivation-text);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.motivation-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.motivation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.motivation-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.refresh-motive {
    background: var(--motivation-btn-bg);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
}

.refresh-motive:hover {
    background: white;
    color: var(--primary);
    transform: translateY(-2px);
    border-color: white;
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.2);
}

.motive-text {
    font-size: 1.4rem;
    font-style: italic;
    font-weight: 500;
    line-height: 1.6;
    margin: 0;
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 15px 0;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.motive-author {
    text-align: right;
    font-size: 0.95rem;
    opacity: 0.9;
    margin-top: 10px;
    position: relative;
    z-index: 1;
    font-style: normal;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.loading-quote {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Task Achievement Badge */
.achievement-badge {
    position: absolute;
    top: -15px;
    right: 30px;
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(245, 158, 11, 0.3);
    animation: bounce 0.5s ease;
    display: none;
    z-index: 2;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

@keyframes bounce {

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

    50% {
        transform: translateY(-10px);
    }
}

.header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.header h1 i {
    font-size: 2.5rem;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
    max-width: 500px;
    margin: 0 auto;
    transition: var(--transition);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 35px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 22px;
    text-align: center;
    transition: var(--transition);
    border: 2px solid var(--card-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.night-mode .stat-card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.night-mode .stat-card:hover {
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.input-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 35px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--card-border);
}

.input-group {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.input_task {
    flex: 1;
    padding: 18px 25px;
    border: 2px solid var(--card-border);
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 500;
    transition: var(--transition);
    outline: none;
    background: var(--input-bg);
    color: var(--text-primary);
}

.input_task:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
}

.night-mode .input_task:focus {
    box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.25);
}

.input_task::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

#add {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 0 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(124, 58, 237, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

#add:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.night-mode #add:hover {
    box-shadow: 0 8px 20px rgba(167, 139, 250, 0.4);
}

#add:active {
    transform: translateY(0);
}

.priority-selector {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.priority-option {
    padding: 14px 26px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid transparent;
    font-size: 0.95rem;
    opacity: 0.8;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.priority-option:hover {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.priority-option.active {
    opacity: 1;
    font-weight: 700;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.priority-high {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}

.night-mode .priority-high {
    color: #fca5a5;
    background: rgba(248, 113, 113, 0.2);
}

.priority-high.active {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.night-mode .priority-high.active {
    background: rgba(248, 113, 113, 0.3);
    border-color: #fca5a5;
    box-shadow: 0 0 15px rgba(248, 113, 113, 0.2);
}

.priority-medium {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
}

.night-mode .priority-medium {
    color: #fcd34d;
    background: rgba(251, 191, 36, 0.2);
}

.priority-medium.active {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
}

.night-mode .priority-medium.active {
    background: rgba(251, 191, 36, 0.3);
    border-color: #fcd34d;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.2);
}

.priority-low {
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
}

.night-mode .priority-low {
    color: #6ee7b7;
    background: rgba(52, 211, 153, 0.2);
}

.priority-low.active {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
}

.night-mode .priority-low.active {
    background: rgba(52, 211, 153, 0.3);
    border-color: #6ee7b7;
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.2);
}

.tasks-container {
    min-height: 200px;
}

.tasks-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tasks-title i {
    color: var(--primary);
}

#tasks {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.task-item {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    border: 2px solid var(--card-border);
    animation: fadeIn 0.4s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.night-mode .task-item {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.task-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.night-mode .task-item:hover {
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
}

.task-item.completed {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(52, 211, 153, 0.15) 100%);
    border-color: rgba(16, 185, 129, 0.3);
}

.night-mode .task-item.completed {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(52, 211, 153, 0.2) 100%);
    border-color: rgba(52, 211, 153, 0.4);
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--secondary);
    opacity: 0.8;
}

.task-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid var(--card-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.task-checkbox:hover {
    border-color: var(--primary);
}

.task-checkbox.checked {
    background: var(--secondary);
    border-color: var(--secondary);
}

.task-checkbox.checked::after {
    content: '✓';
    color: white;
    font-weight: bold;
}

.task-info {
    flex: 1;
}

.task-text {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
    word-break: break-word;
    line-height: 1.5;
}

.task-priority {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.05);
}

.night-mode .task-priority {
    background: rgba(255, 255, 255, 0.05);
}

.task-priority.high {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.night-mode .task-priority.high {
    background: rgba(248, 113, 113, 0.25);
    color: #fca5a5;
}

.task-priority.medium {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.night-mode .task-priority.medium {
    background: rgba(251, 191, 36, 0.25);
    color: #fcd34d;
}

.task-priority.low {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.night-mode .task-priority.low {
    background: rgba(52, 211, 153, 0.25);
    color: #6ee7b7;
}

.task-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.task-actions button {
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.complete-btn {
    background: rgba(16, 185, 129, 0.12);
    color: var(--secondary);
    border: 2px solid rgba(16, 185, 129, 0.2);
}

.complete-btn:hover {
    background: var(--secondary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
    border-color: var(--secondary);
}

.delete-btn {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    border: 2px solid rgba(239, 68, 68, 0.2);
}

.delete-btn:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.3);
    border-color: var(--danger);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 5rem;
    color: var(--gray-light);
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 1.1rem;
    max-width: 400px;
    margin: 0 auto;
}

.footer {
    margin-top: 40px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding-top: 20px;
    border-top: 1px solid var(--card-border);
    transition: var(--transition);
}

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

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

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

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

/* Theme transition effects */
.theme-transition {
    transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 25px;
    }

    .header h1 {
        font-size: 2.2rem;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .input-group {
        flex-direction: column;
    }

    #add {
        justify-content: center;
        padding: 18px;
    }

    .task-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .task-actions {
        align-self: flex-end;
    }

    .motivation-section {
        padding: 20px;
    }

    .motive-text {
        font-size: 1.2rem;
    }

    .theme-toggle {
        top: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .priority-selector {
        flex-direction: column;
        align-items: center;
    }

    .task-actions {
        width: 100%;
        justify-content: space-between;
    }

    .task-actions button {
        flex: 1;
        justify-content: center;
    }

    .motivation-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .toggle-switch {
        width: 50px;
        height: 25px;
    }

    .toggle-slider:before {
        height: 18px;
        width: 18px;
    }

    input:checked+.toggle-slider:before {
        transform: translateX(25px);
    }
}
