/* ================================================================
   main.css — Paleta del logo + estilos base mobile-first
   Colores extraídos de litorial.png:
     --c-primary : #000000  (negro del fondo del logo)
     --c-accent  : #e60012  (rojo de "CRONOMETRAJE")
     --c-base    : #ffffff
     --c-bg      : #f5f5f5  (fondo suave app)
   ================================================================ */

:root {
    --c-primary    : #000000;
    --c-accent     : #e60012;
    --c-base       : #ffffff;
    --c-bg         : #f5f5f5;
    --c-text       : #000000;
    --c-text-muted : #4a5568;
    --c-border     : #d1d9e6;
    --c-danger     : #e53e3e;
    --c-success    : #38a169;

    --radius       : 10px;
    --shadow       : 0 2px 12px rgba(0,0,0,.10);
    --font         : 'DM Sans', sans-serif;
    --transition   : 150ms ease;
}

/* ── Reset mínimo ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--c-bg);
    color: var(--c-text);
    min-height: 100vh;
    line-height: 1.6;
    position: relative;
    isolation: isolate;
}

body::before {
    content: "";
    position: fixed;
    inset: -18% -12%;
    background:
        radial-gradient(46% 38% at 14% 20%, rgba(230, 0, 18, 0.10) 0%, rgba(230, 0, 18, 0) 72%),
        radial-gradient(42% 34% at 84% 30%, rgba(0, 0, 0, 0.06) 0%, rgba(0, 0, 0, 0) 74%),
        radial-gradient(44% 36% at 54% 88%, rgba(180, 180, 180, 0.12) 0%, rgba(180, 180, 180, 0) 76%);
    filter: blur(18px);
    opacity: 0.9;
    z-index: -1;
    pointer-events: none;
    animation: bg-glow-float 16s ease-in-out infinite alternate;
}

@keyframes bg-glow-float {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    100% {
        transform: translate3d(0, -2.5%, 0) scale(1.04);
    }
}

@media (prefers-reduced-motion: reduce) {
    body::before {
        animation: none;
    }
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

/* Evita pequeños desbordes por subpíxel en mobile */
body {
    overflow-x: clip;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header / logo ───────────────────────────────────── */
.site-header {
    background: var(--c-primary);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.site-header img.logo {
    height: 80px;
    width: auto;
}
@media (min-width: 480px) {
    .site-header { padding: 14px 20px; }
    .site-header img.logo { height: 120px; }
}

/* ── Contenedor principal ─────────────────────────────── */
.container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 14px 12px 32px;
}
@media (min-width: 480px) {
    .container { padding: 20px 16px 40px; }
}

/* ── Card ─────────────────────────────────────────────── */
.card {
    background: var(--c-base);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 14px;
    margin-bottom: 16px;
}
@media (min-width: 480px) {
    .card { padding: 24px 20px; margin-bottom: 20px; }
}

/* ── Títulos ──────────────────────────────────────────── */
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: clamp(1.3rem, 5vw, 1.8rem); color: var(--c-primary); }
h2 { font-size: clamp(1.1rem, 4vw, 1.4rem); color: var(--c-primary); margin-bottom: 12px; }
h3 { font-size: 1rem; color: var(--c-text-muted); font-weight: 600; }

/* ── Bloque info evento ───────────────────────────────── */
.event-info {
    background: var(--c-primary);
    color: var(--c-base);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: grid;
    gap: 8px;
}
.event-info p { font-size: .95rem; display: flex; align-items: flex-start; gap: 8px; }
.event-info strong { color: var(--c-accent); min-width: 110px; display: inline-block; }
.event-info a { color: var(--c-accent); }
.event-info__flyer {
    margin: -4px -4px 14px;
    border-radius: 8px;
    overflow: hidden;
    line-height: 0;
}
.event-info__flyer img {
    width: 100%;
    height: auto;
    display: block;
}
.event-info__head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 4px;
}
.event-info__head-text {
    flex: 1;
    min-width: 0;
}
.event-info__beneficios {
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.15);
}
.event-info__beneficios-titulo {
    font-size: .95rem;
    color: var(--c-accent);
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.beneficios-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}
.beneficios-grid__item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    font-size: .88rem;
    line-height: 1.4;
}
.beneficios-grid__icon {
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
}
.beneficios-grid__texto {
    display: grid;
    gap: 2px;
}
.beneficios-grid__texto strong {
    color: var(--c-base);
    font-size: .9rem;
}
.beneficios-grid__texto span {
    color: rgba(255,255,255,.88);
    font-size: .84rem;
}
.event-info__logo {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}
.event-info__logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.event-info__logo-carrera {
    height: 72px;
    width: auto;
    max-width: min(100%, 220px);
}
.event-info__logo-provincial {
    height: 72px;
    width: auto;
    max-width: 72px;
}
.event-info__titulo {
    font-size: clamp(1.15rem, 4.5vw, 1.45rem);
    color: var(--c-base);
    text-align: center;
    line-height: 1.2;
    margin: 0;
}
.event-info__subtitulo {
    text-align: center;
    font-size: .88rem;
    color: var(--c-accent);
    font-weight: 600;
    line-height: 1.35;
    margin: -2px 0 4px;
}
.event-info__descripcion {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,.15);
    font-size: .88rem;
    line-height: 1.45;
}
.event-info__texto {
    margin: 0 0 6px;
}
.event-info__lista {
    margin: 6px 0 0;
    padding-left: 18px;
}
.event-info__tagline {
    margin: 10px 0 0;
    text-align: center;
    font-weight: 700;
    font-size: .82rem;
    letter-spacing: .03em;
    color: var(--c-accent);
}
.event-info__logo img {
    height: 88px;
    width: auto;
    max-width: 100%;
}
.event-info__precios {
    display: grid;
    gap: 6px;
}
.event-info__precios > strong {
    display: block;
    min-width: 0;
}
.precios-lista {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}
.precios-lista__item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: .88rem;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,.08);
}
.precios-lista__item--vigente {
    background: rgba(230,0,18,.22);
    font-weight: 700;
}
.event-info__precios-nota {
    font-size: .82rem;
    margin-top: 8px;
    color: var(--c-accent);
    font-weight: 600;
    line-height: 1.4;
}
.event-info__reglamento {
    margin-top: 4px;
}
.btn-reglamento {
    width: auto;
    color: var(--c-base) !important;
    border-color: var(--c-base) !important;
}
.btn-reglamento:hover {
    background: var(--c-accent) !important;
    border-color: var(--c-accent) !important;
    color: var(--c-base) !important;
    text-decoration: none;
}

@media (max-width: 479px) {
    .event-info p {
        display: block;
    }
    .event-info strong {
        min-width: 0;
        display: block;
        margin-bottom: 2px;
    }
    .event-info__subtitulo {
        text-align: left;
    }
    .event-info__titulo {
        text-align: left;
    }
    .event-info__head {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .event-info__head-text .event-info__titulo,
    .event-info__head-text .event-info__subtitulo {
        text-align: center;
    }
}

/* Compacto mobile: menos aire lateral y vertical */
@media (max-width: 767px) {
    .site-header {
        padding: 8px 10px;
        overflow-x: clip;
    }
    .site-header img.logo {
        height: 72px;
    }
    .container {
        padding: 8px 8px 20px;
        max-width: 100%;
        overflow-x: clip;
    }
    .event-info {
        padding: 12px 14px;
        margin-bottom: 12px;
    }
    .card {
        padding: 14px 12px;
        margin-bottom: 12px;
    }
    .form-group {
        margin-bottom: 12px;
    }
    .form-control {
        padding: 10px 12px;
    }

    /* Blindaje anti-overflow por textos largos o elementos internos */
    .container > *,
    .card,
    .event-info,
    .pago-bloque,
    .file-label,
    .pago-card,
    .pago-row,
    .form-group,
    .form-control {
        min-width: 0;
        max-width: 100%;
    }
    .event-info p,
    .pago-row,
    #file-name {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

/* ── Formulario ───────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 5px;
}
.form-group label .req { color: var(--c-accent); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 11px 14px;
    font-size: 1rem;
    font-family: var(--font);
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-base);
    color: var(--c-text);
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    appearance: none;
}
.form-control:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(230,0,18,.18);
}
.form-control.is-invalid { border-color: var(--c-danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(229,62,62,.15); }

.form-hint {
    font-size: .78rem;
    color: var(--c-text-muted);
    margin-top: 4px;
}
.form-hint-mobile { color: var(--c-accent); font-weight: 600; }
.form-error {
    font-size: .78rem;
    color: var(--c-danger);
    margin-top: 4px;
    display: none;
}
.form-error.visible { display: block; }

.btn-date-open {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: var(--radius);
    border: 1.5px solid var(--c-accent);
    background: #fff0f0;
    color: var(--c-primary);
    font-size: .84rem;
    font-weight: 700;
    cursor: pointer;
}
.btn-date-open:hover { background: var(--c-accent); color: #fff; }

input[type="date"].form-control { cursor: pointer; }

/* Grilla de 2 columnas en pantallas ≥ 480px */
.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0 16px;
}
.fecha-nac-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 8px;
}
.form-group--full {
    grid-column: 1 / -1;
}
@media (max-width: 479px) {
    .fecha-nac-grid {
        grid-template-columns: 1fr;
    }
}
@media (min-width: 480px) {
    .form-row { grid-template-columns: 1fr 1fr; }
}

/* ── Bloque de pago ──────────────────────────────────── */
.pago-bloque {
    border: 1.5px solid var(--c-accent);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    background: #fef2f2;
}
.pago-monto {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 14px 16px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    background: var(--c-primary);
    color: var(--c-base);
}
.pago-monto__label {
    font-size: .85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    opacity: .9;
}
.pago-monto__valor {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--c-accent);
    line-height: 1;
}
.btn-copiar-monto {
    margin-left: auto;
    border-color: var(--c-base);
    color: var(--c-base);
}
.btn-copiar-monto:hover {
    background: var(--c-accent);
    border-color: var(--c-accent);
    color: var(--c-base);
}
.pago-bloque h3 { color: var(--c-primary); margin-bottom: 12px; font-size: .95rem; text-transform: uppercase; letter-spacing: .03em; }
.pago-bloque > p { margin-bottom: 14px; }
.pago-card {
    background: var(--c-base);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    font-size: .875rem;
    line-height: 1.7;
}
.pago-card-nombre { font-weight: 700; color: var(--c-primary); margin-bottom: 4px; }
.pago-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pago-row span { word-break: break-all; }
.btn-copiar {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: .75rem;
    font-weight: 600;
    border: 1.5px solid var(--c-accent);
    border-radius: 20px;
    background: transparent;
    color: var(--c-accent);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}
.btn-copiar:hover { background: var(--c-accent); color: #fff; }
.btn-copiar.copiado { background: var(--c-success); border-color: var(--c-success); color: #fff; }
.copiable {
    cursor: pointer;
    border-bottom: 1px dashed var(--c-accent);
    transition: color .15s;
    user-select: all;
}
.copiable:hover { color: var(--c-accent); }
.copiable-wrap { display:inline-flex; align-items:center; gap:5px; }
.copiable-ok {
    font-size:.72rem;
    color: var(--c-success);
    font-weight:600;
    opacity:0;
    transition: opacity .2s;
}
.copiable-ok.visible { opacity:1; }

/* ── File upload ─────────────────────────────────────── */
.file-label {
    display: flex;
    position: relative;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border: 1.5px dashed var(--c-border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: .9rem;
    color: var(--c-text-muted);
    background: var(--c-base);
    transition: border-color var(--transition);
}
.file-label:hover, .file-label:focus-within { border-color: var(--c-accent); color: var(--c-text); }
.file-label svg { flex-shrink: 0; }
.file-label input[type="file"] { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
#file-name { font-size: .82rem; color: var(--c-text); word-break: break-all; }

/* ── Botón CTA ──────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 28px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    text-decoration: none;
}
.btn-primary {
    background: var(--c-accent);
    color: var(--c-base);
    width: 100%;
}
.btn-primary:hover:not(:disabled) { background: #c40010; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-secondary {
    background: transparent;
    color: var(--c-primary);
    border: 1.5px solid var(--c-primary);
}
.btn-secondary:hover { background: var(--c-primary); color: var(--c-base); }

.btn-sm { padding: 7px 14px; font-size: .85rem; width: auto; }

/* ── Alertas ─────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: .9rem;
    margin-bottom: 16px;
}
.alert-danger  { background: #fff5f5; border: 1px solid #fc8181; color: #742a2a; }
.alert-success { background: #f0fff4; border: 1px solid #68d391; color: #22543d; }
.alert-info    { background: #fef2f2; border: 1px solid #fca5a5; color: #7f1d1d; }

/* ── Spinner ──────────────────────────────────────────── */
.spinner {
    width: 18px; height: 18px;
    border: 3px solid rgba(0,0,0,.2);
    border-top-color: var(--c-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: none;
}
.btn-primary:disabled .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tabla admin ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--c-border); text-align: left; }
th { background: var(--c-primary); color: var(--c-base); font-weight: 600; white-space: nowrap; }
tr:hover td { background: #f5f5f5; }
td .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-pendiente  { background: #fefcbf; color: #744210; }
.badge-confirmado { background: #c6f6d5; color: #22543d; }
.badge-anulado    { background: #fed7d7; color: #742a2a; }

/* ── Admin nav ───────────────────────────────────────── */
.admin-nav {
    background: var(--c-primary);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.admin-nav a { color: var(--c-base); font-weight: 600; font-size: .9rem; }
.admin-nav a:hover { color: var(--c-accent); }

/* ── Miniatura comprobante (listado admin) ────────── */
.thumb-comp {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    object-fit: cover;
    border-radius: 5px;
    border: 1.5px solid var(--c-border);
    cursor: zoom-in;
    display: block;
    transition: opacity .15s;
}
.thumb-comp:hover { opacity: .8; }
.thumb-pdf {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff3f3;
    border: 1.5px solid #ffb3b3;
    border-radius: 5px;
    font-size: .65rem;
    font-weight: 700;
    color: #c53030;
    cursor: pointer;
    text-decoration: none;
}

/* ── Lightbox modal ────────────────────────── */
#lightbox {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0,0,0,.82);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    box-sizing: border-box;
}
#lightbox.open { display: flex; }
#lightbox img {
    max-width: 94vw;
    max-height: 78vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,.5);
    object-fit: contain;
    background: #fff;
    width: auto;
    height: auto;
}
#lightbox-actions { display:flex; gap:10px; flex-wrap:wrap; justify-content:center; }
#lightbox-close {
    position: fixed;
    top: 14px;
    right: 18px;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    background: none;
    border: none;
    padding: 4px 8px;
}

/* ── Página de confirmación ──────────────────────────── */
.confirm-box {
    text-align: center;
    padding: 40px 20px;
}
.confirm-box .icon { font-size: 3.5rem; margin-bottom: 12px; }
.confirm-box .id-badge {
    display: inline-block;
    background: var(--c-primary);
    color: var(--c-accent);
    font-size: 1.4rem;
    font-weight: 700;
    padding: 8px 24px;
    border-radius: var(--radius);
    letter-spacing: .05em;
    margin: 16px 0;
}

.site-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--c-border);
}
.site-footer__credit {
    font-size: .78rem;
    margin-bottom: 16px;
}
.site-footer__brand {
    display: flex;
    justify-content: center;
    padding-bottom: 8px;
}
.site-footer__brand img {
    height: 28px;
    width: auto;
}
.eventos-historial {
    margin-bottom: 20px;
}
.eventos-historial h3 {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--c-text-muted);
    margin-bottom: 10px;
    text-align: center;
    font-weight: 600;
}
.eventos-historial ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.evento-historial-item {
    font-size: .78rem;
    text-align: center;
    color: var(--c-text-muted);
    padding: 10px 12px;
    background: var(--c-base);
    border-radius: var(--radius);
    border: 1px solid var(--c-border);
    line-height: 1.45;
}
.evento-historial-item strong {
    display: block;
    color: var(--c-text);
    font-size: .875rem;
    margin-bottom: 3px;
}

/* ── Utilidades ──────────────────────────────────────── */
.text-muted  { color: var(--c-text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.w-full { width: 100%; }
