/* Waypar shell + shared building blocks. Each view adds its own view.css. */

@font-face {
    font-family: 'Waypar Script';
    src: url('../../assets/fonts/DancingScript.ttf') format('truetype');
    font-weight: 400 700;
    font-display: swap;
}

:root {
    --red: #C8102E;
    --red-dark: #9e0c24;
    --red-soft: #fdecef;
    --ink: #1f2328;
    --muted: #616b75;
    --line: #e3e6ea;
    --bg: #f6f7f9;
    --card: #ffffff;
    --ok: #1a7f37;
    --warn: #9a6700;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .05);
    color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* components set display; hidden must still win */
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--red); }
#view { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 16px 32px; }
#view[aria-busy="true"] { min-height: 60vh; }

.app-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 16px; border-top: 1px solid var(--line); background: #fff; }

.wordmark { font-family: 'Waypar Script', cursive; font-weight: 700; color: var(--red); }

/* --- building blocks used by every view --- */
h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
    background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #c9ced4; background: #fafbfc; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; }

input, select, textarea {
    font: inherit; font-weight: 400; color: var(--ink); width: 100%; min-height: 38px; padding: 7px 10px;
    border: 1px solid #cfd4da; border-radius: 8px; background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid rgba(200, 16, 46, .35); outline-offset: 1px; border-color: var(--red); }
input::placeholder, textarea::placeholder { color: #9aa1a9; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; align-content: start; }
.field > input, .field > select, .field > textarea { font-size: 15px; }
.field > span.err { color: var(--red); font-weight: 500; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.msg { padding: 10px 12px; border-radius: 8px; margin: 0 0 12px; }
.msg.error { background: #fff1f1; border: 1px solid #f0c2c2; color: #8a1020; }
.msg.ok { background: #effaf1; border: 1px solid #bfe5c8; color: #14532d; }
.msg.info { background: #f2f6ff; border: 1px solid #cdd9f5; color: #1e3a8a; }
.msg:empty { display: none; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--red-soft); color: var(--red-dark); }

table.data { width: 100%; border-collapse: collapse; background: #fff; }
table.data th, table.data td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; position: sticky; top: 0; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: #fff7f8; }

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

@media (max-width: 700px) {
    #view { padding: 14px 12px 24px; }
    .grid2, .grid3 { grid-template-columns: 1fr; }
    /* data tables become cards */
    table.data thead { display: none; }
    table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
    table.data tr { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 6px 4px; }
    table.data td { border: 0; padding: 3px 10px; }
    table.data td[data-label]:not(:first-child)::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; }
    table.data td:empty { display: none; }
}
