/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --primary-hover: #357abd;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --success-color: #27ae60;
    --success-hover: #229954;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e1e8ed;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-hover);
    overflow: hidden;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #5ba3f5 100%);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content */
main {
    padding: 30px 20px;
}

/* Input Section */
.input-section {
    margin-bottom: 30px;
}

.task-form {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.task-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--bg-color);
}

.task-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.add-btn {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 300;
    flex-shrink: 0;
}

.add-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.add-btn:active {
    transform: scale(0.95);
}

/* Tasks Section */
.tasks-section {
    min-height: 200px;
}

.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.tasks-header h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.tasks-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.task-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--bg-color);
    padding: 6px 12px;
    border-radius: 20px;
}

.delete-all-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: none;
}

.delete-all-btn:hover {
    background: var(--danger-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.delete-all-btn:active {
    transform: translateY(0);
}

/* Tasks List */
.tasks-list {
    list-style: none;
    display: grid;
    gap: 12px;
}

.task-item {
    background: var(--bg-color);
    padding: 16px 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    animation: slideIn 0.3s ease;
}

.task-item.completed {
    opacity: 0.7;
    background: #f0f0f0;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-secondary);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.task-item:hover {
    background: white;
    border-color: var(--border-color);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.task-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--success-color);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.task-checkbox:hover {
    transform: scale(1.1);
}

.task-text {
    flex: 1;
    font-size: 1rem;
    color: var(--text-primary);
    word-break: break-word;
    transition: all 0.3s ease;
}

.delete-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 300;
    flex-shrink: 0;
}

.delete-btn:hover {
    background: var(--danger-hover);
    transform: scale(1.1);
}

.delete-btn:active {
    transform: scale(0.95);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    display: none;
}

.empty-state.show {
    display: block;
}

.empty-state p {
    font-size: 1rem;
}

/* Footer Styles */
footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    text-align: center;
    border-top: 2px solid transparent;
}

footer p {
    color: white;
    font-size: 0.9rem;
    margin: 0;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 640px) {
    body {
        padding: 10px;
    }

    header {
        padding: 25px 15px;
    }

    header h1 {
        font-size: 1.6rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    main {
        padding: 20px 15px;
    }

    .task-form {
        gap: 8px;
    }

    .task-input {
        padding: 12px 15px;
        font-size: 0.95rem;
    }

    .add-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }

    .tasks-header h2 {
        font-size: 1.1rem;
    }

    .tasks-header-actions {
        gap: 8px;
    }

    .task-count {
        font-size: 0.85rem;
        padding: 5px 10px;
    }

    .delete-all-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    .task-item {
        padding: 14px 15px;
    }

    .task-text {
        font-size: 0.95rem;
    }

    .task-checkbox {
        width: 20px;
        height: 20px;
    }

    .delete-btn {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }

    footer {
        padding: 15px;
    }

    footer p {
        font-size: 0.85rem;
    }
}

@media (max-width: 400px) {
    header h1 {
        font-size: 1.4rem;
    }

    .task-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}
