/* MyArenaID shared styles - same design language as the Game Sphere storefront
   (sibling app, same brand tokens). Every page gets this via layouts/app. */

:root {
    --color-dark: #16181D;
    --color-dark-rgb: 22 24 29;
    --color-accent: #E30613;
    --color-accent-rgb: 227 6 19;
    --color-accent-light: #FF4A54;
    --color-accent-dark: #C10011;
    --color-accent-2: #FF2D3F;
    --color-bg: #EDEFF2;
    --color-surface: #ffffff;
    --color-surface-2: #f1f2f4;
    --color-text: #16181D;
    --color-neutral: #666A72;
    --color-dim-2: #A6AAB2;
    --color-input-border: #d1d9df;
    --color-border: rgb(var(--color-dark-rgb) / .12);
    --color-border-hi: rgb(var(--color-accent-rgb) / .45);
    --color-good: #16a34a;
    --color-default: var(--color-bg);
    --grad-btn: linear-gradient(180deg, var(--color-accent-light) 0%, var(--color-accent) 50%, var(--color-accent-dark) 100%);
    --grad-soft: linear-gradient(135deg, rgb(var(--color-accent-rgb) / .10), rgb(var(--color-accent-rgb) / .04));
    --shadow-card: 0 4px 20px -8px rgb(var(--color-accent-rgb) / .14);
    --radius-card: 14px;
    --radius-control: 11px;

    --bs-body-font-family: 'Prompt', 'Segoe UI', Tahoma, sans-serif;
    --bs-link-color: var(--color-accent);
    --bs-link-color-rgb: var(--color-accent-rgb);
    --bs-link-hover-color: var(--color-accent-dark);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: 'Prompt', 'Segoe UI', Tahoma, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* ---------- header ---------- */
.site-header { background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .06); position: relative; z-index: 2; }
.site-header-inner { max-width: 960px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.site-header-logo img { height: 48px; display: block; }
@media (max-width: 420px) { .site-header-logo img { height: 40px; } }
.site-header-nav { display: flex; align-items: center; gap: 6px; }
.site-header-user {
    display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
    color: var(--color-text); text-decoration: none; font-size: 13px; font-weight: 600;
}
.site-header-user:hover { background: var(--color-surface-2); color: var(--color-accent); }
.site-header-user svg { width: 20px; height: 20px; color: var(--color-accent); flex-shrink: 0; }
.site-header-username { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-header-nav form { display: flex; margin: 0; }
.site-header-logout {
    background: none; border: none; cursor: pointer; width: 38px; height: 38px; border-radius: 50%;
    color: var(--color-neutral); display: flex; align-items: center; justify-content: center;
}
.site-header-logout:hover { background: var(--color-surface-2); color: var(--color-accent); }
.site-header-logout svg { width: 20px; height: 20px; }
@media (max-width: 420px) { .site-header-username { max-width: 90px; } }
/* MyArena service menu - same look as sf.myarenaonline.com's header nav */
.site-header-services { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.site-header-services a {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
    color: var(--color-text); font-size: 13px; font-weight: 600; text-decoration: none;
}
.site-header-services a:hover { background: var(--color-surface-2); color: var(--color-accent); }
.site-header-services svg { width: 18px; height: 18px; color: var(--color-accent); }
.site-header-services + .site-header-nav { padding-left: 8px; margin-left: 4px; border-left: 1px solid var(--color-border); }
@media (max-width: 640px) { .site-header-services .nav-label { display: none; } .site-header-services a { padding: 8px; } }
@media (max-width: 420px) { .site-header-inner { gap: 6px; } .site-header-services { gap: 0; } .site-header-services a { padding: 7px; }
    /* phone: name pill shrinks to its icon so logo + 4 services + account fit in 375px */
    .site-header-services + .site-header-nav .site-header-username { display: none; }
    .site-header-services + .site-header-nav { padding-left: 4px; margin-left: 2px; } }

/* ---------- page shell ---------- */
.page { flex: 1; width: 100%; padding: 28px 16px 40px; }
.page-auth { display: flex; align-items: center; justify-content: center; }
.page-auth > .card-panel, .page-auth > .page-inner { width: 100%; max-width: 440px; }
.page-account .page-inner { max-width: 560px; margin: 0 auto; }
.wrap { max-width: 560px; margin: 0 auto; }

/* ---------- footer ---------- */
.site-footer { background: #fff; border-top: 1px solid var(--color-border); padding: 18px 16px; text-align: center; }
.site-footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; margin-bottom: 8px; }
.site-footer-links a { color: var(--color-text); font-size: 13px; font-weight: 600; text-decoration: none; }
.site-footer-links a:hover { color: var(--color-accent); }
.site-footer-copy { font-size: 12px; color: var(--color-neutral); }

/* ---------- card + titles ---------- */
.card-panel {
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card);
    box-shadow: var(--shadow-card); width: 100%;
}
.card-panel-body { padding: 24px 22px; }
@media (max-width: 380px) { .card-panel-body { padding: 20px 16px; } }

.page-title {
    color: var(--color-accent); font-weight: 800; font-size: 1.5rem; line-height: 1.3;
    position: relative; display: inline-block; padding-bottom: .4rem; margin: 0 0 .5rem;
}
.page-title::after {
    content: ""; position: absolute; left: 0; bottom: 0; width: 56px; height: 3px;
    background: var(--color-accent); border-radius: 2px;
}
.page-subtitle { font-size: 14px; color: var(--color-neutral); margin: 0 0 20px; }

.back-link {
    display: inline-flex; align-items: center; gap: 4px; margin-bottom: 14px;
    font-size: 14px; font-weight: 600; color: var(--color-text); text-decoration: none;
}
.back-link:hover { color: var(--color-accent); }

.section-heading { font-size: 1.05rem; font-weight: 700; margin: 0 0 .75rem; }

/* ---------- form controls (Bootstrap overrides) ---------- */
.form-label, label.form-label { font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--color-text); }
.form-control, .form-select {
    border: 1px solid var(--color-input-border); border-radius: var(--radius-control);
    padding: .68rem 1rem; font-size: 15px; color: var(--color-text); background-color: #fff;
}
.form-control-sm { padding: .5rem .8rem; font-size: 14px; border-radius: 10px; }
.form-control::placeholder { color: var(--color-dim-2); }
.form-control:focus, .form-select:focus {
    border-color: var(--color-border-hi);
    box-shadow: 0 0 0 3px rgb(var(--color-accent-rgb) / .12);
    outline: none;
}
.form-control.is-invalid { border-color: #dc3545; }
.form-check-input:checked { background-color: var(--color-accent); border-color: var(--color-accent); }
.form-check-input:focus { border-color: var(--color-border-hi); box-shadow: 0 0 0 3px rgb(var(--color-accent-rgb) / .12); }
.invalid-feedback { font-size: 12px; }

.field-note { font-size: 12px; color: var(--color-neutral); margin-top: 6px; }

/* ---------- buttons ---------- */
/* Every button is a pill, same as .btn-brand - a square "ยกเลิก" next to a
   round primary looked inconsistent on every page (owner, 2026-09-27).
   Social login buttons keep their own .375rem (brand guidelines). */
.btn { border-radius: 999px; font-weight: 600; padding: .62rem 1.25rem; }
.btn-sm { border-radius: 999px; padding: .4rem .9rem; }

.btn-brand {
    background: var(--grad-btn); border: none; color: #fff; border-radius: 999px; padding: .75rem 1.5rem;
    box-shadow: 0 10px 22px -10px rgb(var(--color-accent-rgb) / .7);
    transition: transform .15s, filter .15s, box-shadow .15s;
}
.btn-brand.btn-sm { padding: .4rem 1rem; }
.btn-brand:hover, .btn-brand:focus-visible { color: #fff; filter: brightness(1.05); transform: translateY(-1px); }
.btn-brand:disabled, .btn-brand.disabled {
    background: #f1b3b8; color: #fff; box-shadow: none; transform: none; filter: none; opacity: 1;
}

.btn-outline-secondary {
    background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-text);
}
.btn-outline-secondary:hover, .btn-outline-secondary:focus-visible {
    background: var(--grad-soft); border-color: var(--color-border-hi); color: var(--color-text);
}
.btn-outline-secondary:disabled { background: var(--color-surface-2); border-color: var(--color-border); color: var(--color-dim-2); opacity: 1; }

.btn-outline-cancel { background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-neutral); }
.btn-outline-cancel:hover { background: var(--color-border); color: var(--color-text); }

.btn-outline-danger, .btn-outline-danger-confirm { background: #fff5f5; border: 1px solid rgb(220 38 38 / .4); color: #b91c1c; }
.btn-outline-danger:hover, .btn-outline-danger-confirm:hover { background: #fee2e2; border-color: rgb(220 38 38 / .6); color: #b91c1c; }
.btn-outline-danger:disabled, .btn-outline-danger-confirm:disabled { background: var(--color-surface-2); border-color: var(--color-border); color: var(--color-neutral); opacity: 1; }

.btn-send-otp { white-space: nowrap; font-size: 14px; }

/* ---------- alerts ---------- */
.alert { border: none; border-radius: 12px; font-size: 14px; }
.alert-danger { background: #fdecee; color: #b4121c; }
.alert-success { background: #e7f6ec; color: #15803d; }
.alert-secondary { background: var(--color-surface-2); color: var(--color-neutral); }
.alert-warning { background: #fff7e6; color: #92600a; }
.status-alert { background: #e7f6ec; color: #15803d; border-radius: 12px; padding: 10px 14px; font-size: 14px; margin-bottom: 16px; }

.info-note { border-radius: 12px; padding: .7rem .9rem; font-size: 13px; background: rgb(var(--color-accent-rgb) / .06); color: var(--color-neutral); }

.legal-note { font-size: 12px; color: var(--color-neutral); text-align: center; margin: 18px 0 0; line-height: 1.6; }
.legal-note a { color: var(--color-text); text-decoration: underline; text-decoration-color: var(--color-dim-2); text-underline-offset: 2px; }
.legal-note a:hover { color: var(--color-accent); text-decoration-color: var(--color-accent); }

/* ---------- password field + eye toggle (SVG icon via mask; button text is ignored) ---------- */
.password-group { position: relative; }
.password-group .form-control { padding-right: 48px; }
.password-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border: none; border-radius: 10px; padding: 0; cursor: pointer;
    font-size: 0; color: transparent; background: transparent;
}
.password-toggle::before {
    content: ""; position: absolute; inset: 10px; background: var(--color-neutral);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}
.password-toggle:hover { background: var(--color-surface-2); }
.password-toggle:hover::before { background: var(--color-accent); }

.password-checklist { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12px; }
.password-checklist li { color: var(--color-neutral); }
.password-checklist li.ok { color: var(--color-good); }
.password-checklist li.ok::before { content: "✓ "; }
.password-checklist li:not(.ok)::before { content: "• "; }
.password-match-note { font-size: 12px; margin-top: 6px; display: none; }
.password-match-note.mismatch { color: #d02929; display: block; }
.password-match-note.match { color: var(--color-good); display: block; }

/* ---------- OTP ---------- */
.otp-input { text-align: center; font-size: 1.4rem; letter-spacing: .3em; font-weight: 700; }
.otp-status { font-size: 13px; color: var(--color-good); margin-top: 6px; display: none; }
.otp-section { display: none; }

/* ---------- username/email helpers ---------- */
.email-row { display: flex; gap: 8px; align-items: stretch; }
.email-row input { flex: 1; min-width: 0; }
.email-suggestion { font-size: 12px; margin-top: 6px; display: none; color: var(--color-neutral); }
.email-suggestion button { border: none; background: none; padding: 0; color: var(--color-accent); text-decoration: underline; cursor: pointer; }
@media (max-width: 380px) { .email-row { flex-direction: column; } }
.username-status { font-size: 12px; margin-top: 6px; min-height: 18px; }
.username-status.checking { color: var(--color-neutral); }
.username-status.available { color: var(--color-good); }
.username-status.taken { color: #d02929; }
.username-status.failed { color: var(--color-neutral); }
/* ✓ / ✗ drawn as SVG masks (no emoji/text glyphs as icons) - the JS only sets the text. */
.username-status.available::before, .username-status.taken::before {
    content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 4px; vertical-align: -2px; background: currentColor;
}
.username-status.available::before {
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
}
.username-status.taken::before {
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E") center / contain no-repeat;
}
.username-status .retry-btn { border: none; background: none; padding: 0; color: var(--color-accent); text-decoration: underline; cursor: pointer; font-size: inherit; }

/* Why a disabled submit can't be pressed yet ("กรอกรหัสยืนยัน 6 หลัก · รอตรวจชื่อผู้ใช้"). */
.submit-hint { font-size: 12px; color: var(--color-neutral); text-align: center; margin-top: 6px; min-height: 0; }
.submit-hint:empty { display: none; }

/* Inline stroke icon next to text (badges, notes). */
.icon-inline { width: 14px; height: 14px; vertical-align: -2px; flex-shrink: 0; }

/* ---------- selectable options (tabs, method pickers) ---------- */
.choice-row { display: flex; gap: 8px; }
.choice {
    flex: 1; text-align: center; padding: 10px 8px; border-radius: 12px; cursor: pointer; margin: 0;
    font-size: 14px; font-weight: 600; color: var(--color-neutral); background: #fff;
    border: 1px solid var(--color-border); transition: border-color .15s, box-shadow .15s, background .15s;
}
.choice:hover { border-color: rgb(var(--color-accent-rgb) / .35); }
.choice.active, .choice:has(input:checked) {
    border-color: var(--color-accent); color: var(--color-text);
    box-shadow: 0 0 0 2px rgb(var(--color-accent-rgb) / .15);
    background: linear-gradient(160deg, rgb(var(--color-accent-rgb) / .07), rgb(var(--color-accent-rgb) / .02)), #fff;
}

/* ---------- status badges ---------- */
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-on { background: rgb(22 163 74 / .1); color: var(--color-good); }
.status-off { background: var(--color-surface-2); color: var(--color-neutral); }
.status-locked, .status-warn { background: rgb(var(--color-accent-rgb) / .08); color: var(--color-accent); }

/* ---------- settings list (account hub and similar) ---------- */
.settings-group-title { font-size: 13px; font-weight: 700; color: var(--color-neutral); margin: 22px 4px 8px; padding: 0; }
/* A group folded shut until clicked (office-only support panels on home, 2026-10-18). */
.settings-collapsible > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
.settings-collapsible > summary::-webkit-details-marker { display: none; }
.settings-collapsible > summary::before {
    content: ''; width: 7px; height: 7px; flex-shrink: 0; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(-45deg); transition: transform .15s ease;
}
.settings-collapsible[open] > summary::before { transform: rotate(45deg); }
.settings-collapsible > summary:hover { color: var(--color-accent); }
.settings-collapsible-note { font-weight: 400; font-size: 12px; color: var(--color-dim-2); }
.settings-group {
    background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-card);
    box-shadow: 0 4px 20px -10px rgb(var(--color-accent-rgb) / .12); overflow: hidden; margin-bottom: 0;
}
.settings-row {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; color: var(--color-text);
    border-top: 1px solid var(--color-border); -webkit-tap-highlight-color: rgb(0 0 0 / .05);
}
.settings-group > .settings-row:first-child, .settings-group > .settings-group-title + .settings-row { border-top: none; }
.settings-group > details:first-child > .settings-row, .settings-group > details:first-child > summary.settings-row { border-top: none; }
.settings-row:hover { background: #fafafb; color: var(--color-text); }
.settings-row-icon {
    width: 36px; height: 36px; border-radius: 10px; background: var(--color-surface-2); color: var(--color-accent);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.settings-row-icon svg { width: 18px; height: 18px; }
.settings-row-main { flex: 1; min-width: 0; }
.settings-row-label { font-weight: 600; font-size: 15px; }
.settings-row-hint { font-size: 12px; color: var(--color-neutral); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-row-chevron { color: var(--color-dim-2); flex-shrink: 0; }
.settings-row.danger .settings-row-label { color: var(--color-accent); }

/* ---------- misc ---------- */
.divider { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--color-dim-2); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--color-border); }
.text-muted { color: var(--color-neutral) !important; }

/* "เข้าแทนลูกค้า" banner - staff inside a customer's account (owner, 2026-12-01) */
.staff-access-banner { background: #b45309; color: #fff; position: sticky; top: 0; z-index: 5; }
.staff-access-banner-inner { max-width: 960px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.staff-access-banner form { margin: 0; }
