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

:root {
    --bg: #f5f5f5;
    --surface: #ffffff;
    --surface2: #f0f0f0;
    --border: #e0e0e0;
    --text: #1a1a1a;
    --text-muted: #6b6b6b;
    --accent: #4a90e2;
    --accent-hover: #357abd;
    --danger: #e05252;
    --danger-hover: #c43a3a;
    --success: #4caf7d;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --radius: 10px;
}

[data-theme="dark"] {
    --bg: #1a1a1a;
    --surface: #242424;
    --surface2: #2e2e2e;
    --border: #3a3a3a;
    --text: #f0f0f0;
    --text-muted: #9a9a9a;
    --accent: #5a9fe8;
    --accent-hover: #4a90e2;
    --danger: #e06060;
    --danger-hover: #c44444;
    --success: #5dbf8e;
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

h1, h2, h3, h4 {
    font-family: 'JetBrains Mono', monospace;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- TOPBAR --- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-logo {
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.5px;
}

.topbar-logo span {
    color: var(--accent);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

/* --- THEME TOGGLE --- */
.theme-toggle {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
    font-family: 'Inter', sans-serif;
}

.theme-toggle:hover {
    background: var(--border);
}

/* --- BUTTONS --- */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.2s, opacity 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

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

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-ghost:hover {
    background: var(--surface2);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* --- CARD --- */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    width: 100%;
}

/* --- LAYOUT --- */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* --- TABS --- */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.tab {
    padding: 10px 20px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* --- FORMS --- */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
}

label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
}

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

/* --- MESSAGES --- */
.msg-error {
    color: var(--danger);
    background: rgba(224,82,82,0.1);
    border: 1px solid rgba(224,82,82,0.3);
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.msg-success {
    color: var(--success);
    background: rgba(76,175,125,0.1);
    border: 1px solid rgba(76,175,125,0.3);
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* --- LIST ITEMS --- */
.list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.list-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.list-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--accent);
}

.list-card h3 {
    font-size: 15px;
    font-weight: 600;
}

.list-card .list-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- TASK ITEMS --- */
.task-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
    transition: box-shadow 0.2s;
}

.task-item:hover {
    box-shadow: var(--shadow);
}

.task-item.done {
    opacity: 0.6;
}

.task-item.done .task-title {
    text-decoration: line-through;
}

.task-checkbox {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.task-title {
    font-size: 15px;
    font-weight: 500;
    flex: 1;
}

.task-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

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

/* --- MODAL --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.modal h3 {
    margin-bottom: 20px;
    font-size: 18px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* --- CONFIRM DIALOG --- */
.confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    justify-content: center;
    align-items: center;
}

.confirm-overlay.open {
    display: flex;
}

.confirm-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.confirm-box p {
    margin-bottom: 20px;
    font-size: 15px;
    color: var(--text);
}

.confirm-box .modal-actions {
    justify-content: center;
}

/* --- BADGE --- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-private {
    background: rgba(224,82,82,0.15);
    color: var(--danger);
}

.badge-shared {
    background: rgba(74,144,226,0.15);
    color: var(--accent);
}

/* --- COMPLETED LABEL --- */
.completed-by {
    font-size: 12px;
    color: var(--success);
    margin-top: 4px;
}

/* --- PASSWORD TOGGLE --- */
.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 60px;
}

.toggle-pw {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
}

/* --- MOBILE --- */
@media (max-width: 600px) {
    .topbar {
        padding: 0 16px;
    }

    .topbar-logo {
        font-size: 17px;
    }

    .topbar-user {
        display: none;
    }

    .container {
        padding: 16px;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        padding: 10px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    .list-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 24px 16px;
    }

    .modal {
        margin: 16px;
        padding: 24px 16px;
    }

    .section-header h2 {
        font-size: 16px;
    }

    .invite-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .task-item {
        flex-wrap: wrap;
    }

    .task-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 8px;
    }
}