/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #fafafa;
    --bg-card: #ffffff;
    --bg-sidebar: #f8f7ff;
    --text: #1e1b4b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.06);
    --transition: 150ms ease;
    --sidebar-width: 280px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--border); }
.btn-danger { background: transparent; color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }
.btn-large { padding: 12px 28px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-google {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.btn-google:hover { background: #f8fafc; box-shadow: var(--shadow-lg); text-decoration: none; }
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.btn-icon:hover { background: var(--border); color: var(--text); }

/* ─── Landing Page ──────────────────────────────────────────── */
.landing { background: linear-gradient(180deg, #f8f7ff 0%, #fafafa 100%); }

.landing-header {
    position: sticky;
    top: 0;
    background: rgba(248, 247, 255, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.landing-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 36px;
    line-height: 1.7;
}

/* App Preview Mock */
.app-preview {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15);
    overflow: hidden;
    border: 1px solid var(--border);
}

.preview-header {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border);
}

.preview-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.preview-dot.red { background: #ef4444; }
.preview-dot.yellow { background: #f59e0b; }
.preview-dot.green { background: #10b981; }

.preview-content { display: flex; min-height: 260px; }

.preview-sidebar {
    width: 140px;
    padding: 16px 12px;
    border-right: 1px solid var(--border);
    background: #f8f7ff;
}

.preview-project {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.preview-project.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.preview-project .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.preview-tasks { flex: 1; padding: 16px; }

.preview-task {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
}
.preview-task .check {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 50%;
    flex-shrink: 0;
}
.preview-task .check.checked {
    background: var(--primary);
    border-color: var(--primary);
    position: relative;
}
.preview-task .check.checked::after {
    content: '';
    position: absolute;
    top: 2px; left: 5px;
    width: 4px; height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.preview-task.done .text { text-decoration: line-through; color: var(--text-muted); }
.preview-task .text { flex: 1; }
.preview-task .priority {
    width: 6px; height: 6px; border-radius: 50%;
}
.preview-task .priority.p1 { background: var(--danger); }
.preview-task .priority.p2 { background: var(--warning); }
.preview-task .priority.p3 { background: var(--success); }
.preview-task .date {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
}

/* Features */
.features {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 24px;
    text-align: center;
}

.features h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 48px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    text-align: left;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: all var(--transition);
}
.feature-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.feature-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    margin-bottom: 16px;
}

.feature-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.feature-card p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; }

/* CTA */
.cta {
    text-align: center;
    padding: 80px 24px;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    border-top: 1px solid var(--border);
}
.cta h2 { font-size: 2rem; font-weight: 700; margin-bottom: 12px; }
.cta p { color: var(--text-secondary); margin-bottom: 28px; font-size: 1.1rem; }

.landing-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

/* ─── App Layout ────────────────────────────────────────────── */
.app-body { background: var(--bg); }

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    transition: transform 0.2s ease;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}
.avatar-placeholder {
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}
.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-weight: 600; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#sidebar-close { display: none; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 8px; }

.nav-section { margin-bottom: 24px; }

.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px;
    margin-bottom: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    font-family: var(--font);
}
.nav-item:hover { background: rgba(99, 102, 241, 0.08); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }

.nav-item .project-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 8px;
    border-top: 1px solid var(--border);
}

.logout { color: var(--text-muted); }
.logout:hover { color: var(--danger); background: #fef2f2; }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    max-width: 800px;
    padding: 0 24px 48px;
    width: 100%;
}

.main-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 0 16px;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 50;
}

.main-header h1 { font-size: 1.5rem; font-weight: 700; }

#sidebar-open { display: none; }

/* Add Task */
.add-task-area { margin-bottom: 16px; }

.add-task-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
}
.add-task-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.add-task-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow);
}

.add-task-form input[type="text"],
.add-task-form textarea,
.modal input[type="text"],
.modal textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    margin-bottom: 8px;
    transition: border-color var(--transition);
    resize: vertical;
}
.add-task-form input[type="text"]:focus,
.add-task-form textarea:focus,
.modal input[type="text"]:focus,
.modal textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.add-task-form input[type="text"]::placeholder,
.add-task-form textarea::placeholder,
.modal input[type="text"]::placeholder,
.modal textarea::placeholder {
    color: var(--text-muted);
}

.task-form-options { margin-top: 4px; }

.form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.form-row select,
.form-row input[type="date"] {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.825rem;
    font-family: var(--font);
    color: var(--text-secondary);
    background: var(--bg);
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.spacer { flex: 1; }

.hidden { display: none !important; }

/* Task List */
.task-list { margin-top: 8px; }

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    transition: all var(--transition);
    cursor: pointer;
}
.task-item:hover { box-shadow: var(--shadow); }
.task-item.done { opacity: 0.6; }

.task-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}
.task-checkbox:hover { border-color: var(--primary); }
.task-checkbox.priority-3 { border-color: var(--danger); }
.task-checkbox.priority-2 { border-color: var(--warning); }
.task-checkbox.priority-1 { border-color: #60a5fa; }
.task-checkbox.checked {
    background: var(--primary);
    border-color: var(--primary);
}
.task-checkbox.checked::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.task-content { flex: 1; min-width: 0; }
.task-title { font-size: 0.9rem; color: var(--text); word-break: break-word; }
.task-item.done .task-title { text-decoration: line-through; color: var(--text-muted); }
.task-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; word-break: break-word; }

.task-meta {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.task-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: #f1f5f9;
    color: var(--text-secondary);
    white-space: nowrap;
}
.task-tag.due { background: var(--primary-light); color: var(--primary); }
.task-tag.overdue { background: #fef2f2; color: var(--danger); }
.task-tag.project-tag { color: white; }

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state p { margin-top: 16px; font-size: 0.95rem; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
}

.modal-sm { max-width: 400px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 600; }

/* Color picker */
.color-picker { margin: 12px 0; }
.color-picker label { font-size: 0.825rem; color: var(--text-secondary); display: block; margin-bottom: 8px; }
.color-options { display: flex; gap: 8px; flex-wrap: wrap; }
.color-opt {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}
.color-opt:hover { transform: scale(1.15); }
.color-opt.selected { border-color: var(--text); box-shadow: 0 0 0 2px white inset; }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        padding: 48px 24px;
        gap: 40px;
    }
    .hero h1 { font-size: 2.2rem; }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    #sidebar-close { display: flex; }
    #sidebar-open {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: var(--radius);
        background: transparent;
        cursor: pointer;
    }
    .main-content {
        margin-left: 0;
        padding: 0 16px 48px;
    }
}

@media (max-width: 600px) {
    .hero h1 { font-size: 1.8rem; }
    .hero-subtitle { font-size: 1rem; }
    .features-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .form-row select,
    .form-row input[type="date"] { width: 100%; }
}
