@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #ec4899;
    --background-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
    --glass-blur: blur(20px);

    /* Priority Colors */
    --badge-low: #3b82f6;
    --badge-medium: #f59e0b;
    --badge-high: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--background-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Align to top for mobile scrolling */
    color: var(--text-main);
    padding: 1rem;
}

.container {
    width: 100%;
    max-width: 550px;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.app-wrapper {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.6s ease-out;
}

/* Header & Auth */
header {
    margin-bottom: 1.5rem;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(to right, #818cf8, #fb7185);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.user-menu {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--card-border);
}

.user-menu a {
    color: #fb7185;
    text-decoration: none;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Inputs & Forms */
.input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

input[type="text"] {
    flex: 2;
    /* Take more space */
    min-width: 200px;
}

input[type="text"],
input[type="password"],
input[type="date"],
select,
.search-input {
    /* width: 100%; Removed this to let flex handle it */
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.2s;
    outline: none;
}

/* Ensure select and date fit nicely */
select,
input[type="date"] {
    flex: 1;
    min-width: 120px;
}

input:focus,
select:focus {
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.3);
}

/* Buttons */
.btn-add,
.btn-update,
.btn-block {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-add:active,
.btn-update:active {
    transform: scale(0.98);
}

/* Search */
.search-container {
    margin-bottom: 1rem;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    padding-left: 2.8rem;
}

/* Filters */
.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.3rem;
    border-radius: 12px;
}

.filter-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Task List */
.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 60vh;
    overflow-y: auto;
    padding-bottom: 1rem;
}

.task-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: transform 0.2s;
}

.task-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    /* Prevent flex overflow */
}

/* Mobile Layout for Task Item */
@media (max-width: 480px) {
    .task-item {
        align-items: flex-start;
    }

    .task-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .checkbox-wrapper {
        margin-top: 0.2rem;
    }
}

.checkbox-wrapper {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.task-checkbox {
    width: 100%;
    height: 100%;
    appearance: none;
    border: 2px solid var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
}

.task-checkbox:checked {
    background: var(--success-color);
    border-color: var(--success-color);
}

.task-details {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.task-text {
    font-size: 1rem;
    word-break: break-word;
    line-height: 1.4;
}

.task-meta {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

.badge {
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.65rem;
    color: #fff;
}

.badge-low {
    background: var(--badge-low);
}

.badge-medium {
    background: var(--badge-medium);
}

.badge-high {
    background: var(--badge-high);
}

.due-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
}

.actions {
    display: flex;
    gap: 0.25rem;
}

.btn-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
}

.btn-delete:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(5px);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: #1e293b;
    border: 1px solid var(--card-border);
    width: 90%;
    max-width: 400px;
    padding: 1.5rem;
    border-radius: 16px;
    transform: scale(0.95);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Auth Pages Specifics */
.auth-container {
    max-width: 400px;
    margin: auto;
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: center;
}

/* Mobile Optimization: Add Input Button */
@media (max-width: 480px) {
    .btn-add {
        width: 100%;
        margin-top: 0.5rem;
    }

    .input-group select,
    .input-group input[type=date] {
        width: 100%;
    }
}/* ... existing styles ... */

/* Clear Button Fix */
.btn-clear {
    display: block;
    width: 100%;
    margin: 1.5rem auto 0;
    background: rgba(255, 255, 255, 0.03);
    /* Subtle background */
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    padding: 0.8rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    text-align: center;
}

.btn-clear:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Add Button Styling */
.btn-add {
    white-space: nowrap;
    min-width: 80px;
}
