* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #007AFF;
    --secondary: #34C759;
    --accent: #5856D6;
    --success: #30D158;
    --warning: #FF9F0A;
    --danger: #FF3B30;
    --bg-gradient: linear-gradient(135deg, #fefefe 0%, #f8f9fa 100%);
    --text: #1d1d1f;
    --bg: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.98);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --border: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
    --primary: #0A84FF;
    --secondary: #32D74B;
    --accent: #5E5CE6;
    --success: #30D158;
    --warning: #FF9F0A;
    --danger: #FF453A;
    --bg-gradient: linear-gradient(135deg, #000000 0%, #1c1c1e 100%);
    --text: #f2f2f7;
    --bg: #1c1c1e;
    --card-bg: rgba(28, 28, 30, 0.98);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --border: rgba(255, 255, 255, 0.08);
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text);
    transition: all 0.3s ease;
    font-weight: 400;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}





.main-controls button {
    background: var(--accent);
    border: none;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    color: white;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    min-width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

.add-task {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

#taskInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--accent);
    border-radius: 12px;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    transition: all 0.3s ease;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

#taskInput:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(69, 183, 209, 0.1);
}

#prioritySelect {
    padding: 12px;
    border: 2px solid var(--success);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 2px rgba(48, 209, 88, 0.1);
}

#addBtn {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

#addBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(255, 107, 107, 0.4);
}

.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--accent);
    background: transparent;
    color: var(--accent);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-1px);
}

.task-stats {
    background: var(--card-bg);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    font-weight: 500;
}

.task-list {
    list-style: none;
    margin-bottom: 20px;
}

.task-item {
    background: var(--card-bg);
    margin-bottom: 10px;
    padding: 15px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.task-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(31, 38, 135, 0.5);
}

.task-item.completed {
    opacity: 0.7;
}

.task-item.completed .task-text {
    text-decoration: line-through;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    cursor: pointer;
    transition: all 0.3s ease;
}

.task-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
}

.task-text {
    flex: 1;
    font-size: 1rem;
    line-height: 1.5;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.priority-badge {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.priority-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.priority-high {
    background: #DC143C;
    color: white;
    box-shadow: 0 2px 8px rgba(220, 20, 60, 0.3);
    font-weight: 600;
}

.priority-medium {
    background: #FF8C00;
    color: white;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.3);
    font-weight: 600;
}

.priority-low {
    background: #228B22;
    color: white;
    box-shadow: 0 2px 8px rgba(34, 139, 34, 0.3);
    font-weight: 600;
}

.task-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.task-actions button {
    background: var(--card-bg);
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    color: var(--text);
    margin-left: 3px;
    min-width: 60px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.delete-icon {
    font-size: 0.9rem;
}

.countdown {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    line-height: 1;
}

.countdown.urgent {
    color: var(--danger);
    animation: pulse 1s infinite;
}

.countdown.expired {
    color: var(--danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Task Timer */
.task-timer {
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 10px;
    opacity: 0.8;
}

.task-timer.active {
    color: var(--accent);
    animation: pulse 2s infinite;
}

.task-timer.completed {
    color: var(--success);
}

/* Control Section */
.control-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: var(--card-bg);
    padding: 15px 20px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.main-controls {
    display: flex;
    gap: 10px;
}

.focus-options {
    display: flex;
    gap: 5px;
}

.focus-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    color: var(--text);
}

.focus-btn:hover,
.focus-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Hide Details Mode */
.task-item.hide-details .task-date {
    display: none;
}

/* Focus Mode - Hide Everything Except Tasks */
body.focus-mode .quick-stats,
body.focus-mode .filters,
body.focus-mode .task-stats,
body.focus-mode .add-task,
body.focus-mode .bulk-actions,
body.focus-mode .global-footer,
body.focus-mode .ad-container {
    display: none !important;
}

body.focus-mode .container {
    padding: 10px;
}

/* Keep control section visible in focus mode for toggle */
body.focus-mode .control-section {
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 10px 0;
}

body.focus-mode .main-controls {
    display: none;
}

body.focus-mode .focus-options {
    justify-content: center;
    width: 100%;
}

/* Focus mode exit button styling */
body.focus-mode .focus-btn {
    background: rgb(41, 40, 40);
    color: white;
    border-color: gray;
    font-weight: 600;
}

body.focus-mode #focusModeBtn::after {
    content: ' Exit';
    font-size: 0.8rem;
    margin-left: 5px;
}

.task-item.focus-mode {
    padding: 10px 15px;
}

.task-actions.minimal {
    gap: 2px;
}

.task-actions.minimal button {
    min-width: 40px;
    height: 28px;
    padding: 4px 8px;
}

/* Drag Handle */
.drag-handle {
    cursor: grab;
    color: var(--text);
    opacity: 0.5;
    font-size: 1.2rem;
    padding: 5px;
    transition: all 0.3s ease;
    user-select: none;
}

.drag-handle:hover {
    opacity: 1;
    color: var(--accent);
}

.drag-handle:active {
    cursor: grabbing;
}

.task-item[draggable="true"]:hover .drag-handle {
    opacity: 0.8;
}

.task-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.edit-btn:hover {
    background: var(--warning);
}

.delete-btn:hover {
    background: var(--danger);
}

.bulk-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.bulk-actions button {
    padding: 10px 20px;
    border: 2px solid var(--danger);
    background: transparent;
    color: var(--danger);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.bulk-actions button:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-1px);
}

.hidden {
    display: none !important;
}

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 5px;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

/* Enhanced Add Task */
#dueDateInput {
    padding: 12px;
    border: 2px solid var(--warning);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    transition: all 0.3s ease;
    min-width: 150px;
    box-shadow: 0 0 0 2px rgba(255, 159, 10, 0.1);
}

#dueDateInput:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(69, 183, 209, 0.1);
}

/* Search Section */
.search-section {
    margin-bottom: 20px;
}



.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(69, 183, 209, 0.1);
}

/* Enhanced Task Items */
.task-date {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-left: 10px;
}

.task-date.overdue {
    color: var(--danger);
    font-weight: 600;
}

.task-date.today {
    color: var(--warning);
    font-weight: 600;
}

.task-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.task-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--accent));
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Navigation Dark Toggle */
.nav-dark-toggle {
    background: var(--accent);
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    color: white;
}

.nav-dark-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(69, 183, 209, 0.4);
}

/* Enhanced Controls */
#exportBtn {
    background: var(--success);
}

#printBtn {
    background: var(--secondary);
}

#exportBtn:hover {
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.4);
}

#printBtn:hover {
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.4);
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--accent);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

/* Print Styles */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .controls,
    .add-task,
    .filters,
    .bulk-actions {
        display: none !important;
    }
    
    .task-item {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
    
    .task-actions {
        display: none !important;
    }
    
    h1 {
        color: black !important;
        -webkit-text-fill-color: black !important;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .quick-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .add-task {
        flex-direction: column;
    }
    
    .filters {
        justify-content: center;
    }
    
    .task-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .task-actions {
        align-self: flex-end;
        justify-content: center;
        width: 100%;
        margin-top: 10px;
        gap: 5px;
    }
    
    .task-actions button {
        min-width: 50px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .delete-content {
        gap: 0;
    }
    
    .countdown {
        font-size: 0.6rem;
    }
    
    .focus-options {
        flex-direction: column;
        gap: 3px;
    }
    
    .focus-btn {
        padding: 6px 8px;
        font-size: 0.9rem;
    }
    
    .control-section {
        flex-direction: column;
        gap: 15px;
        padding: 12px 15px;
    }
    
    .main-controls {
        justify-content: center;
    }
    
    .bulk-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .add-task {
        padding: 15px;
    }
    
    .task-item {
        padding: 8px 12px;
        margin-bottom: 8px;
    }
    
    .task-text {
        font-size: 0.9rem;
    }
    
    .priority-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }
    
    .task-timer {
        font-size: 0.65rem;
        margin-left: 5px;
    }
    
    .task-date {
        font-size: 0.7rem;
    }
    
    .drag-handle {
        font-size: 1rem;
        padding: 3px;
    }
    
    .task-checkbox {
        width: 16px;
        height: 16px;
    }
    
    .filter-btn {
        font-size: 0.9rem;
        padding: 6px 12px;
    }
}
