/* Web dashboard (/app). Standalone: doesn't load Bulma or the marketing CSS. */

:root {
    --tint: #802ecc;
    --tint-hover: #6f28b5;
    --tint-soft: #efdffd;
    --preview-bg: #f2f1f3;
    --bg: #f7f4fa;
    --surface: #ffffff;
    --text: #1d1a22;
    --text-muted: #6b6475;
    --border: #e6e0ec;
    --danger: #c62f4a;
    --danger-soft: #fde8ec;
    --success: #1f8a5b;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(29, 26, 34, 0.06), 0 4px 16px rgba(29, 26, 34, 0.05);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --tint: #b57cf0;
        --tint-hover: #c697f5;
        --tint-soft: #2e2240;
        --preview-bg: #24222a;
        --bg: #121016;
        --surface: #1c1a21;
        --text: #f1eef5;
        --text-muted: #a39cad;
        --border: #2e2a35;
        --danger: #ff6b84;
        --danger-soft: #3a1c24;
        --success: #4fcf93;
        --shadow: none;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 32px 0 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--text-muted); }
.small { font-size: 0.875rem; }

/* ── Header ── */

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.app-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 650;
    color: var(--text);
    white-space: nowrap;
}
.app-brand img { width: 32px; height: 32px; border-radius: 8px; }

.app-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.app-nav a {
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--text-muted);
    font-weight: 550;
    white-space: nowrap;
}
.app-nav a:hover { color: var(--text); background: var(--tint-soft); }
.app-nav a[aria-current="page"] { color: var(--tint); background: var(--tint-soft); }

@media (max-width: 640px) {
    .app-header-inner { flex-wrap: wrap; gap: 8px; }
    .app-brand span { display: none; }
    .app-nav { flex: 1 1 100%; order: 3; justify-content: space-between; gap: 0; }
    .app-nav a { padding: 6px 8px; font-size: 0.9rem; }
}

/* ── Page ── */

.app-main {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 16px 64px;
    flex: 1;
}

/* Kept quiet on purpose: muted, small, no background. */
.app-footer {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px 28px;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.app-footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.app-footer nav { display: flex; gap: 16px; }
.app-footer a { color: inherit; text-decoration: none; }
.app-footer a:hover { color: var(--text); }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.back-link { display: inline-block; margin-bottom: 12px; font-size: 0.9rem; }

/* ── Buttons ── */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
}
.button:hover { border-color: var(--tint); color: var(--tint); }
.button:disabled { opacity: 0.5; cursor: default; }
.button.primary { background: var(--tint); border-color: var(--tint); color: #fff; }
.button.primary:hover { background: var(--tint-hover); border-color: var(--tint-hover); color: #fff; }
.button.danger { color: var(--danger); }
.button.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.button.small { min-height: 32px; padding: 4px 12px; font-size: 0.85rem; }
.button.apple { background: #000; border-color: #000; color: #fff; min-height: 48px; width: 100%; font-size: 1rem; }
.button.apple:hover { background: #222; color: #fff; }
@media (prefers-color-scheme: dark) {
    .button.apple { background: #fff; border-color: #fff; color: #000; }
    .button.apple:hover { background: #e8e8e8; color: #000; }
}

.button-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Cards & lists ── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

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

.list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    color: inherit;
}
a.list-item:hover { border-color: var(--tint); color: inherit; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.date-badge {
    flex: none;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--tint-soft);
    color: var(--tint);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
}
.date-badge .day { font-size: 1.35rem; font-weight: 700; }
.date-badge .month { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }

.stats { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.875rem; color: var(--text-muted); }

.pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--tint-soft);
    color: var(--tint);
    font-size: 0.8rem;
    font-weight: 650;
}
.pill.neutral { background: var(--border); color: var(--text-muted); }

/* ── Template cards ── */

.template-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
/* Fixed height so tall photo strips and wide 4x6 prints share one row
   height; the design itself keeps its shape inside. */
.template-preview {
    height: 240px;
    padding: 16px;
    background: var(--preview-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.template-preview .design {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 4px;
    overflow: hidden;
    background: repeating-conic-gradient(var(--border) 0% 25%, var(--surface) 0% 50%) 50% / 16px 16px;
    box-shadow: 0 2px 10px rgba(29, 26, 34, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Landscape designs are limited by the card's width instead. */
.template-preview .design.is-wide { width: 100%; height: auto; }
.template-preview img,
.template-preview canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.template-preview .placeholder { color: var(--text-muted); font-size: 0.8rem; padding: 8px; text-align: center; }
.template-body { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.template-body .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Photos ── */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}
.photo {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    background: var(--border);
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .photo-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}
.photo:hover .photo-delete, .photo .photo-delete:focus-visible { opacity: 1; }
@media (hover: none) { .photo .photo-delete { opacity: 1; } }

/* ── Empty states ── */

.empty {
    text-align: center;
    padding: 48px 24px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
}
.empty strong { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: 4px; }

/* ── Sign-in ── */

.login-wrap { max-width: 420px; margin: 48px auto; }
.login-wrap .card { padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.login-logo { width: 64px; height: 64px; border-radius: 16px; }
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.qr-box {
    align-self: center;
    width: 208px;
    height: 208px;
    padding: 12px;
    border-radius: 12px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qr-box svg, .qr-box img { width: 100%; height: 100%; }
.steps { margin: 0; padding-left: 20px; color: var(--text-muted); font-size: 0.9rem; }

/* ── Messages ── */

.notice {
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--tint-soft);
    color: var(--text);
    font-size: 0.9rem;
}

.definition { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
.definition dt { color: var(--text-muted); }
.definition dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .definition { grid-template-columns: 1fr; } .definition dd { margin-bottom: 8px; } }

/* ── Filters (template library) ── */

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 550;
    cursor: pointer;
}
.filter:hover { color: var(--text); border-color: var(--tint); }
.filter.is-on { background: var(--tint); border-color: var(--tint); color: #fff; }
.template-card[hidden] { display: none; }

/* ── Forms ── */

.event-form { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; max-width: 560px; }
.event-form[hidden] { display: none; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; }
.field > span, .field > legend { font-size: 0.875rem; font-weight: 600; color: var(--text-muted); padding: 0; }
.field input[type="text"], .field input[type="datetime-local"], .field select {
    font: inherit;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
}
.field select {
    /* Own chevron so it sits inset like the text, not jammed against the edge. */
    appearance: none;
    -webkit-appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236b6475' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 8px;
    cursor: pointer;
}
@media (prefers-color-scheme: dark) {
    .field select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23a39cad' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    }
}
.field input:focus, .field select:focus { outline: 2px solid var(--tint); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--tint); }
