/* ============================================
   Controller - Minimalist Task Management CSS
   ============================================ */

/* Dark Theme (default) */
:root,
[data-theme="dark"] {
    /* Colors */
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-card: #18181b;
    --bg-hover: #1f1f23;

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --border-color: #27272a;
    --border-subtle: #1f1f23;

    /* Priority Colors */
    --priority-1: #ef4444;
    --priority-1-bg: rgba(239, 68, 68, 0.1);
    --priority-2: #f97316;
    --priority-2-bg: rgba(249, 115, 22, 0.1);
    --priority-3: #eab308;
    --priority-3-bg: rgba(234, 179, 8, 0.1);
    --priority-4: #22c55e;
    --priority-4-bg: rgba(34, 197, 94, 0.1);

    /* Accent */
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-glow: rgba(139, 92, 246, 0.3);

    /* Success */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);

    /* Sizing */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-hover: #e2e8f0;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;

    --priority-1-bg: rgba(239, 68, 68, 0.15);
    --priority-2-bg: rgba(249, 115, 22, 0.15);
    --priority-3-bg: rgba(234, 179, 8, 0.15);
    --priority-4-bg: rgba(34, 197, 94, 0.15);

    --accent-glow: rgba(139, 92, 246, 0.2);
    --success-bg: rgba(16, 185, 129, 0.15);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   Page & Layout
   ============================================ */
.page {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* ============================================
   Auth Page
   ============================================ */
#auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 40%),
        var(--bg-primary);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    animation: fadeIn 0.5s ease-out;
}

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

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

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

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.logo-icon {
    font-size: 32px;
    color: var(--accent);
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

.logo-text {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.tagline {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 4px;
    margin-bottom: 24px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
}

.tab-btn:hover:not(.active) {
    color: var(--text-primary);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

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

/* ============================================
   Form Styles
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-error {
    color: var(--priority-1);
    font-size: 13px;
    margin-top: 12px;
    text-align: center;
    min-height: 20px;
}

/* ============================================
   Buttons
   ============================================ */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 30px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-arrow {
    transition: transform 0.2s ease;
}

.btn-primary:hover .btn-arrow {
    transform: translateX(3px);
}

.btn-secondary {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-ghost {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-ghost:hover {
    color: var(--text-primary);
}

/* ============================================
   Dashboard Header
   ============================================ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .logo {
    margin: 0;
}

.header .logo-icon {
    font-size: 24px;
}

.header .logo-text {
    font-size: 20px;
}

.stats-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 8px 24px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-divider {
    width: 1px;
    height: 30px;
    background: var(--border-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-greeting {
    font-size: 14px;
    color: var(--text-secondary);
}

.user-greeting span {
    color: var(--text-primary);
    font-weight: 500;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    padding: 32px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Add Task Section */
.add-task-section {
    margin-bottom: 32px;
}

.btn-add-task {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.btn-add-task:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--priority-1-bg);
}

.plus-icon {
    font-size: 20px;
    font-weight: 300;
}

/* Priority Grid */
.priority-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

@media (max-width: 1200px) {
    .priority-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .priority-grid {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }

    .stats-bar {
        width: 100%;
        justify-content: space-around;
    }
}

.priority-column {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 400px;
}

.column-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.column-header h3 {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}

.priority-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.priority-1 .priority-dot {
    background: var(--priority-1);
    box-shadow: 0 0 10px var(--priority-1);
}

.priority-2 .priority-dot {
    background: var(--priority-2);
    box-shadow: 0 0 10px var(--priority-2);
}

.priority-3 .priority-dot {
    background: var(--priority-3);
    box-shadow: 0 0 10px var(--priority-3);
}

.priority-4 .priority-dot {
    background: var(--priority-4);
    box-shadow: 0 0 10px var(--priority-4);
}

.task-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.task-list {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ============================================
   Task Card
   ============================================ */
.task-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.task-card:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.task-card.completed {
    opacity: 0.6;
}

.task-card.completed .task-title {
    text-decoration: line-through;
}

.task-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.task-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.task-card.priority-1 .task-checkbox {
    border-color: var(--priority-1);
}

.task-card.priority-2 .task-checkbox {
    border-color: var(--priority-2);
}

.task-card.priority-3 .task-checkbox {
    border-color: var(--priority-3);
}

.task-card.priority-4 .task-checkbox {
    border-color: var(--priority-4);
}

.task-checkbox:hover {
    background: var(--bg-hover);
}

.task-card.completed .task-checkbox {
    background: var(--success);
    border-color: var(--success);
}

.task-checkbox-icon {
    opacity: 0;
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.task-card.completed .task-checkbox-icon {
    opacity: 1;
}

.task-content {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    word-break: break-word;
}

.task-description {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.task-card:hover .task-actions {
    opacity: 1;
}

.task-action-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.task-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.task-action-btn.delete:hover {
    background: var(--priority-1-bg);
    color: var(--priority-1);
}

/* ============================================
   Modal
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.priority-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.priority-option {
    cursor: pointer;
}

.priority-option input {
    display: none;
}

.priority-label {
    display: block;
    padding: 12px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 13px;
    transition: all 0.2s ease;
}

.priority-option:hover .priority-label {
    background: var(--bg-hover);
}

.priority-option input:checked+.priority-label {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions .btn-primary {
    flex: 1;
}

/* ============================================
   Toast
   ============================================ */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease-out;
    z-index: 2000;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.toast-icon {
    font-size: 16px;
}

/* ============================================
   Confetti
   ============================================ */
#confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100%) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ============================================
   Completion Animation
   ============================================ */
.task-card.completing {
    animation: taskComplete 0.5s ease-out;
}

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

    50% {
        transform: scale(1.05);
        background: var(--success-bg);
    }

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

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 14px;
}

/* ============================================
   Drag and Drop
   ============================================ */
.task-card[draggable="true"] {
    cursor: grab;
}

.task-card[draggable="true"]:active {
    cursor: grabbing;
}

.task-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg) scale(1.02);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.task-list.drop-zone-active {
    background: rgba(139, 92, 246, 0.05);
    border: 2px dashed transparent;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.task-list.drop-zone-hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--accent);
}

.drag-handle {
    cursor: grab;
    letter-spacing: -2px;
}

.drag-handle:active {
    cursor: grabbing;
}

/* ============================================
   Confirm Dialog
   ============================================ */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease-out;
}

.confirm-dialog {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 400px;
    width: 90%;
    animation: modalIn 0.2s ease-out;
}

.confirm-dialog h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.confirm-dialog p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-danger {
    padding: 10px 20px;
    background: var(--priority-1);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* ============================================
   Stat Animation
   ============================================ */
.stat-value.stat-changed {
    animation: statPop 0.5s ease-out;
    color: var(--success);
}

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

    50% {
        transform: scale(1.3);
    }

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

/* ============================================
   Category Badge
   ============================================ */
.task-category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    margin-top: 8px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.task-category-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

/* Category Colors */
.category-color-1 {
    background: #ef4444;
}

.category-color-2 {
    background: #f97316;
}

.category-color-3 {
    background: #eab308;
}

.category-color-4 {
    background: #22c55e;
}

.category-color-5 {
    background: #06b6d4;
}

.category-color-6 {
    background: #3b82f6;
}

.category-color-7 {
    background: #8b5cf6;
}

.category-color-8 {
    background: #ec4899;
}

/* ============================================
   Category Selector in Modal
   ============================================ */
.category-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.category-chip {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-chip:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.category-chip.selected {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--text-primary);
}

.category-chip .chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.add-category-btn {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    background: transparent;
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-category-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ============================================
   Category Management Section
   ============================================ */
.categories-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 32px;
}

.categories-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 32px;
    margin-bottom: 16px;
}

.category-filter {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-filter:hover {
    background: var(--bg-hover);
}

.category-filter.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.category-filter .filter-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
}

/* ============================================
   Form Select
   ============================================ */
.form-group select {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s ease;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px;
}

/* ============================================
   Focus Button
   ============================================ */
.btn-focus {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-glow);
}

.btn-focus:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 25px var(--accent-glow);
}

.focus-icon {
    font-size: 16px;
}

/* ============================================
   Categories Section
   ============================================ */
.categories-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 0;
}

.categories-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

/* ============================================
   Category Manager Modal
   ============================================ */
.category-manager {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.add-category-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.add-category-form input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
}

.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.selected {
    border-color: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.existing-categories {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
}

.category-item-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.category-item-name {
    flex: 1;
    font-size: 14px;
}

.category-item-delete {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
}

.category-item-delete:hover {
    background: var(--priority-1-bg);
    color: var(--priority-1);
}

/* ============================================
   Focus Mode Overlay
   ============================================ */
.focus-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, #0a0a0b 0%, #111113 50%, #0a0a0b 100%);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: focusFadeIn 0.5s ease-out;
}

@keyframes focusFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.focus-container {
    text-align: center;
    position: relative;
    z-index: 10;
    padding: 40px;
}

.btn-exit-focus {
    position: absolute;
    top: -60px;
    right: -60px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-exit-focus:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

.focus-header {
    margin-bottom: 48px;
}

.focus-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.focus-logo .logo-icon {
    font-size: 32px;
}

/* Timer Display */
.focus-timer {
    margin-bottom: 32px;
}

.timer-display {
    font-size: 120px;
    font-weight: 200;
    color: var(--text-primary);
    font-family: 'Inter', monospace;
    letter-spacing: -4px;
    line-height: 1;
    margin-bottom: 8px;
    text-shadow: 0 0 60px var(--accent-glow);
}

.timer-label {
    font-size: 16px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Timer Controls */
.timer-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
}

.btn-timer {
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-glow);
}

.btn-timer:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 40px var(--accent-glow);
}

.btn-timer-secondary {
    padding: 14px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-timer-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Timer Presets */
.timer-presets {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 40px;
}

.preset-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.preset-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Focus Task */
.focus-task {
    margin-bottom: 48px;
}

.focus-task-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.focus-task select {
    padding: 12px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 16px;
    min-width: 300px;
    cursor: pointer;
}

/* Focus Quote */
.focus-quote {
    max-width: 400px;
    margin: 0 auto;
}

.focus-quote p {
    font-size: 16px;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.6;
}

/* Breathing Circle Animation */
.breathing-circle {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    animation: breathe 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes breathe {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.3;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.6;
    }
}

/* Timer running state */
.focus-overlay.timer-running .breathing-circle {
    animation: breatheActive 2s ease-in-out infinite;
    background: radial-gradient(circle at center, rgba(16, 185, 129, 0.15) 0%, transparent 70%);
}

@keyframes breatheActive {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.4;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.7;
    }
}

/* Timer finished state */
.focus-overlay.timer-finished .timer-display {
    animation: pulse 1s ease-in-out infinite;
    color: var(--success);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ============================================
   Navigation Tabs
   ============================================ */
.nav-tabs {
    display: flex;
    gap: 8px;
    margin-left: 32px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.nav-tab.active {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.nav-icon {
    font-size: 16px;
}

/* ============================================
   Habits Page
   ============================================ */
.habits-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.habits-title h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.habits-subtitle {
    color: var(--text-muted);
    font-size: 15px;
}

.habits-container {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 24px;
    border: 1px solid var(--border-color);
}

/* Calendar Navigation */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.calendar-nav h2 {
    font-size: 18px;
    font-weight: 600;
    min-width: 150px;
    text-align: center;
}

.btn-nav {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-nav:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* Habits Grid */
.habits-grid {
    overflow-x: auto;
}

.calendar-header {
    display: grid;
    grid-template-columns: 200px repeat(7, 48px) 60px;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.habit-name-header,
.day-header,
.streak-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.habit-name-header {
    text-align: left;
}

/* Habit Row */
.habit-row {
    display: grid;
    grid-template-columns: 200px repeat(7, 48px) 60px;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    transition: background 0.2s ease;
}

.habit-row:hover {
    background: var(--bg-hover);
}

.habit-row:last-child {
    border-bottom: none;
}

.habit-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.habit-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.habit-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.habit-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.habit-action-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: all 0.2s ease;
}

.habit-row:hover .habit-action-btn {
    opacity: 1;
}

.habit-action-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.habit-action-btn.delete:hover {
    background: var(--priority-1-bg);
    color: var(--priority-1);
}

/* Day Cell (Checkbox) */
.day-cell {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.day-checkbox {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 14px;
}

.day-checkbox:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.day-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
    color: white;
    animation: checkPop 0.3s ease;
}

.day-checkbox.today {
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.day-checkbox.future {
    opacity: 0.3;
    pointer-events: none;
}

@keyframes checkPop {
    0% {
        transform: scale(0.8);
    }

    50% {
        transform: scale(1.2);
    }

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

/* Day number */
.day-number {
    position: absolute;
    top: 2px;
    right: 6px;
    font-size: 9px;
    color: var(--text-muted);
}

/* Streak Cell */
.streak-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.streak-cell.hot {
    color: #f97316;
}

/* Habits Empty State */
.habits-empty {
    text-align: center;
    padding: 60px 20px;
}

.habits-empty .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.habits-empty h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.habits-empty p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Emoji Picker */
.emoji-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.emoji-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.emoji-btn:hover {
    border-color: var(--accent);
    transform: scale(1.1);
}

.emoji-btn.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
}

/* Weekly view adjustments for habits */
.week-days-header {
    display: grid;
    grid-template-columns: 200px repeat(7, 1fr) 60px;
    gap: 4px;
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

/* Color classes for habit icons */
.habit-icon.color-1 {
    background: rgba(239, 68, 68, 0.2);
}

.habit-icon.color-2 {
    background: rgba(249, 115, 22, 0.2);
}

.habit-icon.color-3 {
    background: rgba(234, 179, 8, 0.2);
}

.habit-icon.color-4 {
    background: rgba(34, 197, 94, 0.2);
}

.habit-icon.color-5 {
    background: rgba(6, 182, 212, 0.2);
}

.habit-icon.color-6 {
    background: rgba(59, 130, 246, 0.2);
}

.habit-icon.color-7 {
    background: rgba(139, 92, 246, 0.2);
}

.habit-icon.color-8 {
    background: rgba(236, 72, 153, 0.2);
}

/* Responsive */
@media (max-width: 900px) {
    .nav-tabs {
        margin-left: 16px;
    }

    .nav-tab span:not(.nav-icon) {
        display: none;
    }

    .calendar-header,
    .habit-row {
        grid-template-columns: 150px repeat(7, 40px) 50px;
    }

    .day-checkbox {
        width: 28px;
        height: 28px;
    }
}

/* ============================================
   Theme Toggle Button
   ============================================ */
.btn-theme {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-theme:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: rotate(20deg);
}

/* ============================================
   Full Month Calendar Grid
   ============================================ */
.habits-grid {
    overflow-x: auto;
    padding-bottom: 8px;
}

.calendar-header {
    display: flex;
    gap: 4px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
    min-width: fit-content;
}

.calendar-header .habit-name-header {
    min-width: 200px;
    flex-shrink: 0;
}

.calendar-header .day-header {
    min-width: 36px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.calendar-header .day-header.today {
    color: var(--accent);
    font-weight: 600;
}

.calendar-header .day-header small {
    font-size: 9px;
    opacity: 0.7;
}

.calendar-header .streak-header {
    min-width: 60px;
    text-align: center;
}

.habit-row {
    display: flex;
    gap: 4px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    min-width: fit-content;
}

.habit-row:last-child {
    border-bottom: none;
}

.habit-row .habit-info {
    min-width: 200px;
    flex-shrink: 0;
}

.habit-row .day-cell {
    min-width: 36px;
    display: flex;
    justify-content: center;
}

.habit-row .day-checkbox {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.habit-row .streak-cell {
    min-width: 60px;
}

/* Scrollbar styling */
.habits-grid::-webkit-scrollbar {
    height: 6px;
}

.habits-grid::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.habits-grid::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.habits-grid::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}