/* Sorteos: encabezados con acciones, filtros, ruleta y ganadores (requiere base.css y app.css) */

/* ---------- Encabezados de página ---------- */

.page-head--actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.page-head p .tag { margin-right: 6px; }

.head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.head-actions form { margin: 0; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: var(--ink-muted);
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
}

.back-link:hover { color: var(--brand); }

.link-strong {
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}

.link-strong:hover { color: var(--brand); text-decoration: underline; }

.callout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    border-color: var(--brand);
}

.callout .card__title { margin-bottom: 4px; }
.callout .hint { margin-bottom: 12px; }

.callout__icon {
    font-size: 2.4rem;
    color: var(--brand);
}

.error-code {
    margin: 0;
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
    color: var(--brand);
}

@media (min-width: 700px) {
    .form-grid--filters-2 { grid-template-columns: 2fr 2fr auto; align-items: end; }
}

/* ---------- Chips (filtros y cantidad) ---------- */

.filter-group {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.filter-group legend {
    margin-bottom: 8px;
    padding: 0;
    font-weight: 700;
}

.filter-group legend i { color: var(--brand); margin-right: 4px; }

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip { position: relative; cursor: pointer; }

.chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chip span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 600;
    font-size: .925rem;
    transition: background-color .15s, border-color .15s, color .15s;
}

.chip small {
    padding: 0 7px;
    border-radius: 999px;
    background: var(--bg);
    color: var(--ink-muted);
    font-size: .75rem;
}

.chip:hover span { border-color: var(--brand); }

.chip input:checked + span {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.chip input:checked + span small { background: rgba(255, 255, 255, .25); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }

.filters-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.filters-head .card__title { margin: 0; }

.filter-group__scope {
    font-weight: 500;
    font-size: .875rem;
    color: var(--ink-muted);
}

/* Mientras se recalculan las opciones dependientes */
.filter-group [data-chips] { transition: opacity .15s; }
.new-raffle.is-loading .filter-group:not([data-campo="empresa"]) [data-chips] { opacity: .55; }
.new-raffle.is-loading .summary-bar__value { opacity: .55; }

/* Barra fija con el conteo de participantes */
.new-raffle { display: grid; gap: 20px; }

.summary-bar {
    position: sticky;
    bottom: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border: 1px solid var(--brand);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(20, 40, 10, .2);
}

.summary-bar__count { display: flex; align-items: baseline; gap: 8px; color: var(--ink-muted); }

.summary-bar__value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--brand-strong);
    font-variant-numeric: tabular-nums;
}

/* ---------- Ruleta ---------- */

.raffle { display: grid; gap: 20px; }

.raffle:fullscreen {
    align-content: start;
    overflow-y: auto;
    padding: 2vh 2vw;
    background: var(--bg);
}

.stage {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 10px;
    min-height: 420px;
    padding: 28px 20px 24px;
    overflow: hidden;
    border-radius: 22px;
    color: #fff;
    text-align: center;
    background:
        radial-gradient(ellipse at 50% 120%, rgba(245, 197, 24, .25), transparent 60%),
        linear-gradient(160deg, #0b1a04 0%, #1f5f02 55%, #2c8503 100%);
    box-shadow: var(--shadow);
}

.raffle:fullscreen .stage { min-height: 62vh; }

.stage__confetti {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.stage__fullscreen {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
}

.stage__fullscreen:hover { background: rgba(255, 255, 255, .25); }

.stage__logos {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 16px;
    border-radius: 999px;
    background: #fff;
}

.stage__logos img { height: 30px; width: auto; }

.stage__eyebrow {
    margin: 6px 0 0;
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    opacity: .75;
}

.stage__position {
    margin: 10px 0 0;
    padding: 4px 16px;
    border-radius: 999px;
    background: #f5c518;
    color: #0b1a04;
    font-weight: 800;
    font-size: clamp(.9rem, 2vw, 1.3rem);
}

.stage__name {
    max-width: 100%;
    min-height: 1.2em;
    font-size: clamp(2rem, 6.5vw, 5.2rem);
    font-weight: 800;
    line-height: 1.1;
    text-wrap: balance;
    overflow-wrap: anywhere;
}

.raffle:fullscreen .stage__name { font-size: clamp(2.5rem, 7vw, 7rem); }

.stage__meta {
    min-height: 1.5em;
    margin: 0;
    font-size: clamp(1rem, 2vw, 1.5rem);
    opacity: .9;
}

.stage.is-spinning .stage__name {
    color: rgba(255, 255, 255, .85);
    filter: blur(.6px);
}

.stage.is-winner .stage__name {
    color: #f5c518;
    text-shadow: 0 0 30px rgba(245, 197, 24, .45);
    animation: ganador .7s cubic-bezier(.2, 1.4, .4, 1);
}

.stage.is-winner .stage__position { animation: ganador .7s cubic-bezier(.2, 1.4, .4, 1); }

@keyframes ganador {
    from { transform: scale(.6); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.stage__stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 22px;
    margin-top: 14px;
    font-size: .95rem;
    opacity: .85;
}

.stage__stats b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }

.controls {
    display: grid;
    gap: 16px;
    align-items: center;
}

@media (min-width: 900px) {
    .controls { grid-template-columns: 1fr auto auto; }
    .controls__hint { grid-column: 1 / -1; }
}

.controls__qty { display: grid; gap: 8px; }
.controls.is-busy .controls__qty, .controls.is-busy .check { opacity: .5; pointer-events: none; }
.controls__hint { margin: 0; text-align: center; }

.chips--qty .chip span { min-width: 54px; justify-content: center; font-size: 1.05rem; }

.input--qty { width: 100px; min-height: 40px; border-radius: 999px; text-align: center; }

.btn--draw {
    min-height: 64px;
    padding: 12px 36px;
    border-radius: 16px;
    background: #f5c518;
    color: #0b1a04;
    font-size: 1.3rem;
    font-weight: 800;
    box-shadow: 0 6px 0 #b8920e;
}

.btn--draw:hover:not(:disabled) { filter: brightness(1.06); }
.btn--draw:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #b8920e; }

/* ---------- Lista de ganadores ---------- */

.winners {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.winner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.winner.is-new { animation: ganador .5s ease; border-color: #f5c518; }

.winner__pos {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    min-width: 40px;
    height: 40px;
    padding: 0 6px;
    border-radius: 50%;
    background: #f5c518;
    color: #0b1a04;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.winner__body { display: grid; min-width: 0; flex: 1; }
.winner__name { overflow-wrap: anywhere; }
.winner__meta { font-size: .8rem; color: var(--ink-muted); }
.winner form { margin: 0; }
.winner__remove { min-height: 32px; padding: 4px 8px; }
