@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Teko:wght@500;600;700&display=swap');

:root {
    --rioja: #a31e33;
    --rioja-oscuro: #741426;
    --rioja-claro: #c4253e;
    --negro: #111111;
    --tinta: #252026;
    --crema: #f7f4ef;
    --blanco: #ffffff;
    --borde: #e4ddd7;
    --sombra: 0 18px 45px rgba(46, 22, 29, 0.13);
    --radio: 6px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    min-height: 100%;
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    background: var(--crema);
    color: var(--tinta);
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    display: block;
    height: 10px;
    background: var(--rioja);
}

body::after {
    content: '';
    position: fixed;
    z-index: -1;
    inset: 10px 0 0;
    opacity: .42;
    pointer-events: none;
    background-image: linear-gradient(135deg, rgba(163, 30, 51, .045) 25%, transparent 25%, transparent 50%, rgba(163, 30, 51, .045) 50%, rgba(163, 30, 51, .045) 75%, transparent 75%);
    background-size: 34px 34px;
}

.contenedor {
    width: min(100% - 32px, 550px);
    margin: 0 auto;
    padding: 48px 0 36px;
    animation: aparecer .65s ease both;
}

.cabecera {
    position: relative;
    margin-bottom: 28px;
    padding: 8px 8px 20px;
    text-align: center;
}

.cabecera::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 58px;
    height: 5px;
    background: var(--rioja);
    transform: translateX(-50%) skewX(-28deg);
}

.cabecera h1,
h1 {
    margin: 0 0 6px;
    color: var(--negro);
    font-family: 'Teko', sans-serif;
    font-size: clamp(2.8rem, 12vw, 4.5rem);
    font-weight: 600;
    letter-spacing: .02em;
    line-height: .82;
    text-transform: uppercase;
}

.cabecera p {
    max-width: 420px;
    margin: 14px auto 0;
    color: #5f5658;
    font-size: .88rem;
    line-height: 1.6;
}

.tarjeta {
    position: relative;
    overflow: hidden;
    background: var(--blanco);
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    padding: 28px;
    box-shadow: var(--sombra);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tarjeta::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 92px;
    height: 7px;
    background: var(--rioja);
    transform: skewX(-35deg) translateX(18px);
}

.tarjeta-exito {
    text-align: center;
    align-items: center;
}

.tarjeta-exito h1 { color: var(--rioja); }

label {
    margin-top: 10px;
    color: var(--negro);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="password"] {
    width: 100%;
    padding: 12px 13px;
    color: var(--tinta);
    background: #fffdfb;
    border: 1px solid #d9d0ca;
    border-radius: 3px;
    font: inherit;
    font-size: .95rem;
    outline: 0;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

input:focus {
    border-color: var(--rioja);
    box-shadow: 0 0 0 3px rgba(163, 30, 51, .14);
    transform: translateY(-1px);
}

.selector-raciones {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selector-raciones input {
    width: 80px;
    text-align: center;
    font-weight: 700;
}

.btn-cantidad {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--negro);
    color: var(--blanco);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}

.btn-cantidad:hover,
.btn-cantidad:focus-visible { background: var(--rioja); transform: scale(1.08); }

.precio-info, .precio-total { margin: 5px 0; }

.precio-info { color: #71686a; font-size: .82rem; }

.precio-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid #eee7e1;
    font-size: .9rem;
    font-weight: 700;
    text-transform: uppercase;
}

.precio-total strong { color: var(--rioja); font-size: 1.4rem; }

.btn-pagar {
    margin-top: 14px;
    padding: 15px 18px;
    background: var(--rioja);
    border: 0;
    border-radius: 3px;
    color: var(--blanco);
    font: inherit;
    font-size: .86rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
    display: inline-block;
    transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.btn-pagar:hover,
.btn-pagar:focus-visible {
    background: var(--rioja-oscuro);
    box-shadow: 0 9px 18px rgba(116, 20, 38, .2);
    transform: translateY(-2px);
}

.nota {
    margin: 18px auto 0;
    color: #71686a;
    font-size: .75rem;
    line-height: 1.55;
    text-align: center;
}

.qr-imagen {
    width: 220px;
    height: 220px;
    margin: 14px 0;
    padding: 10px;
    background: var(--blanco);
    border: 6px solid var(--negro);
    border-radius: 3px;
}

.codigo-reserva {
    margin: 8px 0;
    padding: 10px 14px;
    background: #f7e9eb;
    border-left: 4px solid var(--rioja);
    color: var(--rioja-oscuro);
    font-size: 1.05rem;
}

.admin-page .contenedor-ancho {
    width: min(100% - 32px, 1100px);
    margin: 0 auto;
    padding: 34px 0 42px;
    animation: aparecer .65s ease both;
}

.admin-page h1 {
    font-size: clamp(2.4rem, 7vw, 4rem);
    line-height: .9;
}

.barra {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.acciones-admin {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.acciones-admin .btn-pagar { margin-top: 0; }

.btn-secundario { background: #777; }
.btn-peligro { background: #8d1b2d; }

.buscador-admin {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
}

.buscador-admin .btn-pagar { margin-top: 0; }

.error-admin {
    margin: 0;
    color: #a31e33;
}

.error-reserva {
    margin: 14px 0 0;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #a31e33;
    background: #fdecef;
    color: #a31e33;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.4;
}
.error-reserva[hidden] { display: none; }

.check-legal {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    font-size: .78rem;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1.45;
    text-transform: none;
}

.check-legal input {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin: 1px 0 0;
    accent-color: var(--rioja);
}

.nota-formulario {
    margin: 2px 0 0;
    color: #71686a;
    font-size: .75rem;
    line-height: 1.5;
}

.tabla-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    background: var(--blanco);
}

.tabla-admin {
    min-width: 760px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.tabla-admin th,
.tabla-admin td { white-space: nowrap; }

.tabla-admin td:nth-child(2),
.tabla-admin td:nth-child(3) { white-space: normal; }

.estado-mensaje {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-left: 4px solid var(--rioja);
    background: #f7e9eb;
}

.tabla-scroll {
    box-shadow: 0 10px 28px rgba(46, 22, 29, .08);
}

.tabla-admin {
    width: 100%;
    border-collapse: collapse;
    background: var(--blanco);
}

.tabla-admin th,
.tabla-admin td {
    padding: 14px 16px;
    border-bottom: 1px solid #eee7e1;
    text-align: left;
    font-size: .82rem;
    vertical-align: middle;
}

.tabla-admin th {
    background: #f8f2ed;
    color: var(--negro);
    font-size: .74rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.tabla-admin tbody tr:last-child td { border-bottom: 0; }
.tabla-admin tbody tr:hover { background: #fffaf7; }

.tabla-admin td small {
    display: inline-block;
    margin-top: 4px;
    color: #71686a;
    font-size: .74rem;
}

.badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-pagado { background: #e4f2e6; color: #246b2a; }
.badge-pendiente { background: #fff2cf; color: #866300; }
.badge-fallido { background: #fbe3e5; color: #a31e33; }
.badge-reembolsado { background: #eee9e6; color: #625854; }
.badge-canjeado { background: #e9e8e8; color: #454545; }

.lector-qr {
    width: min(100%, 440px);
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    background: var(--blanco);
}

.resultado-qr { margin-top: 16px; }

@keyframes aparecer {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 540px) {
    .contenedor { width: min(100% - 24px, 520px); padding-top: 38px; }
    .tarjeta { padding: 22px 18px; }

    .admin-page .contenedor-ancho {
        width: min(100% - 24px, 1100px);
        padding-top: 28px;
    }

    .admin-page h1 { font-size: clamp(2.2rem, 13vw, 3.2rem); }

    .barra-admin {
        align-items: stretch;
        flex-direction: column;
    }

    .acciones-admin { width: 100%; }
    .acciones-admin .btn-pagar { flex: 1 1 140px; }

    .buscador-admin {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .buscador-admin .btn-pagar { width: 100%; margin-top: 0; }

    .lector-qr { width: 100%; }

    .tabla-scroll {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .tabla-admin {
        min-width: 0;
        display: block;
        background: transparent;
    }

    .tabla-admin thead { display: none; }

    .tabla-admin tbody,
    .tabla-admin tr,
    .tabla-admin td { display: block; }

    .tabla-admin tr {
        margin-bottom: 12px;
        padding: 10px 14px;
        border: 1px solid var(--borde);
        border-radius: var(--radio);
        background: var(--blanco);
        box-shadow: 0 8px 20px rgba(46, 22, 29, .07);
    }

    .tabla-admin tbody tr:last-child { margin-bottom: 0; }

    .tabla-admin td {
        display: grid;
        grid-template-columns: minmax(80px, 34%) minmax(0, 1fr);
        gap: 12px;
        align-items: center;
        padding: 9px 0;
        border-bottom: 1px solid #f0ebe7;
        text-align: right;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .tabla-admin td:last-child { border-bottom: 0; }

    .tabla-admin td::before {
        content: attr(data-label);
        color: #71686a;
        font-size: .68rem;
        font-weight: 800;
        letter-spacing: .05em;
        text-align: left;
        text-transform: uppercase;
    }

    .tabla-admin td:first-child input { justify-self: end; }
    .tabla-admin td small { margin-top: 2px; }

    .tabla-admin td[colspan] {
        display: block;
        text-align: center;
    }

    .tabla-admin td[colspan]::before { display: none; }
}

body.pagina-reserva { overflow-y: auto; }

.reserva-grid { display: flex; flex-direction: column; gap: 16px; }
.reserva-grid > .tarjeta { width: 100%; }

.tarjeta-info h2 {
    margin: 0 0 4px;
    color: var(--negro);
    font-family: 'Teko', sans-serif;
    font-size: 1.9rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.lista-info { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.lista-info li { font-size: .88rem; line-height: 1.5; color: #5f5658; }
.lista-info li strong { display: block; color: var(--negro); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }

.resumen-pedido {
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px dashed var(--borde);
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: .92rem;
}
.resumen-pedido div { display: flex; justify-content: space-between; gap: 12px; }
.resumen-pedido .resumen-total { color: var(--rioja); font-size: 1.1rem; font-weight: 800; }

body.login-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}
body.login-page::before { flex: 0 0 10px; }
.login-page .contenedor { width: min(100% - 32px, 550px); margin: auto; padding: 24px 0; text-align: center; }
.login-page .tarjeta { text-align: left; }
.login-page .error-admin { text-align: center; }

@media (min-width: 901px) {
    body.pagina-reserva .contenedor { width: min(100% - 48px, 1000px); }
    body.pagina-reserva .cabecera { margin-bottom: 20px; }
    .reserva-grid {
        flex-direction: row;
        align-items: flex-start;
    }
    .reserva-grid > .tarjeta-info { flex: 0 0 340px; position: sticky; top: 24px; }
    .reserva-grid > form.tarjeta,
    .reserva-grid > .tarjeta:not(.tarjeta-info) { flex: 1 1 auto; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
