/*
 * minihotel.css — brand overrides on top of Bootstrap (bootstrap.min.css),
 * loaded on every screen (admin and customer panel alike — see
 * partials/head.twig). Bootstrap is class-based/opt-in, so instead of a
 * global recolor we override the specific CSS custom properties each
 * Bootstrap component already reads (`--bs-btn-*`, `--bs-focus-ring-color`,
 * etc.) for the handful of components the customer panel actually uses.
 * Admin screens keep Bootstrap's own stock blue on purpose — only the
 * customer-facing panel needs the Minihotel brand palette.
 */

:root {
    /* ---- Paleta Minihotel ---- */
    --brand-primary:         #13509D;
    --brand-primary-hover:   #112941;
    --brand-primary-soft:    #E7F1FB;
    --brand-primary-border:  #C7D7E8;

    --brand-danger:          #FD2900;
    --brand-danger-hover:    #A6150E;
    --brand-danger-soft:     #FEF0ED;
    --brand-danger-border:   #F3C9C2;

    --brand-success:         #329D6B;
    --brand-success-strong:  #1F6B48;
    --brand-success-soft:    #EEF8F3;
    --brand-success-border:  #CBE7DA;

    --brand-warning:         #F5A428;
    --brand-warning-strong:  #8A5A0B;
    --brand-warning-soft:    #FEF6EA;
    --brand-warning-border:  #F6E0BC;

    --brand-heading:         #13212F;
    --brand-body:            #2a323a;
    --brand-muted:           #8A9AAB;
    --brand-page-bg:         #F1F5FA;
    --brand-card-bg:         #F8FAFC;
    --brand-line:            #DCE5EF;
    --brand-line-soft:       #EDF2F8;
    /* Column divider line for admin results tables (see .table-responsive
       th/td in admin.css) — close to --brand-line but kept as its own token
       since it's scoped to that one use, not every border in the app. */
    --brand-line-table:      #D9DFE6;

    /* Shared tokens some components below reuse regardless of framework
       (also read by admin.css) — not tied to any CSS library, just names
       worth keeping consistent across the app. */
    --brand-radius: 10px;
    --brand-shadow: 0 1px 2px rgba(19, 33, 47, .04);
    /* <button>/<a role=button> next to each other need the same line-height
       to compute to the same box height (see panel.css's button-sizing
       rule) — matches Bootstrap's own default body line-height. */
    --brand-line-height: 1.5;
}

/* Brand-colored .btn-* / .form-control overrides live in panel.css, not here —
 * this file loads on admin too, and admin intentionally keeps Bootstrap's
 * stock colors (see docs/notas-arquitectura.md § Bootstrap: one CSS
 * framework for the whole app). */

/* ---- Brand typography -------------------------------------------------
 * Both are loaded as Google Fonts in partials/head.twig; the generic
 * sans-serif fallback covers the (rare) case that request fails.
 */
h1, h2, h3, h4, h5, h6 {
    font-family: "Varela Round", sans-serif;
}

p, span, a, label, input, select, button {
    font-family: "Huninn", sans-serif;
}

/* Shared size for plain body-copy <p> (page intros, dialog confirmation
 * text) — the browser's default <p> size otherwise reads too large next to
 * the rest of the brand type scale.
 */
.panel-text {
    font-size: 0.9rem;
}

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

.form-container { max-width: 640px; margin-inline: auto; }
.panel-container { max-width: 820px; margin-inline: auto; }
.plans-container { max-width: 820px; margin-inline: auto; }
.new-subscription-container { max-width: 760px; margin-inline: auto; }

.actions { display: flex; flex-direction: column; gap: .75rem; }

/* align-items:center instead of the grid default (stretch): a <button>
 * doesn't stretch to fill a grid row like an <a role=button> does, so the
 * default stretch made the two look like different heights/shapes side by
 * side (e.g. "Keep my plan" vs "Continue" in the cancel form).
 */
.actions--row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; align-items: center; }

.btn-back {
    margin-bottom: 22px;
}

/* ---- Grid de datos de la suscripción --------------------------------
 * Label chico en mayúsculas + valor grande. Es lo que más levanta la
 * pantalla principal frente a la lista de párrafos "Status: active".
 * Columnas FIJAS (2) para que ningún track quede vacío mostrando el
 * fondo del gap.
 */
.metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--brand-line-soft);
    border-top: 1px solid var(--brand-line-soft);
    border-bottom: 1px solid var(--brand-line-soft);
    margin-top: 25px;
}

.metric { background: #fff; padding: 1.25rem 1.75rem; }

.metric > dt,
.metric-label {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--brand-muted);
    margin-bottom: .375rem;
}

.metric > dd,
.metric-value {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--brand-heading);
}

.metric-value small { font-size: .8625rem; font-weight: 500; color: var(--brand-body); }

/* ---- Badge de estado ------------------------------------------------ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .4375rem;
    border-radius: 999px;
    padding: .375rem .75rem;
    font-size: .8625rem;
    font-weight: 600;
}

.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.badge--active   { background: var(--brand-success-soft); color: var(--brand-success-strong); }
.badge--pending  { background: var(--brand-warning-soft); color: var(--brand-warning-strong); }
.badge--canceled { background: var(--brand-danger-soft);  color: var(--brand-danger-hover); }

/* ---- Planes --------------------------------------------------------- */
.plans-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    text-align: center;
}

@media (min-width: 768px) {
    .plans-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
}

.plan-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--brand-line);
    border-radius: 12px;
    padding: 1.5rem 1.375rem;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: .875rem;
}

.plan-card--current {
    border: 2px solid var(--brand-primary);
    box-shadow: 0 6px 20px rgba(19, 80, 157, .10);
}

.plan-card--current::before {
    content: attr(data-badge);
    position: absolute;
    top: -11px;
    left: 1.375rem;
    background: var(--brand-primary);
    color: #fff;
    font-size: .7375rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: .25rem .625rem;
    border-radius: 999px;
}

.plan-name { font-size: 1.15rem; font-weight: 700; color: var(--brand-heading); }
.plan-kicker { font-size: .7375rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-muted); }
.plan-price { font-size: 1.05rem; font-weight: 800; color: var(--brand-heading); letter-spacing: -.02em; }
.plan-price small { font-size: .85rem; font-weight: 500; color: var(--brand-body); }
.plan-card > :last-child { margin-top: auto; }

.plan-current-flag {
    background: var(--brand-card-bg);
    color: var(--brand-muted);
    border: 1px solid var(--brand-line);
    border-radius: var(--brand-radius);
    padding: .6875rem 1rem;
    font-size: .925rem;
    font-weight: 600;
    text-align: center;
}

/* ---- Alerts inline -------------------------------------------------- */
.alert {
    padding: 1rem 1.125rem;
    border-radius: var(--brand-radius);
    border-left: 4px solid;
    font-size: .925rem;
    line-height: 1.6;
    margin-top:25px;
}

.alert-info    { background: var(--brand-primary-soft); border-left-color: var(--brand-primary); color: var(--brand-primary); }
.alert-success { background: var(--brand-success-soft); border-left-color: var(--brand-success); color: var(--brand-success-strong); }
.alert-warning { background: var(--brand-warning-soft); border-left-color: var(--brand-warning); color: var(--brand-warning-strong); }
.alert-error   { background: var(--brand-danger-soft);  border-left-color: var(--brand-danger);  color: var(--brand-danger-hover); }



/* ---- Toasts --------------------------------------------------------
 * Contenedor fijo arriba a la derecha. Auto-dismiss 5s desde JS.
 */
.toast-stack {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 80;
    width: 340px;
    max-width: calc(100vw - 36px);
    display: flex;
    flex-direction: column;
    gap: .625rem;
}

.toast {
    display: flex;
    /* Bootstrap hides a .toast until its JS adds .show. This application
       renders its own toasts, so they must be visible as soon as Twig emits
       them, including post-redirect flash messages. */
    opacity: 1;
    gap: .75rem;
    align-items: flex-start;
    background: #fff;
    border: 1px solid var(--brand-line);
    border-left: 4px solid var(--brand-primary);
    border-radius: var(--brand-radius);
    padding: .8125rem .9375rem;
    box-shadow: 0 8px 24px rgba(19, 33, 47, .10);
    animation: toast-in .18s ease-out;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: none; }
}

.toast-title { font-size: .925rem; font-weight: 700; }
.toast-body  { font-size: .8625rem; line-height: 1.5; color: var(--brand-body); margin-top: 2px; }

.toast-close {
    background: transparent;
    border: none;
    color: var(--brand-muted);
    padding: 2px;
    margin: 0;
    width: auto;
    font-size: 1.05rem;
    line-height: 1;
}

.toast--success { background: var(--brand-success-soft); border-color: var(--brand-success-border); border-left-color: var(--brand-success); }
.toast--success .toast-title { color: var(--brand-success-strong); }
.toast--error   { background: var(--brand-danger-soft);  border-color: var(--brand-danger-border);  border-left-color: var(--brand-danger); }
.toast--error .toast-title   { color: var(--brand-danger-hover); }
.toast--warning { background: var(--brand-warning-soft); border-color: var(--brand-warning-border); border-left-color: var(--brand-warning); }
.toast--warning .toast-title { color: var(--brand-warning-strong); }
.toast--info    { background: var(--brand-primary-soft); border-color: var(--brand-primary-border); border-left-color: var(--brand-primary); }
.toast--info .toast-title    { color: var(--brand-primary); }

/* ---- Modales (native <dialog>, shared by admin and the customer panel) --
 * Bootstrap has no equivalent for a native <dialog> (its own modal is a
 * different component with its own JS/markup), so this reproduces the card
 * look by hand — the browser's own UA stylesheet already centers an open
 * <dialog> and dims the page via ::backdrop, this only adds the visual
 * polish. Same element and JS everywhere (interactions.twig's
 * closeDialogOnOverlayClick).
 */
dialog {
    max-width: min(90vw, 480px);
    border: none;
    border-radius: 14px;
    padding: 0;
    box-shadow: 0 24px 60px rgba(19, 33, 47, .28);
}

dialog::backdrop { background: rgba(19, 33, 47, .45); }

dialog > article { margin: 0; }

dialog > article > header,
dialog > article > footer {
    padding: .9375rem 1.25rem;
}

dialog > article > header { border-bottom: 1px solid var(--brand-line-soft); }
dialog > article > header h2 { margin: 0; font-size: 1.1rem; }

dialog > article > :not(header, footer) { padding: .9375rem 1.25rem; }

dialog > article > footer {
    border-top: 1px solid var(--brand-line-soft);
    background: var(--brand-card-bg);
    display: flex;
    justify-content: flex-end;
    gap: .625rem;
}

dialog > article > footer button { flex: none; margin: 0; width: auto; }

.step-label {
    font-size: .7375rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--brand-muted);
    margin-bottom: .5rem;
}

/* ---- Radio inputs styled as selectable cards ------------------------ */
.choice-list { display: flex; flex-direction: column; gap: .625rem; }

label.choice {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    border: 1px solid var(--brand-line);
    border-radius: var(--brand-radius);
    padding: .875rem 1rem;
    font-size: .925rem;
    color: var(--brand-heading);
    cursor: pointer;
    background: #fff;
    margin: 0;
}

.choice:hover { border-color: var(--brand-primary); }
.choice:has(input:checked) { border-color: var(--brand-primary); background: var(--brand-primary-soft); }
.choice input { margin: 0; flex: none; }


/* ---- Inputs --------------------------------------------------------- */
input:not([type=checkbox],[type=radio],[type=range]) {
    font-size: 0.85rem;
    padding: 10px;
    height: auto;
}

/* ---- Top bar (partials/topbar.twig) ---------------------------------
 * The one component every screen shares — customer panel and admin alike
 * include the same partial for it. Lives here (not in panel.css/admin.css)
 * because it's genuinely one component used by both, not a naming
 * coincidence to split apart.
 */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--brand-line);
    padding: 0px;
}

.topbar-inner {
    max-width: 1040px;
    margin-inline: auto;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: baseline;
    gap: 8px;
    text-decoration: none;
    line-height: 1;
}

.logo-img {
    display: block;
}

.topbar-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Language menu — see LocaleController and messages.es.yaml. A native
   <details>/<summary> dropdown, so it needs no JS of its own. */
.lang-select {
    position: relative;
}

.lang-select summary {
    background: #fff;
    color: var(--brand-heading);
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--brand-line);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 15px;
    font-weight: 400;
    cursor: pointer;
    list-style: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.lang-select summary:hover { background: var(--brand-line-soft); }

.lang-select[open] summary {
    border-color: var(--brand-primary);
}

/* Browsers render <summary> with a native disclosure triangle by default —
   dropped in favor of the .chevron span already in the markup. */
.lang-select summary::-webkit-details-marker { display: none; }
.lang-select summary::marker { content: ''; }

.lang-select .chevron {
    color: var(--brand-muted);
    font-size: 12px;
    transition: transform 0.15s ease;
}

.lang-select[open] .chevron { transform: rotate(180deg); }

.lang-select .flag { width: 20px; height: 15px; border-radius: 2px; object-fit: cover; vertical-align: middle; }

.lang-select-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 140px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--brand-line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    z-index: 10;
}

/* Browsers set `list-style` on the <li> itself (a bullet), which otherwise
   wins over `list-style: none` set on the parent <ul> — has to be reset here
   directly. */
.lang-select-menu li {
    list-style: none;
    width: auto;
    margin: 0;
    padding: 0;
}

.lang-select-menu li + li { margin-top: 2px; }

.lang-select-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 15px;
    color: var(--brand-heading);
    text-decoration: none;
}

.lang-select-menu a:hover { background: var(--brand-line-soft); }
.lang-select-menu a[aria-current="true"] { font-weight: 700; color: var(--brand-primary); }

/* Hebrew is the only RTL locale currently supported. Logical properties keep
   the normal layout intact while the few directional decorative details flip. */
[dir="rtl"] { direction: rtl; }
[dir="rtl"] .topbar-inner { flex-direction: row-reverse; }
[dir="rtl"] .plan-card--current::before { left: auto; right: 1.375rem; }
[dir="rtl"] .alert { border-left: 1px solid var(--brand-line); border-right: 4px solid; }
[dir="rtl"] .alert-info { border-right-color: var(--brand-primary); }
[dir="rtl"] .alert-success { border-right-color: var(--brand-success); }
[dir="rtl"] .alert-warning { border-right-color: var(--brand-warning); }
[dir="rtl"] .alert-error { border-right-color: var(--brand-danger); }
[dir="rtl"] .toast-stack { right: auto; left: 18px; }
[dir="rtl"] .toast { border-left: 1px solid var(--brand-line); border-right: 4px solid var(--brand-primary); }
[dir="rtl"] .toast--success { border-right-color: var(--brand-success); }
[dir="rtl"] .toast--error { border-right-color: var(--brand-danger); }
[dir="rtl"] .toast--warning { border-right-color: var(--brand-warning); }
[dir="rtl"] .toast--info { border-right-color: var(--brand-primary); }
[dir="rtl"] .lang-select-menu { right: auto; left: 0; }

.help-button {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--brand-line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--brand-primary);
    text-decoration: none;
}

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

/* Logout control in the topbar (admin screens only) — the <form> wrapping
   it shouldn't add any spacing of its own, so it sits inline with the help
   button instead of stacking on its own line. */
.topbar-logout-form { margin: 0; }

.topbar-controls .topbar-logout-button {
    margin: 0;
    height: 34px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--brand-line);
    background: #fff;
    color: var(--brand-heading);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.topbar-logout-button:hover { background: var(--brand-primary-soft); }

/* The logged-in admin's name/email, shown next to the logout control —
   links back to the admin panel's home screen (see topbar.twig). */
.topbar-admin-name {
    color: var(--brand-heading);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.topbar-admin-name:hover { text-decoration: underline; }

/* Small "Edit customer" shortcut above the subscription card on
   customer-panel.twig, shown only when an admin/manager is viewing it —
   see CustomerPanelController. Overrides the 20px top margin every other
   [role=button] gets (meant for buttons stacked below other content),
   since this one is the first thing in .panel-container. */
.edit-customer-link {
    margin-top: 0;
    margin-bottom: 12px;
}
