/*
 * Guest and partner pages. Mobile first (360–390 px). Colours and sizes come only from the tokens in
 * tokens.css (loaded first); the Blade components live in resources/views/components/ui.
 * Type scale (guide §3): titles, subtitles and buttons in Medium; text boxes and small texts in Light.
 */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-base);
    font-size: var(--text-body);
    font-weight: var(--weight-light);
    line-height: var(--leading-text);
    color: var(--text);
    background: var(--bg);
}

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

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

[x-cloak] {
    display: none !important;
}

/* Header ---------------------------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: calc(var(--header-height) + var(--strip-height));
    padding: 0 16px var(--strip-height);
    color: var(--text-on-header);
    background: var(--bg-header);
}

/* Brand strip under every header (decorative: never behind text). */
.topbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--strip-height);
    background: var(--brand-gradient);
}

.topbar a {
    color: inherit;
}

.topbar-tools {
    display: flex;
    align-items: center;
    gap: 4px;
}

.logo {
    display: block;
    height: 36px;
    width: auto;
}

/* Two <img> per header: the theme shows the one that reads on its background. */
.logo-on-dark,
[data-theme="dark"] .logo-on-light {
    display: none;
}

[data-theme="dark"] .logo-on-dark {
    display: block;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
}

.icon-button svg {
    width: 22px;
    height: 22px;
}

.theme-icon-dark,
[data-theme="dark"] .theme-icon-light {
    display: none;
}

[data-theme="dark"] .theme-icon-dark {
    display: block;
}

/* One button: globe + current language, a tap switches to the other one. */
.lang-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 44px;
    min-height: 44px;
    padding: 0 6px;
    font-size: var(--text-small);
    font-weight: var(--weight-medium);
    text-decoration: none;
    border-radius: var(--radius);
}

.lang-switch svg {
    width: 20px;
    height: 20px;
}

/* Layout ---------------------------------------------------------------- */
.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 24px 16px;
}

.footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 16px;
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 16px 32px;
    font-size: var(--text-small);
    color: var(--text-muted);
}

.footer a {
    color: var(--text-muted);
}

.footer-mark {
    width: 20px;
    height: 20px;
}

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 16px;
}

h1 {
    font-size: var(--text-title);
    font-weight: var(--weight-medium);
    line-height: var(--leading-tight);
    margin: 0 0 16px;
}

/* The kits carry Light and Medium only: bold would be synthesized. */
strong,
b {
    font-weight: var(--weight-medium);
}

h2,
h3 {
    font-size: var(--text-subtitle);
    font-weight: var(--weight-medium);
    line-height: var(--leading-tight);
}

.muted {
    color: var(--text-muted);
}

.center {
    text-align: center;
}

/* Section titles under the coupon card ("Tus beneficios", "Historial de usos") match the greeting. */
.section-title {
    font-size: var(--text-title);
    font-weight: var(--weight-medium);
    margin: 28px 0 12px;
}

/* Forms ----------------------------------------------------------------- */
.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    margin-bottom: 6px;
    font-weight: var(--weight-medium);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: var(--tap-size);
    padding: 10px 12px;
    font: inherit;
    font-size: var(--text-input);
    color: var(--text);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
}

/* Selected (active) input: a 2 px line in the focus colour, no outer ring. */
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: inset 0 0 0 1px var(--focus);
}

/* Inactive fields, e.g. the hotel on the registration form. */
.field input[disabled],
.field input[readonly] {
    color: var(--text);
    background: var(--bg-muted);
}

.field-invalid input,
.field-invalid select,
.field-invalid textarea {
    border-color: var(--error-surface);
}

.field-error {
    margin-top: 6px;
    color: var(--error);
    font-size: var(--text-small);
}

.field.checkbox {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
}

.field.checkbox input {
    width: 24px;
    min-height: 24px;
    margin: 2px 0 0;
    accent-color: var(--primary);
}

.field.checkbox label {
    font-size: var(--text-small);
    font-weight: var(--weight-light);
}

.field.checkbox .field-error {
    grid-column: 1 / -1;
}

fieldset.plain {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.code-input {
    font-family: var(--font-code);
    font-size: 1.75rem;
    font-weight: var(--weight-medium);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3em;
    text-align: center;
}

/* Buttons --------------------------------------------------------------- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--tap-size);
    padding: 10px 16px;
    font: inherit;
    font-size: var(--text-button);
    font-weight: var(--weight-medium);
    line-height: var(--leading-tight);
    color: var(--primary-text);
    background: var(--primary);
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--primary-hover);
}

.button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.button[disabled] {
    opacity: 0.6;
    cursor: default;
}

.button-secondary {
    color: var(--text);
    background: transparent;
    border-color: var(--accent-secondary);
}

.button-secondary:hover {
    background: var(--bg-muted);
}

.button-danger {
    color: var(--error-on-surface);
    background: var(--error-surface);
}

.button-danger:hover {
    background: var(--error-surface);
    filter: brightness(0.9);
}

.button-ghost,
.button-link {
    color: var(--link);
    background: transparent;
}

.button-ghost:hover,
.button-link:hover {
    background: var(--bg-muted);
}

.button-link {
    margin-top: 8px;
}

.link-list {
    display: grid;
    gap: 12px;
}

.logout-form {
    margin-top: 24px;
}

/* Alerts and badges ----------------------------------------------------- */
.alert {
    margin-bottom: 16px;
    padding: 12px;
    font-size: var(--text-small);
    border-radius: var(--radius-control);
}

.alert-error {
    color: var(--error);
    background: var(--error-tint);
}

.alert-success {
    color: var(--success);
    background: var(--success-tint);
}

.alert-warning {
    color: var(--warning);
    background: var(--warning-tint);
}

/* Relevant information: navy text on the light blue of the palette. */
.alert-info {
    color: var(--text);
    background: var(--info-tint);
}

.validated {
    font-size: var(--text-subtitle);
    font-weight: var(--weight-medium);
}

.badge {
    display: inline-block;
    min-width: 24px;
    padding: 0 8px;
    font-size: var(--text-small);
    font-weight: var(--weight-medium);
    line-height: 24px;
    text-align: center;
    color: var(--text);
    background: var(--bg-muted);
    border-radius: 12px;
}

.badge-success {
    color: var(--success);
    background: var(--success-tint);
}

.badge-warning {
    color: var(--warning);
    background: var(--warning-tint);
}

.badge-error {
    color: var(--error);
    background: var(--error-tint);
}

/* Registration ---------------------------------------------------------- */
.suggestions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

/* Coupon ---------------------------------------------------------------- */
.coupon {
    display: grid;
    justify-items: center;
    gap: 12px;
    text-align: center;
}

/* Always dark modules on pure white, in both themes: light QR codes on dark fail many readers. */
.qr-card {
    display: inline-block;
    padding: 16px;
    background: var(--white);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.qr-card img {
    display: block;
    width: 240px;
    max-width: 100%;
    height: auto;
}

/* The digits sit in the middle of the box: the label row is as tall as the Copy button row
   (44 px tap size), so the space above and below the digits is the same. */
.code-display {
    display: grid;
    justify-items: center;
    gap: 8px;
    width: 100%;
    padding: 0 16px;
    background: var(--code-bg);
    border-radius: var(--radius);
}

.code-label {
    display: flex;
    align-items: center;
    min-height: var(--tap-size);
    font-size: var(--text-small);
}

.code-digits {
    font-family: var(--font-code);
    font-size: var(--text-code);
    font-weight: var(--weight-medium);
    font-variant-numeric: tabular-nums;
    line-height: var(--leading-tight);
}

.code-copy {
    width: auto;
    min-width: 120px;
    font-size: var(--text-small);
}

/* Over the code box only the letters change on hover, not the box behind them. */
.code-copy:hover {
    color: var(--link-hover);
    background: transparent;
}

/* Validity under the code: small, in the text colour. */
.coupon-validity {
    margin: 0;
    font-size: var(--text-small);
}

.coupon .alert,
.coupon form {
    width: 100%;
}

.list-card {
    margin-bottom: 12px;
    padding: 14px 16px;
}

/* Benefits by category (decision of 2026-11-18): one row of partner tiles per category, scrolling
   sideways to the right edge of the screen, never wrapping. */
.benefit-category {
    margin: 0 0 20px;
    padding-left: 12px;
}

.benefit-category-title {
    margin: 0 0 10px;
}

.merchant-row {
    display: flex;
    gap: 12px;
    margin: 0 -16px 0 0;
    padding: 4px 16px 10px 0;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}

/* No visible scrollbar on touch screens (design request of 2026-11-23): the row is swiped and the cut
   tile at the right edge shows there is more. With a mouse the scrollbar stays: it is how the row moves. */
@media (hover: none), (pointer: coarse) {
    .merchant-row {
        scrollbar-width: none;
    }

    .merchant-row::-webkit-scrollbar {
        display: none;
    }
}

.merchant-row li {
    flex: 0 0 auto;
    /* Room for the tile shadow: the first one touched the row edge and its shadow was cut. */
    margin-left: 5px;
    scroll-margin-left: 5px;
    scroll-snap-align: start;
}

.merchant-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 124px;
    height: 124px;
    padding: 12px;
    font: inherit;
    background: var(--tile-bg);
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow-tile);
    cursor: pointer;
}

.merchant-tile:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.merchant-tile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.merchant-initials {
    font-size: var(--text-title);
    font-weight: var(--weight-medium);
    line-height: var(--leading-tight);
    color: var(--tile-text);
}

.merchant-tile-small {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    padding: 4px;
    cursor: default;
}

.merchant-tile-small .merchant-initials {
    font-size: var(--text-subtitle);
}

/* The partner dialog, centered over a dimmed page. */
.merchant-dialog {
    width: min(100% - 32px, 448px);
    max-height: calc(100% - 48px);
    padding: 0;
    color: var(--text);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.merchant-dialog::backdrop {
    background: var(--backdrop);
}

.merchant-dialog-body {
    padding: 16px;
}

.merchant-dialog-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.merchant-dialog-head h2 {
    flex: 1;
    margin: 0;
    font-size: var(--text-title);
}

.merchant-dialog-x {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--tap-size);
    height: var(--tap-size);
    padding: 0;
    color: var(--text);
    background: transparent;
    border: 0;
    border-radius: var(--radius-control);
    cursor: pointer;
}

.merchant-dialog-x svg {
    width: 24px;
    height: 24px;
}

.merchant-benefits {
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
}

.merchant-benefit {
    padding: 14px 16px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.merchant-benefit p {
    margin: 6px 0;
}

.merchant-benefit-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 8px;
}

/* Not available now (already used, in progress, sold out, expired): shaded, with the reason. */
.merchant-benefit.is-unavailable {
    background: var(--bg-muted);
    border-style: dashed;
}

.merchant-benefit.is-unavailable > :not(.merchant-benefit-head),
.merchant-benefit.is-unavailable .list-card-title {
    opacity: 0.6;
}

.list-card-title {
    font-size: var(--text-subtitle);
    font-weight: var(--weight-medium);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--tap-size);
    margin: 8px 0;
}

.legal {
    max-width: 65ch;
    overflow-wrap: anywhere;
    line-height: 1.55;
}

/* Legal texts come as Markdown from the panel: sections, sub-sections and lists of a long policy. */
.legal h2 {
    font-size: calc(var(--text-subtitle) + 4px);
    margin: 28px 0 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.legal h3 {
    margin: 22px 0 6px;
    font-size: calc(var(--text-subtitle) + 2px);
}

/* The sticky header must not cover a heading reached by scrolling or a link. */
.legal h2,
.legal h3 {
    scroll-margin-top: 80px;
}

.legal p {
    margin: 0 0 12px;
}

.legal ul,
.legal ol {
    margin: 0 0 12px;
    padding-left: 22px;
}

.legal li + li {
    margin-top: 4px;
}

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

/* Partner screens ------------------------------------------------------- */
.back-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap-size);
    margin-bottom: 8px;
    color: var(--link);
}

.menu {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

/* Partner menu: one card per action. Each action sets its colour once (side bar, icon). */
.menu-item {
    --item-bar: var(--accent);
    --item-ink: var(--info);
    --item-tint: var(--info-tint);

    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    min-height: 76px;
    padding: 14px 16px;
    color: var(--text);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: 6px solid var(--item-bar);
    border-radius: var(--radius);
    text-decoration: none;
}

.menu-item:hover {
    background: var(--bg-muted);
}

.menu-progress {
    --item-bar: var(--warning-surface);
    --item-ink: var(--warning);
    --item-tint: var(--warning-tint);
}

.menu-redeem {
    --item-bar: var(--success-surface);
    --item-ink: var(--success);
    --item-tint: var(--success-tint);
}

.menu-history {
    --item-bar: var(--border-strong);
    --item-ink: var(--text-muted);
    --item-tint: var(--bg-muted);
}

.menu-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: var(--item-ink);
    background: var(--item-tint);
    border-radius: 50%;
}

.menu-icon svg {
    width: 24px;
    height: 24px;
}

.menu-text {
    display: grid;
    gap: 2px;
}

.menu-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-subtitle);
    font-weight: var(--weight-medium);
}

.menu-hint {
    font-size: var(--text-small);
    color: var(--text-muted);
}

.menu-chevron {
    width: 22px;
    height: 22px;
    color: var(--text-muted);
}

.menu-item .badge {
    color: var(--warning-on-surface);
    background: var(--warning-surface);
}

.scanner {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.scanner-view {
    width: 100%;
    overflow: hidden;
    border: 3px solid var(--accent);
    border-radius: var(--radius);
    background: var(--qr-dark);
}

.scanner-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.scanner-offscreen {
    position: absolute;
    left: -10000px;
    top: 0;
    width: 800px;
    height: 800px;
}

.result {
    display: grid;
    justify-items: center;
    gap: 6px;
    margin-bottom: 16px;
    padding: 40px 16px;
    text-align: center;
    border-radius: var(--radius);
}

.result-success {
    color: var(--success-on-surface);
    background: var(--success-surface);
}

.result-error {
    color: var(--error-on-surface);
    background: var(--error-surface);
}

.result-warning {
    color: var(--warning-on-surface);
    background: var(--warning-surface);
}

/* Partner outcome: fills most of the screen so it reads at arm's length. */
.result-full {
    min-height: 55vh;
    align-content: center;
}

.result-icon {
    width: 64px;
    height: 64px;
}

.result-title {
    font-size: var(--text-result);
    font-weight: var(--weight-medium);
    line-height: var(--leading-tight);
}

.result-guest {
    font-size: 1.5rem;
    font-weight: var(--weight-medium);
}

.hold {
    margin-bottom: 12px;
}

.hold-name {
    font-size: var(--text-subtitle);
    font-weight: var(--weight-medium);
}

.hold-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.hold-actions {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 8px;
    margin-top: 12px;
}

/* Working establishment of a shared partner account, above the menu (2026-11-25). */
.partner-current {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.partner-current-name {
    font-weight: var(--weight-medium);
    font-size: var(--text-title);
}

.partner-current-switch {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap-size);
    color: var(--link);
}

/* Establishment chooser: one card per establishment of the account. */
.establishment-choice {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 14px;
}

.establishment-choice .merchant-tile {
    width: 64px;
    height: 64px;
}

.establishment-choice form {
    grid-column: 1 / -1;
}

/* History card: edit the purchase details and, on the day of the redemption, revert it (2026-11-25).
   Two 44 px icon buttons next to the title: amber pencil (edit) and red undo arrow (revert). */
.list-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.history-actions {
    display: flex;
    flex-shrink: 0;
    gap: 8px;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-input);
    text-decoration: none;
}

.icon-button svg {
    width: 22px;
    height: 22px;
}

.icon-edit {
    color: var(--warning);
    background: var(--warning-tint);
}

.icon-revert {
    color: var(--error);
    background: var(--error-tint);
}

.icon-button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Cancelled (grey bar) and reverted (red bar) uses: shaded card, muted title (2026-11-25). */
.list-card.is-voided {
    background: var(--bg-muted);
    border-left: 4px solid var(--text-muted);
}

.list-card.is-reverted {
    border-left-color: var(--error);
}

.list-card.is-voided .list-card-title {
    color: var(--text-muted);
}

.list-card.is-voided .badge:not(.badge-error) {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

.photo-current {
    margin-top: 6px;
}

.purchase-details {
    margin-top: 16px;
}

.purchase-details h2 {
    margin: 0 0 4px;
}

.photo-preview {
    display: block;
    max-width: 100%;
    max-height: 240px;
    margin-top: 8px;
    border-radius: var(--radius-input);
}

.list-card .button {
    margin-top: 10px;
}

.filter {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}
