/* ══ Ventanas y desplegables: en el móvil, hoja que sube desde abajo ══════════════════════════
   js/rig-dialog.js. Misma ventana en toda la web: en el ordenador sale como siempre (ventana en el
   centro o desplegable bajo su botón); en el móvil (≤640px) sube desde abajo, con una rayita arriba
   para cerrarla arrastrando hacia abajo, botones a todo el ancho y sin taparse con la barra del iPhone.

   Ventanas:      .sm-modal (Account, Edit profile), .lur-card (Report), .wn-card (What's new),
                  .rd-panel (rigConfirm de este fichero, p. ej. borrar un lineup en My lineups)
   Desplegables:  notificaciones, Season del nav y los desplegables largos (.cselect con más de 7
                  opciones o con buscador). El JS les pone .rd-drop mientras están abiertos en el móvil.
   ═══════════════════════════════════════════════════════════════════════════════════════════ */

/* Fondo oscuro de los desplegables-hoja (las ventanas ya traen el suyo) */
#rdBackdrop { position: fixed; inset: 0; z-index: 1250; background: rgba(0,0,0,.6); opacity: 0; pointer-events: none; transition: opacity .2s; }
#rdBackdrop.on { opacity: 1; pointer-events: auto; }
html.rd-lock, html.rd-lock body, html.rd-modal-open, html.rd-modal-open body { overflow: hidden; }
/* Que el dedo sobre el fondo oscuro no arrastre la página; dentro de la ventana sí se desplaza */
.rd-scrim, .sm-scrim, .lur-scrim, .wn-scrim, #rdBackdrop { overscroll-behavior: contain; touch-action: none; }
.rd-panel, .sm-modal, .lur-card, .wn-card, .rd-drop { touch-action: pan-y; overscroll-behavior: contain; }

@keyframes rdUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ── rigConfirm(): ventana de confirmación para cualquier página ── */
.rd-scrim { position: fixed; inset: 0; z-index: 10100; display: flex; align-items: center; justify-content: center; padding: 20px;
    background: rgba(5,5,5,.65); animation: rdFade .15s ease-out; }
.rd-scrim[hidden] { display: none; }
@keyframes rdFade { from { opacity: 0; } }
.rd-panel { position: relative; width: 100%; max-width: 440px; max-height: calc(100dvh - 40px); overflow-y: auto; padding: 22px;
    border: 1px solid rgba(255,255,255,.1); border-radius: 16px; background: #161616; box-shadow: 0 30px 80px rgba(0,0,0,.6);
    color: var(--text-gray); font-size: 14px; line-height: 1.5; }
.rd-ey { margin: 0 0 6px; font: 600 11px var(--font-mono, ui-monospace, monospace); letter-spacing: .08em; text-transform: uppercase; color: var(--brand-accent); }
.rd-ey.is-danger { color: var(--valorant-red); }
.rd-panel h2 { margin: 0; font: 700 18px/1.3 var(--font-sans, inherit); color: var(--text-white); }
.rd-text { margin: 6px 0 0; }
.rd-type[hidden] { display: none; }
.rd-type { display: grid; gap: 6px; margin-top: 14px; font-size: 13px; }
.rd-type b { color: var(--text-white); }
.rd-type input { height: 42px; padding: 0 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; background: #0f0f10; color: #fff; font: 15px var(--font-sans, inherit); }
.rd-type input:focus { outline: 0; border-color: rgba(255,255,255,.35); }
.rd-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.rd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border: 1px solid rgba(255,255,255,.14);
    border-radius: 10px; background: none; color: #fff; font: 600 14px var(--font-sans, inherit); cursor: pointer; }
.rd-btn:hover { background: rgba(255,255,255,.05); }
.rd-btn--pri { background: #fff; border-color: #fff; color: #111; }
.rd-btn--pri:hover { background: #e5e5e5; }
.rd-btn--danger { background: var(--valorant-red); border-color: var(--valorant-red); color: #fff; }
.rd-btn--danger:hover { background: #ff5f6c; }
.rd-btn:disabled { opacity: .45; cursor: not-allowed; }

/* Título que el JS pone arriba de un desplegable cuando sale como hoja (p. ej. "Agent") */
.rd-title { display: none; }

@media (max-width: 640px) {
    /* ── Ventanas ── */
    .sm-scrim:not([hidden]), .lur-scrim, .wn-scrim, .rd-scrim:not([hidden]) {
        display: flex !important; align-items: flex-end !important; justify-content: center !important; padding: 0 !important;
    }
    .sm-modal, .lur-card, .wn-card, .rd-panel {
        width: 100% !important; max-width: none !important; margin: 0 !important;
        max-height: 88dvh !important; overflow-y: auto; overscroll-behavior: contain;
        border-radius: 20px 20px 0 0 !important; border-bottom: 0 !important;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        animation: rdUp .3s cubic-bezier(.2,.8,.2,1);
        transform: translateY(var(--rd-drag, 0px));
    }
    .rd-panel { padding: 8px 18px calc(18px + env(safe-area-inset-bottom, 0px)); }
    .lur-card { padding-top: 8px; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
    /* Rayita para arrastrar */
    .sm-modal::before, .lur-card::before, .wn-card::before, .rd-panel::before, .rd-drop::before {
        content: ""; display: block; flex: none; width: 40px; height: 5px; margin: 8px auto 10px; border-radius: 3px; background: rgba(255,255,255,.22);
    }
    .wn-card::before, .sm-modal::before { margin-bottom: 0; }
    .lur-card::before, .rd-panel::before { margin-top: 0; }
    .lur-x, .wn-x { top: 14px; }
    /* Botones a todo el ancho; el principal arriba, donde llega el pulgar */
    .sm-f, .rd-foot { flex-direction: column-reverse; align-items: stretch; }
    .sm-f > *, .rd-foot > * { width: 100%; justify-content: center; min-height: 44px; }
    .lur-send, .wn-ok { min-height: 44px; }

    /* ── Desplegables (notificaciones, Season, desplegables largos) ── */
    .rd-drop {
        position: fixed !important; left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important;
        z-index: 1300 !important; width: auto !important; max-width: none !important; min-width: 0 !important;
        max-height: 80dvh !important; overflow-y: auto !important; overscroll-behavior: contain;
        margin: 0 !important; opacity: 1 !important; visibility: visible !important; pointer-events: auto !important;
        border-radius: 20px 20px 0 0 !important; border-bottom: 0 !important;
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
        transform: translateY(var(--rd-drag, 0px)) !important;
        animation: rdUp .3s cubic-bezier(.2,.8,.2,1);
        box-shadow: 0 -20px 60px rgba(0,0,0,.5) !important;
        display: flex; flex-direction: column;
    }
    .rd-drop.cselect-menu, .rd-drop.rsg-pop { padding-left: 12px !important; padding-right: 12px !important; }
    .rd-drop .cselect-list { max-height: none !important; overflow: visible !important; }
    .rd-drop .cselect-option { min-height: 44px; display: flex; align-items: center; font-size: 15px; }
    .rd-drop .cselect-search { position: sticky; top: 0; z-index: 1; font-size: 16px; }
    .rd-drop .rd-title { display: block; padding: 0 6px 10px; font: 700 17px var(--font-sans, inherit); color: var(--text-white); }
    .rd-drop.nav-notif-dropdown { padding-top: 0; }
    .rd-drop .nav-notif-list, .rd-drop .nav-notif-body { max-height: none !important; }
    .rd-dragging { transition: none !important; animation: none !important; }
}
@media (prefers-reduced-motion: reduce) {
    .sm-modal, .lur-card, .wn-card, .rd-panel, .rd-drop, .rd-scrim { animation: none !important; }
}

/* ══ rigToast(): pop de confirmación (js/rig-dialog.js) ═══════════════════════════════════════
   Mismo aspecto que los pops de notificaciones, pero no se guarda en la campana: sale ~4 s y se va.
   En ordenador arriba a la derecha; en el móvil abajo, cerca del pulgar. */
.rig-pops { position: fixed; top: 68px; right: 20px; z-index: 10200; width: 360px; max-width: calc(100vw - 20px);
    display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.rig-pop { --rp: #60a5fa; position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 12px 40px 12px 12px; pointer-events: auto;
    border: 1px solid #2a2a2a; border-radius: 12px; background: #1a1a1a; color: #fff; box-shadow: 0 18px 40px rgba(0,0,0,.55);
    overflow: hidden; font-family: var(--font-sans, inherit); animation: rpIn .22s ease-out; }
.rig-pop.is-out { animation: rpOut .18s ease-in forwards; }
.rig-pop--ok  { --rp: var(--green, #34d399); }
.rig-pop--err { --rp: var(--valorant-red, #ff4655); }
.rig-pop--info { --rp: #60a5fa; }
.rp-ic { width: 32px; height: 32px; flex: none; border-radius: 9px; display: grid; place-items: center;
    background: color-mix(in srgb, var(--rp) 14%, transparent); color: var(--rp); }
.rp-ic svg { width: 17px; height: 17px; }
.rp-b { min-width: 0; }
.rp-b b { display: block; padding-top: 5px; font-size: 14px; font-weight: 600; line-height: 1.35; }
.rp-b small { display: block; margin-top: 2px; font-size: 13px; color: #a8a8a8; line-height: 1.4; overflow-wrap: anywhere; }
.rp-undo { margin-top: 8px; padding: 4px 10px; border: 1px solid #3a3a3a; border-radius: 6px; background: none; color: #fff;
    font: 600 12.5px var(--font-sans, inherit); cursor: pointer; }
.rp-undo:hover { background: rgba(255,255,255,.08); }
.rp-x { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 6px;
    background: none; color: #777; cursor: pointer; }
.rp-x:hover { background: rgba(255,255,255,.08); color: #fff; }
.rp-x svg { width: 14px; height: 14px; }
.rp-bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; transform-origin: left; background: var(--rp);
    animation: rpBar var(--rp-ms, 4000ms) linear forwards; }
.rig-pop:hover .rp-bar { animation-play-state: paused; }
@keyframes rpIn  { from { opacity: 0; transform: translateY(-8px); } }
@keyframes rpOut { to   { opacity: 0; transform: translateY(-8px); } }
@keyframes rpBar { to   { transform: scaleX(0); } }
@media (max-width: 640px) {
    .rig-pops { top: auto; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); left: 10px; right: 10px; width: auto; max-width: none; flex-direction: column-reverse; }
    .rig-pop { animation-name: rpInM; }
    .rig-pop.is-out { animation-name: rpOutM; }
    @keyframes rpInM  { from { opacity: 0; transform: translateY(12px); } }
    @keyframes rpOutM { to   { opacity: 0; transform: translateY(12px); } }
}
@media (prefers-reduced-motion: reduce) { .rig-pop, .rig-pop.is-out { animation: none; } .rp-bar { animation: none; transform: scaleX(0); } }
