/* SONNE Radl-Challenge – mobile-first styles.
   Colors and font follow www.sonne-international.org (Enfold theme): brand yellow #FCC437, text #222/#525252, Open Sans.
   Deviation for readability: dark text on yellow buttons and darker gold links (the website's white-on-yellow has ~1.7:1 contrast). */

@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/open-sans-latin-400.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/open-sans-latin-600.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/open-sans-latin-700.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/open-sans-latin-800.woff2") format("woff2"); }

:root {
    --brand: #FCC437;            /* SONNE yellow (website primary) */
    --brand-hover: #FABA23;      /* website button hover */
    --brand-border: #DAA215;     /* website button border */
    --on-brand: #222222;         /* text on yellow */
    --link: #8A6508;             /* readable dark gold for links on white (≈5.6:1) */
    --brand-soft: #FFF8E3;
    --brand-soft-border: #F6DE9C;
    --text: #222222;
    --text-muted: #525252;
    --bg: #FFFFFF;
    --bg-page: #F0F0F0;
    --border: #E1E1E1;
    --green: #2E6B4F;
    --green-soft: #EEF4F0;
    --red: #B3261E;
    --red-soft: #FDECEA;
    --yellow-soft: #FFF4D6;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 2px 10px rgba(34, 34, 34, .06);
    --font: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-page);
}

img { max-width: 100%; height: auto; vertical-align: middle; }

a { color: var(--link); }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2, .h2 { font-size: 1.25rem; font-weight: 700; }

.center { text-align: center; }

/* ---------- Layout ---------- */

.app {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    max-width: 960px;
    margin: 0 auto;
    background: var(--bg);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand { display: flex; align-items: center; flex: none; }
.brand img { height: 52px; width: auto; }

/* Blazor's FocusOnNavigate moves focus to the h1 for screen readers – no visible outline needed there */
h1:focus, h1:focus-visible { outline: none; }

.topbar-user { display: flex; align-items: center; gap: 10px; }
.hello { font-size: .95rem; color: var(--text-muted); }
.hello strong { color: var(--text); }

.menu { position: relative; }
.menu summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: var(--brand-soft); }
.menu-icon { font-size: 1.3rem; color: var(--text); }

.menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(34, 34, 34, .12);
    padding: 6px;
    display: flex;
    flex-direction: column;
}
.menu-panel a, .menu-panel .link-button {
    display: block;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    font: inherit;
    text-align: left;
}
.menu-panel a:hover, .menu-panel .link-button:hover { background: var(--brand-soft); }
.menu-panel form { margin: 0; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }

.link-button { background: none; border: 0; width: 100%; cursor: pointer; }

.content {
    flex: 1;
    padding: 20px 16px 32px;
}

.narrow { max-width: 480px; margin: 0 auto; }

.footer {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    font-size: .95rem;
}
.footer a { color: var(--text); text-decoration: none; }
.footer span { color: var(--border); }

/* ---------- Components ---------- */

.hero-illustration { text-align: center; margin: 4px 0 8px; }
.hero-illustration img { width: 280px; }
.hero-illustration.small img { width: 200px; }

.lead { font-size: 1.05rem; color: var(--text-muted); margin: 0 0 20px; }
.hint { font-size: .9rem; color: var(--text-muted); margin: 6px 0 0; }
.hint img { margin-top: -2px; }

.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.card-title { font-size: 1.1rem; margin-bottom: 8px; }
.card p { margin: 4px 0; }

.card-hero {
    background: linear-gradient(180deg, var(--brand-soft), #FFFDF5);
    border-color: var(--brand-soft-border);
    position: relative;
    overflow: hidden;
}
.card-hero .hero-text { position: relative; z-index: 1; }
.hero-bike { position: absolute; right: 8px; top: 12px; width: 150px; opacity: .95; }
.big-number { font-size: 3rem; font-weight: 800; margin: 0 0 16px !important; letter-spacing: -.02em; }
.big-number span { font-size: 1.6rem; font-weight: 700; }

.grid-2 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }

.section { margin-top: 8px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head a { font-weight: 600; text-decoration: none; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.page-head h1 { margin: 0; }

.totals { display: flex; gap: 24px; }
.totals .label { display: block; font-size: .85rem; color: var(--text-muted); }
.totals .value { font-size: 1.5rem; font-weight: 800; }

.challenge-status { display: flex; gap: 8px; align-items: flex-start; color: var(--text-muted); font-size: .95rem; }
.challenge-status img { margin-top: 3px; }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.optional { font-weight: 400; color: var(--text-muted); }

.input {
    width: 100%;
    font: inherit;
    font-size: 1.05rem;   /* ≥16px prevents iOS zoom */
    padding: 13px 14px;
    border: 1.5px solid #BFC3C8;
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    min-height: 50px;
}
textarea.input { min-height: 72px; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(252, 196, 55, .35); }
.input-invalid { border-color: var(--red); }

.input-with-icon { position: relative; }
.input-with-icon img { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.input-with-icon .input { padding-left: 54px; padding-right: 48px; }
.input-with-icon .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

.field-error { color: var(--red); font-size: .92rem; margin: 6px 0 0; }

.checkbox { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.checkbox input { width: 22px; height: 22px; accent-color: var(--brand); }

.email-chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 14px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    word-break: break-all;
}
.email-chip a { font-size: .9rem; white-space: nowrap; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font: inherit;
    font-weight: 700;
    padding: 12px 20px;
    min-height: 48px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.btn-block { display: flex; width: 100%; }
.btn-lg { font-size: 1.15rem; min-height: 56px; }
.btn-primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand-border); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: var(--brand-soft); color: var(--text); border-color: var(--brand-soft-border); }
.btn-link { background: none; color: var(--link); text-decoration: underline; font-weight: 600; }
.btn-danger-outline { background: #fff; color: var(--red); border-color: #E8B4B0; }
.btn-danger-outline:hover { background: var(--red-soft); }

.delete-form { margin-top: 8px; }

/* ---------- Alerts ---------- */

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; }
.alert ul { margin: 0; padding-left: 20px; }
.alert-error { background: var(--red-soft); border-color: #F2C3BF; color: var(--red); }
.alert-success { background: var(--green-soft); border-color: #CFE0D5; color: var(--green); font-weight: 600; }
.alert-info { background: var(--brand-soft); border-color: var(--brand-soft-border); }
.alert-warning { background: var(--yellow-soft); border-color: #F2D98C; }

.success-banner { display: flex; align-items: center; gap: 12px; }

.notice {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: .95rem;
}
.notice-secure { background: var(--green-soft); color: var(--green); border: 1px solid #D5E3DA; }

/* ---------- Ride list ---------- */

.ride-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.ride-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    min-height: 64px;
}
a.ride-item:hover { border-color: var(--brand-soft-border); background: #FFFCF6; }
.ride-icon { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; }
.ride-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ride-date { font-weight: 600; }
.ride-comment { font-size: .9rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ride-km { font-weight: 800; font-size: 1.15rem; white-space: nowrap; }
.ride-km small { font-weight: 600; font-size: .85rem; color: var(--text-muted); }
.chevron { color: var(--text-muted); font-size: 1.5rem; }

.empty { padding: 24px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---------- Larger screens ---------- */

@media (max-width: 420px) {
    .hello { display: none; }
    .brand img { height: 42px; }
    .hero-bike { width: 110px; top: 18px; opacity: .6; }
    .big-number { font-size: 2.6rem; }
}

@media (min-width: 720px) {
    body { font-size: 17px; }
    .app { margin: 24px auto; min-height: calc(100vh - 48px); border-radius: 20px; box-shadow: 0 4px 30px rgba(34, 34, 34, .08); overflow: clip; }
    .topbar { padding: 16px 28px; border-radius: 20px 20px 0 0; }
    .content { padding: 32px 28px 40px; }
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .hero-bike { width: 220px; right: 24px; }
    .big-number { font-size: 3.6rem; }
    .card-hero .btn-lg { max-width: 420px; }
    h1 { font-size: 2rem; }
}

/* Visible keyboard focus (buttons, links, menu) */
a:focus-visible, .btn:focus-visible, .link-button:focus-visible, summary:focus-visible, .checkbox input:focus-visible {
    outline: 3px solid var(--brand-border);
    outline-offset: 2px;
}
