:root {
    /* Color Palette */
    --bg-main: #0a0a0b;
    --bg-header: #000000;
    --bg-card: #151516;
    --bg-input: #111112;
    --bg-hover: #1e1e1f;

    --text-primary: #ffffff;
    --text-secondary: #8c8c91;
    --text-muted: #525256;

    --brand-primary: #f97316;
    /* Orange */
    --brand-primary-hover: #ea580c;
    --brand-secondary: #43210b;
    /* Dark orange background */

    --border-color: #27272a;

    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;

    /* Spacing & Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-full: 9999px;

    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography Base */
h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.025em;
}

h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 0.25rem;
}

/* Buttons */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    transition: var(--transition);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--brand-primary);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--brand-primary-hover);
}

.btn-secondary {
    background-color: var(--brand-secondary);
    color: var(--brand-primary);
}

.btn-secondary:hover {
    background-color: rgba(249, 115, 22, 0.2);
}

/* Header */
.app-header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    background-color: var(--brand-primary);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1.25rem;
}

.icon-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.notification-btn {
    position: relative;
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 6px;
    height: 6px;
    background-color: var(--brand-primary);
    border-radius: 50%;
}

/* Main Content Area */
.app-main {
    flex: 1;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

/* Task Header section */
.task-header {
    margin-bottom: 2rem;
}

.task-count {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Input Section */
.task-input-section {
    margin-bottom: 1.5rem;
}

.input-wrapper {
    display: flex;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    align-items: center;
    transition: var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.1);
}

#new-task-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

#new-task-input::placeholder {
    color: var(--text-muted);
}

/* Filters */
.task-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.filter-tabs {
    display: flex;
    background-color: var(--bg-card);
    border-radius: var(--radius-full);
    padding: 0.25rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-btn:hover {
    color: var(--text-primary);
}

.filter-btn.active {
    background-color: var(--brand-primary);
    color: white;
}

.badge {
    background-color: rgba(255, 255, 255, 0.1);
    color: inherit;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
}

.filter-btn.active .badge {
    background-color: rgba(255, 255, 255, 0.2);
}

.btn-clear {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.btn-clear:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* Task List */
.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.task-item {
    display: flex;
    align-items: center;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    gap: 1rem;
    transition: var(--transition);
    animation: fadeIn 0.3s ease;
}

.task-item:hover {
    border-color: #3f3f46;
}

.task-item.completed {
    opacity: 0.6;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-secondary);
}

/* Custom Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    width: 24px;
    height: 24px;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    border: 2px solid var(--brand-primary);
    background-color: transparent;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-container:hover input~.checkmark {
    background-color: rgba(249, 115, 22, 0.1);
}

.checkbox-container input:checked~.checkmark {
    background-color: var(--brand-primary);
}

/* Check icon inside the mark */
.checkmark i {
    color: white;
    font-size: 1rem;
    opacity: 0;
    transform: scale(0.5);
    transition: var(--transition);
}

.checkbox-container input:checked~.checkmark i {
    opacity: 1;
    transform: scale(1);
}

.task-text {
    flex: 1;
    font-size: 1rem;
    word-break: break-word;
    transition: var(--transition);
}

/* Task Actions */
.task-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: var(--transition);
}

.task-item:hover .task-actions {
    opacity: 1;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.action-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.action-btn.delete-btn:hover {
    color: #ef4444;
    /* Red for delete hover */
    background-color: rgba(239, 68, 68, 0.1);
}

.action-btn.priority-btn.active-priority {
    color: #eab308;
    /* Yellow star */
}

.action-btn.priority-btn:hover {
    color: #eab308;
    background-color: rgba(234, 179, 8, 0.1);
}

.edit-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--brand-primary);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

/* Utilities */
.hidden {
    display: none !important;
}

.empty-state {
    text-align: center;
    padding: 3rem 0;
    color: var(--text-secondary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive UI Updates */
/* ── User Area (header) ─────────────────────────────── */
.user-area {
    display: none;
    /* shown by JS after auth */
    align-items: center;
    gap: 0.6rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.3);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-signout {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
    transition: var(--transition);
}

.btn-signout:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* ── Auth loading overlay ────────────────────────────── */
.auth-loading {
    position: fixed;
    inset: 0;
    background-color: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.auth-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.priority-indicator {
    font-size: 0.75rem;
    color: #eab308;
    margin-left: 0.35rem;
    vertical-align: middle;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 600px) {
    .task-filters {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .filter-tabs {
        justify-content: center;
    }

    .btn-clear {
        text-align: center;
        padding-top: 0.5rem;
    }

    .app-header {
        padding: 1rem;
    }

    .header-actions .btn-new-task span {
        display: none;
    }

    .user-name {
        display: none;
    }
}