@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── Design Tokens ─────────────────────────────── */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --bg: #f0f2f7;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --card: #ffffff;
    --nav-h: 60px;
    --radius: 14px;
}

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

/* ─── Base ───────────────────────────────────────── */
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ─── Navbar ─────────────────────────────────────── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    height: var(--nav-h);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 16px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text);
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.brand-icon { font-size: 1.2rem; }
.brand-name { color: var(--text); }

/* navbar right section */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    font-weight: 700;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0;
}

.user-email {
    font-size: 0.82rem;
    color: var(--muted);
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Icon-only action buttons */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.18s;
    flex-shrink: 0;
    padding: 0;
}

.icon-btn:hover {
    background: #f1f5f9;
    border-color: var(--border);
    color: var(--text);
}

.icon-btn-danger { color: #94a3b8; }

.icon-btn-danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--danger);
}

/* Divider between email and icon buttons */
.nav-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 2px;
}

/* Upgrade button in nav */
.btn-pro-nav {
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    background-size: 200%;
    color: white;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    cursor: pointer;
    white-space: nowrap;
    animation: gradientMove 4s ease infinite;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-pro-nav:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168,85,247,0.4);
}

/* ─── Badge ──────────────────────────────────────── */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}
.badge-free {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}
.badge-pro {
    background: linear-gradient(135deg, #f59e0b, #ec4899);
    color: white;
    box-shadow: 0 2px 8px rgba(245,158,11,0.3);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.badge-pro:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245,158,11,0.45);
}

/* ─── Page Layout ────────────────────────────────── */
.card {
    background: var(--card);
    width: calc(100% - 32px);
    max-width: 520px;
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    padding: 32px;
    border: 1px solid var(--border);
    margin-top: 36px;
}

#app-container.card { max-width: 580px; }

/* ─── Auth Card ──────────────────────────────────── */
.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-icon {
    font-size: 2.4rem;
    margin-bottom: 10px;
}

h1 {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

#auth-subtitle {
    color: var(--muted);
    font-size: 0.875rem;
}

.input-group { margin-bottom: 16px; }

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.input-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #f8fafc;
    color: var(--text);
    transition: all 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.error-msg {
    color: var(--danger);
    font-size: 0.875rem;
    background: #fef2f2;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid #fecaca;
    text-align: center;
}

.divider {
    display: flex;
    align-items: center;
    margin: 22px 0;
    color: var(--muted);
    font-size: 0.8rem;
    gap: 10px;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.auth-switch {
    margin-top: 20px;
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted);
}
.auth-switch a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}
.auth-switch a:hover { text-decoration: underline; }

/* ─── Buttons ────────────────────────────────────── */
.auth-btn, #add-btn, .update, .delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 9px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.w-100 { width: 100%; }

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.btn-danger {
    background: white;
    color: var(--danger);
    border: 1px solid var(--border);
    padding: 8px 16px;
    font-size: 0.875rem;
}
.btn-danger:hover { background: #fef2f2; border-color: #fecaca; }

.btn-google {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.btn-google:hover { background: #f8fafc; border-color: #cbd5e1; }

/* ─── Quota Section (inside todo card) ───────────── */
.quota-section {
    background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(168,85,247,0.06));
    border: 1px solid rgba(99,102,241,0.18);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quota-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quota-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6366f1;
}

.quota-count {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
}

.quota-track {
    height: 6px;
    background: rgba(99,102,241,0.12);
    border-radius: 99px;
    overflow: hidden;
    width: 100%;
}

.quota-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    border-radius: 99px;
    transition: width 0.5s cubic-bezier(.4,0,.2,1);
    width: 0%;
}

.quota-cta {
    font-size: 0.78rem;
    font-weight: 600;
    color: #6366f1;
    text-decoration: none;
    text-align: center;
    opacity: 0.9;
    transition: opacity 0.15s;
}
.quota-cta:hover { opacity: 1; text-decoration: underline; }

/* ─── Current Plan Section ─────────────────────── */
.plan-section {
    background: linear-gradient(135deg, rgba(15,23,42,0.04), rgba(99,102,241,0.08));
    border: 1px solid rgba(99,102,241,0.16);
    border-radius: 16px;
    padding: 16px 18px;
    margin-bottom: 18px;
}

.plan-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.plan-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6366f1;
    margin-bottom: 4px;
}

.plan-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.plan-copy {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.88rem;
}

.plan-link-btn {
    border: 1px solid rgba(99,102,241,0.2);
    background: white;
    color: #6366f1;
    border-radius: 999px;
    padding: 8px 12px;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.plan-link-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(99,102,241,0.12);
    border-color: rgba(99,102,241,0.35);
}

/* ─── Todo Form ──────────────────────────────────── */
.form-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#task-input {
    flex: 1;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #f8fafc;
    color: var(--text);
    transition: all 0.2s;
}
#task-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

#add-btn {
    background: var(--primary);
    color: white;
    white-space: nowrap;
    padding: 12px 18px;
    border-radius: 9px;
}
#add-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* ─── Todo List ──────────────────────────────────── */
ul { list-style: none; }

li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

li:hover {
    background: white;
    border-color: #cbd5e1;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transform: translateY(-1px);
}

li span {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
    flex: 1;
    margin-right: 12px;
}

li.completed span {
    text-decoration: line-through;
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.update, .delete {
    padding: 6px 12px;
    font-size: 0.82rem;
    border-radius: 6px;
}

.update {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}
.update:hover { background: #d1fae5; }

.delete {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.delete:hover { background: #fee2e2; }

/* ─── Modal ──────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 36px 32px;
    max-width: 420px;
    width: 90%;
    position: relative;
    box-shadow: 0 24px 48px rgba(0,0,0,0.15);
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
    padding: 2px;
}
.modal-close:hover { color: var(--text); }

.modal-icon { font-size: 2.8rem; margin-bottom: 10px; }

.modal-card h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text);
    letter-spacing: -0.02em;
}

.modal-card p {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 4px;
    line-height: 1.6;
}

.pricing-box {
    margin: 20px 0;
    padding: 16px;
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(168,85,247,0.08));
    border-radius: 12px;
    border: 1px solid rgba(99,102,241,0.2);
}

.plan-options {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-top: 18px;
    justify-items: center;
}

.plan-option {
    width: min(100%, 220px);
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
    padding: 18px 16px;
    text-align: left;
    cursor: pointer;
    min-width: 0;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.plan-option:hover {
    transform: translateY(-2px);
    border-color: rgba(99,102,241,0.28);
    box-shadow: 0 16px 30px rgba(15,23,42,0.08);
}

.plan-option-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.plan-option-name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    min-width: 0;
    flex: 1 1 auto;
}

.plan-option-badge {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6366f1;
    background: rgba(99,102,241,0.1);
    padding: 5px 9px;
    border-radius: 999px;
    max-width: 100%;
    white-space: nowrap;
}

.plan-option-badge-strong {
    color: #b45309;
    background: rgba(245,158,11,0.14);
}

.plan-price-box {
    margin: 12px 0 14px;
}

.plan-option .modal-features {
    margin-bottom: 0;
}

.modal-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-feature {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
}

.plan-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: var(--muted);
    font-weight: 700;
}

.price-amount {
    font-size: 2.6rem;
    font-weight: 800;
    color: var(--primary);
}
.price-period {
    font-size: 1rem;
    color: var(--muted);
}

.modal-features {
    text-align: left;
    margin-bottom: 24px;
    list-style: none;
    padding: 0;
}
.modal-features li {
    padding: 7px 0;
    background: none;
    border: none;
    margin-bottom: 0;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: none;
    transform: none;
}
.modal-features li:hover {
    background: none;
    box-shadow: none;
    transform: none;
}

/* ─── Animations ─────────────────────────────────── */
@keyframes gradientMove {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* ─── Mobile ──────────────────────────────────────── */
@media (max-width: 600px) {
    .navbar { padding: 0 16px; }
    .user-email { display: none; }

    .card { margin-top: 20px; padding: 24px 18px; }

    .plan-header { flex-direction: column; }
    .plan-link-btn { width: 100%; }
    .plan-options { grid-template-columns: 1fr; }
    .plan-option { padding: 16px 14px; }
    .plan-option-top { align-items: flex-start; gap: 8px; }
    .plan-option-badge { font-size: 0.68rem; padding: 4px 8px; }
    .price-amount { font-size: 2.2rem; }
    .price-period { font-size: 0.92rem; }

    .form-container { flex-direction: column; }
    #add-btn { width: 100%; }

    li {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    li span { margin-right: 0; width: 100%; }
    .actions { width: 100%; justify-content: flex-end; }
    .update, .delete { flex: 1; }
}

/* ─── Cancel Subscription Modal ─────────────────── */
.cancel-modal-card {
    text-align: left !important;
}

.cancel-modal-icon {
    font-size: 2.4rem;
    margin-bottom: 12px;
    display: block;
    text-align: center;
}

.cancel-modal-card h2 {
    text-align: center;
    margin-bottom: 6px;
}

.cancel-modal-desc {
    text-align: center;
    margin-bottom: 20px !important;
}

.cancel-modal-desc strong {
    color: var(--primary);
}

/* Plan info rows */
.cancel-plan-info {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
}

.cancel-plan-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: none !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    transform: none !important;
    box-shadow: none !important;
}

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

.cancel-plan-row:hover {
    background: #f1f5f9 !important;
    transform: none !important;
    box-shadow: none !important;
}

.cancel-plan-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex: none !important;
    margin: 0 !important;
}

.cancel-plan-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    flex: none !important;
    margin: 0 !important;
}

/* Cancel button */
.cancel-sub-btn {
    width: 100%;
    padding: 13px;
    border: 2px solid var(--danger);
    background: white;
    color: var(--danger);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.cancel-sub-btn:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}

.cancel-sub-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cancel-sub-note {
    font-size: 0.78rem;
    color: var(--muted);
    text-align: center;
    line-height: 1.5;
}
