/* MyApex – přihlášení a přehled. Paleta vychází z barvy loga #6D2514. */
:root {
    --c-primary: #6d2514;
    --c-primary-hover: #551a0d;
    --c-primary-soft: #f4e5d9;
    --c-espresso: #2e140c;
    --c-mocha: #4a1d11;
    --c-latte: #b98b66;
    --c-cream: #f4e7da;

    --c-bg: #f3eadf;
    --c-surface: #fffaf5;
    --c-ink: #2a1710;
    --c-ink-muted: #6f5646;
    --c-ink-faint: #9a8270;
    --c-border: #dcc9b8;
    --c-border-strong: #a8876f;

    --c-error: #a12a1b;
    --c-error-bg: #fbe5e0;
    --c-info-bg: #f1e4d7;

    --radius: 10px;
    --radius-sm: 7px;
    --shadow: 0 1px 2px rgba(46, 20, 12, 0.06), 0 12px 32px rgba(46, 20, 12, 0.12);
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--c-ink);
    background-color: var(--c-bg);
    background-image:
        radial-gradient(ellipse 60% 50% at 0% 0%, rgba(185, 139, 102, 0.28), transparent 70%),
        radial-gradient(ellipse 50% 45% at 100% 100%, rgba(109, 37, 20, 0.14), transparent 70%);
    background-attachment: fixed;
}

h1, h2 { margin: 0; color: var(--c-ink); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }

/* ---------- Jazyky ---------- */
/* Do načtení překladu je stránka skrytá (bez probliknutí jiného jazyka). */
.i18n-loading body { visibility: hidden; }

:root[lang^="ar"] {
    --font: "Segoe UI", "Noto Sans Arabic", "Noto Sans Arabic UI", Tahoma, "Geeza Pro", "Arabic UI Text", sans-serif;
}
:root[lang^="ar"] h1, :root[lang^="ar"] h2 { letter-spacing: 0; }
:root[lang^="ar"] body { line-height: 1.7; }
/* E-mail a zkratka zůstávají zleva doprava, v arabštině zarovnané vpravo. */
[dir="rtl"] input[dir="ltr"] { text-align: right; }
[dir="rtl"] input[dir="ltr"]:placeholder-shown { direction: rtl; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.card-top { display: flex; justify-content: flex-end; margin: -8px 0 12px; }
.lang-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0 10px;
    height: 36px;
    border: 1px solid var(--c-border);
    border-radius: 999px;
    color: var(--c-ink-muted);
    font-weight: 500;
    cursor: pointer;
    transition: border-color 120ms ease;
}
.lang-switch:hover { border-color: var(--c-border-strong); }
.lang-switch:focus-within { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(109, 37, 20, 0.18); }
.lang-icon { flex-shrink: 0; color: var(--c-primary); }
.lang-select {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    color: var(--c-ink);
    font: inherit;
    font-size: 14px;
    padding-inline-end: 14px;
    cursor: pointer;
    outline: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--c-ink-muted) 50%), linear-gradient(135deg, var(--c-ink-muted) 50%, transparent 50%);
    background-size: 5px 5px, 5px 5px;
    background-position: calc(100% - 5px) 55%, 100% 55%;
    background-repeat: no-repeat;
}
[dir="rtl"] .lang-select { background-position: 0 55%, 5px 55%; }


/* ---------- Rozvržení přihlášení ---------- */
.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.login-shell {
    width: 100%;
    max-width: 920px;
    display: grid;
    grid-template-columns: 1fr;
    background: var(--c-surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.brand-panel { display: none; }

.login-card { padding: 32px 24px 28px; }

.login-logo { display: block; width: 200px; max-width: 70%; height: auto; margin: 0 auto 24px; }

.login-card h1 { font-size: 26px; text-align: center; }

.step-intro { margin: 8px 0 24px; text-align: center; color: var(--c-ink-muted); font-size: 15px; }

.page-footer { margin-top: 20px; font-size: 13px; color: var(--c-ink-faint); text-align: center; }
.page-footer a { color: var(--c-ink-muted); text-decoration: none; }
.page-footer .sep { margin: 0 8px; }
.page-footer a:hover { color: var(--c-primary); text-decoration: underline; }

@media (min-width: 800px) {
    .login-page { padding: 40px 24px; }
    .login-shell { grid-template-columns: 5fr 6fr; min-height: 560px; }

    .brand-panel {
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 44px 40px;
        color: var(--c-cream);
        background:
            radial-gradient(circle at 85% 12%, rgba(244, 231, 218, 0.10), transparent 40%),
            linear-gradient(160deg, var(--c-mocha) 0%, var(--c-primary) 55%, #7f3a22 100%);
        overflow: hidden;
    }
    /* Jemné "kroužky od šálku" jako dekorace. */
    .brand-panel::before, .brand-panel::after {
        content: "";
        position: absolute;
        border-radius: 50%;
        border: 1px solid rgba(244, 231, 218, 0.14);
        pointer-events: none;
    }
    .brand-panel::before { width: 360px; height: 360px; inset-inline-end: -140px; bottom: -120px; }
    .brand-panel::after { width: 240px; height: 240px; inset-inline-end: -80px; bottom: -60px; border-color: rgba(244, 231, 218, 0.10); }

    .brand-logo { width: 240px; max-width: 100%; height: auto; }
    .brand-copy h2 { color: var(--c-cream); font-size: 28px; margin-bottom: 12px; }
    .brand-copy p { margin: 0; color: rgba(244, 231, 218, 0.82); font-size: 15px; max-width: 30ch; }
    .brand-points { list-style: none; margin: 24px 0 0; padding: 0; font-size: 14px; color: rgba(244, 231, 218, 0.9); }
    .brand-points li { position: relative; padding-inline-start: 22px; margin: 8px 0; }
    .brand-points li::before {
        content: ""; position: absolute; inset-inline-start: 0; top: 0.5em;
        width: 8px; height: 8px; border-radius: 50%; background: var(--c-latte);
    }

    .login-card { padding: 48px 48px 40px; display: flex; flex-direction: column; justify-content: center; }
    .login-card .login-logo { display: none; }
    .login-card h1, .step-intro { text-align: start; }
}

/* ---------- Formulářové prvky ---------- */
.form-group { margin-bottom: 18px; }

label { display: block; margin-bottom: 6px; color: var(--c-ink); font-weight: 600; font-size: 14px; }

input[type="text"], input[type="email"] {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--c-ink);
    font: inherit;
    font-size: 16px;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
input[type="text"]::placeholder, input[type="email"]::placeholder { color: var(--c-ink-faint); }
input[type="text"]:hover, input[type="email"]:hover { border-color: var(--c-border-strong); }
input[type="text"]:focus, input[type="email"]:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(109, 37, 20, 0.18);
}
button:focus-visible, input[type="checkbox"]:focus-visible, a:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px;
}

button {
    width: 100%;
    padding: 13px 16px;
    background-color: var(--c-primary);
    color: #fffaf5;
    border: none;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 150ms ease, transform 80ms ease;
}
button:hover { background-color: var(--c-primary-hover); }
button:active { transform: translateY(1px); }
button:disabled { background-color: #c4ab98; color: #fffaf5; cursor: not-allowed; transform: none; }

.btn-link {
    width: auto;
    display: inline-block;
    margin-top: 16px;
    padding: 0;
    background: none;
    border: none;
    color: var(--c-primary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
.btn-link:hover { background: none; color: var(--c-primary-hover); }
.btn-link:disabled { background: none; color: var(--c-ink-faint); text-decoration: none; cursor: default; }
.links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; word-break: break-word; border-inline-start: 4px solid transparent; }
.alert[hidden] { display: none; }
.alert-error { background-color: var(--c-error-bg); color: var(--c-error); border-inline-start-color: var(--c-error); }
.alert-info { background-color: var(--c-info-bg); color: var(--c-ink); border-inline-start-color: var(--c-latte); }

.summary-box {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 12px;
    background-color: var(--c-info-bg);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--c-ink-muted);
}
.summary-box strong { color: var(--c-ink); word-break: break-all; }

.checkbox-group { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; margin: 0 0 20px; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--c-primary); flex-shrink: 0; }
.checkbox-group label { margin: 0; font-weight: 500; }
.hint { font-size: 13px; color: var(--c-ink-faint); margin-top: 4px; }

/* ---------- Bezpečnostní klíč (FIDO2) ---------- */
.key-visual { display: flex; justify-content: center; color: var(--c-primary); margin: 4px 0 12px; }
.key-hint { font-size: 14px; color: var(--c-ink); text-align: center; margin: 0 0 20px; }
#keyForm .links { margin-top: 14px; }

/* Honeypot: mimo obrazovku, ne display:none (některé boty skrytá pole vynechávají). */
.hp-field { position: absolute !important; inset-inline-start: -10000px !important; top: auto !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }

/* ---------- Kód z e-mailu: 6 políček nad průhledným skutečným polem ---------- */
.otp-wrap { position: relative; }
.otp-wrap input#otpCode { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; margin: 0; border: 0; opacity: 0; font-size: 16px; cursor: text; z-index: 1; }
.otp-cells { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp-cell {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: #ffffff;
    font-size: 26px;
    font-weight: 600;
    color: var(--c-ink);
    font-variant-numeric: tabular-nums;
    transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}
.otp-cell.filled { border-color: var(--c-border-strong); background: #fffdfb; }
.otp-wrap.focused .otp-cell.active { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(109, 37, 20, 0.18); }
.otp-wrap.focused .otp-cell.active:empty::after { content: ""; width: 2px; height: 26px; background: var(--c-primary); animation: otp-blink 1s steps(1) infinite; }
.otp-wrap.busy .otp-cell { background: var(--c-primary-soft); color: var(--c-ink-muted); }
.otp-wrap.error .otp-cell { border-color: var(--c-error); }
.otp-wrap.error .otp-cells { animation: otp-shake 300ms ease; }
@keyframes otp-blink { 50% { opacity: 0; } }
@keyframes otp-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (max-width: 360px) {
    .otp-cells { gap: 5px; }
    .otp-cell { height: 48px; font-size: 22px; }
}

/* ---------- Přehled ---------- */
.dashboard-body { padding: 24px 16px; }
.topbar { max-width: 800px; margin: 0 auto 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar img { width: 150px; height: auto; display: block; }
.topbar .lang-switch { background: var(--c-surface); }
.container { max-width: 800px; width: 100%; margin: 0 auto; background: var(--c-surface); padding: 32px; border-radius: 16px; box-shadow: var(--shadow); }
.container h1 { font-size: 24px; }
.profile-info { margin-top: 20px; padding: 16px 18px; background: var(--c-info-bg); border-radius: var(--radius-sm); border-inline-start: 4px solid var(--c-latte); }
.profile-info p { margin: 8px 0; font-size: 16px; color: var(--c-ink-muted); }
.bold { font-weight: 600; color: var(--c-ink); }
.actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.actions button { width: auto; padding: 11px 18px; }
.secondary { background-color: transparent; color: var(--c-primary); box-shadow: inset 0 0 0 1px var(--c-border-strong); }
.secondary:hover { background-color: var(--c-primary-soft); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
