/* Design tokens mirror src/Todo.Maui/Resources/Styles/Colors.xaml + Styles.xaml
   exactly, so the web client reads as the same product as the MAUI app. */

@font-face {
    font-family: "Inter";
    font-weight: 400;
    src: url("fonts/Inter-Regular.ttf") format("truetype");
}
@font-face {
    font-family: "Inter";
    font-weight: 500;
    src: url("fonts/Inter-Medium.ttf") format("truetype");
}
@font-face {
    font-family: "Inter";
    font-weight: 600;
    src: url("fonts/Inter-SemiBold.ttf") format("truetype");
}
@font-face {
    font-family: "Inter";
    font-weight: 700;
    src: url("fonts/Inter-Bold.ttf") format("truetype");
}
@font-face {
    font-family: "Inter";
    font-weight: 800;
    src: url("fonts/Inter-ExtraBold.ttf") format("truetype");
}

:root {
    color-scheme: light dark;

    --bg: #F6F5F2;
    --surface: #FEFDFC;
    --surface-alt: #E9E8E3;
    --border: #D5D4D1;
    --text: #171611;
    --text-muted: #65635C;

    --accent: #3b63e0;
    --on-accent: #FFFFFF;

    --priority-high: #D33A3C;
    --priority-normal: #DA950B;
    --priority-low: #389560;

    --radius-card: 16px;
    --radius-field: 12px;
    --radius-pill: 999px;
    --shadow-card: 0 1px 2px rgba(23, 22, 17, 0.04), 0 8px 24px rgba(23, 22, 17, 0.06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #090E12;
        --surface: #13191F;
        --surface-alt: #21272E;
        --border: #2F363D;
        --text: #E5E8EC;
        --text-muted: #9299A1;

        --priority-high: #EF6661;
        --priority-normal: #EBA941;
        --priority-low: #59B47D;

        --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.3);
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

h1, h2, h3 {
    font-weight: 800;
    margin: 0 0 1.25rem;
}

h1 {
    font-size: 26px;
}

a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Top bar */
.top-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.top-bar .brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    font-size: 17px;
    margin-right: 1rem;
}

.top-bar .brand .dot {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: var(--accent);
    flex-shrink: 0;
}

.top-bar .nav-link {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    color: var(--text-muted);
}
.top-bar .nav-link:hover {
    text-decoration: none;
    color: var(--text);
}
.top-bar .nav-link.active {
    background: var(--accent);
    color: var(--on-accent);
}

main {
    max-width: 640px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Cards */
.card, .auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.auth-card {
    max-width: 380px;
    margin: 3rem auto;
}

/* Form fields */
label {
    display: block;
    margin-bottom: 1rem;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

input, select, textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.75rem;
    margin-top: 0.4rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-field);
    color: var(--text);
    font: inherit;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
}

textarea {
    min-height: 4.5rem;
    resize: vertical;
}

/* Checkboxes: circular, matching the mockup's round completion toggle —
   native checkbox reskinned rather than plain input[type=checkbox], and
   explicitly NOT covered by the generic input{width:100%} rule above
   (that rule stretching a checkbox's layout box is what broke the task
   list row layout before this rewrite). */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    min-width: 24px;
    margin: 0;
    padding: 0;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    cursor: pointer;
    display: inline-grid;
    place-content: center;
    flex-shrink: 0;
}

input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

input[type="checkbox"]:checked::after {
    content: "";
    width: 6px;
    height: 10px;
    border: solid var(--on-accent);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

input[type="checkbox"]:disabled {
    cursor: default;
}

/* Buttons */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.1rem;
    min-height: 40px;
    border-radius: var(--radius-field);
    border: none;
    background: var(--accent);
    color: var(--on-accent);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    filter: brightness(0.94);
}

button:disabled {
    opacity: 0.45;
    cursor: default;
    filter: none;
}

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

/* Segmented control (mode toggle, priority picker) */
.segmented {
    display: inline-flex;
    padding: 3px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
}

.segmented button {
    background: transparent;
    color: var(--text-muted);
    min-height: 34px;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-pill);
    font-size: 14px;
}

.segmented button.active {
    background: var(--accent);
    color: var(--on-accent);
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.filter-bar select {
    width: auto;
    margin-top: 0;
    flex: 1;
    min-width: 140px;
}

.filter-bar > button:last-child {
    margin-left: auto;
}

/* Task rows */
.task-row {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

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

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

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

.task-row.done .task-title {
    color: var(--text-muted);
    text-decoration: line-through;
}

.task-row .task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.25rem;
    font-size: 12px;
    color: var(--text-muted);
}

.task-row .task-meta .meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

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

.priority-low { background: var(--priority-low); }
.priority-normal { background: var(--priority-normal); }
.priority-high { background: var(--priority-high); }

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--surface-alt);
    border-radius: var(--radius-pill);
    padding: 0.2rem 0.7rem;
    font-size: 12px;
    font-weight: 500;
    text-transform: none;
    margin: 0.15rem 0.35rem 0.15rem 0;
}

.tag-chip a {
    color: var(--text-muted);
    font-weight: 700;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    margin: 0.75rem 0 1.25rem;
}

.inline-form input {
    width: auto;
    flex: 1;
    min-width: 160px;
    margin-top: 0;
}

.field-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.field-row input[type="checkbox"] {
    margin-top: 0;
}

.field-row label {
    margin-bottom: 0;
}

.error {
    color: var(--priority-high);
    font-weight: 500;
    font-size: 13px;
}

.empty-state {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
}
