/* D616 — Página "Consultar código" (cliente).
   C148 — Rediseño copiando el diseño del cliente: tarjetas de plataforma a la izquierda,
   instrucciones a la derecha y la barra "Consultar correo" abajo a todo lo ancho. Solo cambia la
   cara: los ids que usa codigos.js (cod-servicio, cod-correo, cod-btn, cod-out…) son los de antes. */

/* En Mi Cuenta el contenedor es de 1120px; esta página pide más aire, como el diseño. */
.ko-main:has(> .cdg) { max-width: 1340px; }

.cdg {
    max-width: 1340px; margin: 0 auto; padding: 1.6rem 1rem 2.6rem;
    display: grid; grid-template-columns: 1.27fr 1fr; gap: 1.4rem 1.5rem;
    color: #f7f7fc;
}
/* Dentro de Mi Cuenta el layout ya pone su relleno. */
.ko-main > .cdg { padding: .4rem 0 0; }

.cdg-panel {
    position: relative; border-radius: 22px; padding: 2rem 2rem 1.8rem; min-width: 0;
    background:
        radial-gradient(520px 260px at 0% 0%, rgba(104, 70, 217, .26), transparent 62%),
        linear-gradient(160deg, #191247 0%, #10133a 55%, #0c1030 100%);
    border: 1px solid rgba(118, 92, 240, .45);
    box-shadow: 0 22px 50px rgba(0, 0, 0, .35), 0 0 42px rgba(104, 70, 217, .16);
}
.cdg-pasos {
    padding: 1.6rem 1.4rem 1.4rem;
    background:
        radial-gradient(420px 240px at 100% 0%, rgba(41, 110, 230, .2), transparent 62%),
        linear-gradient(160deg, #10204f 0%, #0c1640 55%, #0a1033 100%);
    border-color: rgba(70, 110, 230, .45);
}
.cdg-consulta {
    grid-column: 1 / -1; padding: 1.9rem 1.6rem 1.4rem; margin-top: .4rem;
    background: linear-gradient(90deg, #15114a 0%, #0f1645 60%, #0d1340 100%);
}

/* ---------- Cabeceras ---------- */
.cdg-head { display: flex; align-items: center; gap: 1.6rem; margin-bottom: 2.2rem; }
.cdg-head-ic { width: 96px; height: auto; flex: 0 0 auto; border-radius: 22px; }
.cdg-head h1 { margin: 0 0 .45rem; font-size: 2.15rem; font-weight: 800; line-height: 1.1; color: #fff; }
.cdg-head h1 span {
    background: linear-gradient(90deg, #8b5cf6, #c13cf0); -webkit-background-clip: text;
    background-clip: text; color: transparent;
}
.cdg-head p { margin: 0; color: #cfd3e6; font-size: 1.05rem; line-height: 1.5; max-width: 40ch; }
.cdg-head-sm { gap: 1.2rem; margin-bottom: 1.5rem; }
.cdg-head-sm .cdg-head-ic { width: 76px; border-radius: 16px; }
.cdg-head-sm h2 { margin: 0 0 .35rem; font-size: 1.6rem; font-weight: 800; color: #fff; }
.cdg-head-sm p { font-size: .95rem; max-width: 46ch; color: #c3c8de; }

/* ---------- Tarjetas de plataforma ---------- */
/* El panel de la izquierda mide lo mismo que el de instrucciones (fila del grid): las tarjetas se
   centran en el hueco, en vez de dejar un vacío abajo. */
.cdg-plat { display: flex; flex-direction: column; }
.cdg-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.4rem; margin: auto 0; }
.cdg-card {
    --glow: rgba(139, 92, 246, .45);
    position: relative; display: block; padding: 0; border: 0; background: transparent;
    border-radius: 18px; cursor: pointer; aspect-ratio: 200 / 245;
    box-shadow: 0 0 22px var(--glow);
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease, filter .18s ease;
}
.cdg-card[hidden] { display: none; }
.cdg-card[data-clave="netflix" i] { --glow: rgba(255, 30, 70, .5); }
.cdg-card[data-clave="disney" i] { --glow: rgba(40, 110, 255, .5); }
.cdg-card[data-clave="prime" i] { --glow: rgba(40, 140, 255, .45); }
.cdg-card[data-clave="chatgpt" i] { --glow: rgba(20, 220, 140, .45); }
.cdg-card img { display: block; width: 100%; height: 100%; object-fit: fill; border-radius: 18px; }
.cdg-card:hover { transform: translateY(-4px); }
.cdg-card:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* Elegida: brillo fuerte y una marca de visto; las demás se apagan para que se lea de un vistazo
   cuál va a consultarse. */
.cdg-cards.tiene-sel .cdg-card:not(.is-sel) { opacity: .45; filter: saturate(.55); }
.cdg-card.is-sel { transform: translateY(-4px); box-shadow: 0 0 0 3px rgba(255, 255, 255, .85), 0 0 34px var(--glow); }
.cdg-card-ok {
    position: absolute; top: -10px; right: -10px; width: 30px; height: 30px; border-radius: 50%;
    display: none; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
}
.cdg-card-ok svg { width: 17px; height: 17px; }
.cdg-card.is-sel .cdg-card-ok { display: flex; }

/* Plataforma que el admin dé de alta y no tenga tarjeta propia: la misma forma, hecha con CSS. */
.cdg-card-gen {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .7rem;
    background: linear-gradient(165deg, #2a1a72, #161046);
    border: 2px solid rgba(167, 139, 250, .75); color: #fff;
}
.cdg-card-ini { font-size: 3.2rem; font-weight: 800; line-height: 1; }
.cdg-card-nom { font-size: 1.05rem; font-weight: 700; padding: 0 .5rem; text-align: center; }
.cdg-card-go {
    width: 44px; height: 44px; border-radius: 50%; border: 2px solid #a78bfa; color: #fff;
    display: flex; align-items: center; justify-content: center;
}
.cdg-card-go svg { width: 22px; height: 22px; }


/* ---------- Instrucciones ---------- */
.cdg-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.cdg-paso {
    width: 100%; display: grid; grid-template-columns: 56px 62px 1fr 24px; align-items: center;
    gap: 1.1rem; padding: .5rem 1rem; text-align: left; cursor: pointer; color: inherit;
    background: rgba(10, 18, 50, .72); border: 1px solid rgba(80, 100, 200, .25); border-radius: 14px;
    transition: border-color .15s ease, background .15s ease;
}
.cdg-paso:hover { border-color: rgba(139, 92, 246, .6); background: rgba(20, 26, 70, .8); }
.cdg-num {
    width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 35% 30%, #a56bff, #6d28d9 70%); color: #fff;
    font-size: 1.35rem; font-weight: 800; box-shadow: 0 0 18px rgba(139, 92, 246, .55);
}
.cdg-paso img { width: 62px; height: 64px; border-radius: 12px; }
.cdg-paso-txt { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.cdg-paso-txt b { font-size: 1rem; font-weight: 700; color: #fff; }
.cdg-paso-txt small { font-size: .82rem; color: #aab1cc; line-height: 1.35; }
.cdg-chev { width: 24px; height: 24px; color: #c7cbe0; }

/* ---------- Consultar correo ---------- */
.cdg-tab {
    position: absolute; top: 0; left: 1.6rem; transform: translateY(-50%);
    display: inline-flex; align-items: center; gap: .6rem; margin: 0;
    padding: .35rem 1.1rem; border-radius: 12px; background: #120f40;
    border: 1px solid rgba(118, 92, 240, .45); color: #fff; font-size: 1.05rem; font-weight: 600;
}
.cdg-tab svg { width: 22px; height: 22px; }
.cdg-barra { display: flex; align-items: center; gap: 1.6rem; }
.cdg-in {
    flex: 1 1 auto; min-width: 0; height: 56px; padding: 0 1.2rem; border-radius: 12px;
    background: rgba(30, 40, 95, .55); border: 1px solid rgba(110, 120, 200, .45);
    color: #fff; font-size: 1.05rem;
}
.cdg-in::placeholder { color: #9aa3c7; }
.cdg-in:focus { outline: none; border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139, 92, 246, .25); }
.cdg-btn {
    flex: 0 0 300px; height: 64px; border: 0; border-radius: 14px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: .8rem;
    background: linear-gradient(90deg, #5b3df5 0%, #9b3df0 60%, #e040fb 100%);
    color: #fff; font-size: 1.2rem; font-weight: 700;
    box-shadow: 0 0 26px rgba(160, 70, 255, .45);
    transition: filter .15s ease, transform .15s ease;
}
.cdg-btn svg { width: 26px; height: 26px; }
.cdg-btn:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.cdg-btn:disabled { opacity: .55; cursor: default; }
.cdg-consulta .cod-aviso { margin-top: 1rem; }

.cod-aviso {
    display: flex; flex-direction: column; gap: .25rem;
    background: rgba(234, 179, 8, .1); border: 1px solid rgba(234, 179, 8, .4);
    border-radius: 12px; padding: 1rem 1.1rem; color: #fde68a; font-size: .9rem;
}

/* ---------- Tableta y celular ---------- */
@media (max-width: 1100px) {
    .cdg-head h1 { font-size: 1.8rem; }
    .cdg-cards { gap: 1rem; }
    .cdg-paso { grid-template-columns: 46px 52px 1fr 20px; gap: .8rem; }
    .cdg-num { width: 46px; height: 46px; font-size: 1.15rem; }
    .cdg-paso img { width: 52px; height: 54px; }
}
@media (max-width: 980px) {
    /* Una columna. La barra de consulta sube justo debajo de las plataformas: en el celular es lo
       que se usa, y obligar a pasar las instrucciones para llegar al botón sería un estorbo. */
    .cdg { grid-template-columns: 1fr; }
    .cdg-plat { order: 1; }
    .cdg-consulta { order: 2; margin-top: .6rem; }
    .cdg-pasos { order: 3; }
    .cdg-btn { flex-basis: 220px; }
}
@media (max-width: 640px) {
    .cdg { padding: 1rem .75rem 2rem; gap: 1.5rem; }
    .ko-main > .cdg { padding: .2rem 0 0; }
    .cdg-panel { padding: 1.3rem 1rem 1.2rem; border-radius: 18px; }
    .cdg-consulta { padding: 1.8rem 1rem 1.1rem; }
    .cdg-head { gap: 1rem; margin-bottom: 1.3rem; }
    .cdg-head-ic { width: 64px; border-radius: 16px; }
    .cdg-head h1 { font-size: 1.45rem; }
    .cdg-head p { font-size: .88rem; }
    .cdg-head-sm .cdg-head-ic { width: 56px; }
    .cdg-head-sm h2 { font-size: 1.25rem; }
    .cdg-cards { grid-template-columns: repeat(2, 1fr); gap: .9rem; }
    .cdg-cards { margin: 0; }
    .cdg-paso { grid-template-columns: 40px 46px 1fr 18px; gap: .7rem; padding: .45rem .7rem; }
    .cdg-num { width: 40px; height: 40px; font-size: 1.05rem; }
    .cdg-paso img { width: 46px; height: 47px; border-radius: 10px; }
    .cdg-chev { width: 18px; height: 18px; }
    .cdg-tab { left: 1rem; font-size: .95rem; }
    .cdg-barra { flex-direction: column; align-items: stretch; gap: .8rem; }
    .cdg-btn { flex: 0 0 auto; height: 56px; }
}

/* ============ C148 — Resultado al estilo de /Code ============
   "Tu código aparecerá aquí" + una fila por tipo de código, con casillas en blanco desde el
   principio y una cifra por casilla al llegar. Mismas medidas que recuperacion.css para que las
   dos páginas se vean iguales. */
.cdg-out {
    margin-top: 1.2rem; padding: 1.1rem 1.2rem; border-radius: 14px;
    border: 1px solid rgba(118, 92, 240, .3); background: rgba(8, 10, 32, .55);
}
.cdg-out-h { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.cdg-out-h h3 { margin: 0; font-size: .95rem; font-weight: 700; color: #e6e6ee; }
.cdg-pill {
    padding: .25rem .7rem; border-radius: 999px; font-size: .74rem; font-weight: 700;
    background: rgba(34, 197, 94, .13); color: #4ade80; white-space: nowrap;
}
.cdg-pill-espera { background: rgba(148, 163, 184, .13); color: #b6bcc9; }
.cdg-pill-mal { background: rgba(248, 113, 113, .13); color: #fca5a5; }

/* En PC las filas van en columnas (la barra es ancha); en celular, una debajo de otra. */
.cdg-filas { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: .9rem 1.6rem; }
.cdg-fila { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; align-content: flex-start; }
.cdg-tipo { width: 100%; margin-bottom: .1rem; font-size: .78rem; font-weight: 600; color: #9aa0ae; }

.cdg-marca,
.cdg-digito {
    display: grid; place-items: center; width: 46px; height: 52px;
    border: 1px solid rgba(255, 255, 255, .09); border-radius: 10px; background: rgba(0, 0, 0, .35);
}
.cdg-marca svg { width: 22px; height: 26px; }
/* Las que no son Netflix llevan el logo de su propia tarjeta, recortado a la casilla. */
.cdg-marca-img { background-size: 60px auto; background-position: 50% 5px; background-repeat: no-repeat; }
/* Código de 7-8 o de 9+ caracteres: casillas más chicas, para que no se parta en dos renglones. */
.cdg-fila-l { gap: .35rem; }
.cdg-fila-l .cdg-digito, .cdg-fila-l .cdg-marca { width: 38px; height: 46px; }
.cdg-fila-l .cdg-digito { font-size: 1.15rem; }
.cdg-fila-xl { gap: .3rem; }
.cdg-fila-xl .cdg-digito, .cdg-fila-xl .cdg-marca { width: 32px; height: 42px; }
.cdg-fila-xl .cdg-digito { font-size: 1rem; }
.cdg-fila-l .cdg-marca-img, .cdg-fila-xl .cdg-marca-img { background-size: 46px auto; background-position: 50% 4px; }
/* Y si aun así no caben (celular angosto), se reparten el ancho de la fila en vez de partirse:
   cada casilla encoge lo justo, sin pasar de su tamaño normal. */
.cdg-fila-l .cdg-digito, .cdg-fila-l .cdg-marca,
.cdg-fila-xl .cdg-digito, .cdg-fila-xl .cdg-marca { flex: 1 1 0; min-width: 0; }
.cdg-fila-l .cdg-digito, .cdg-fila-l .cdg-marca { max-width: 38px; }
.cdg-fila-xl .cdg-digito, .cdg-fila-xl .cdg-marca { max-width: 32px; }
.cdg-marca-ini { color: #fff; font-weight: 800; font-size: 1.2rem; background: linear-gradient(165deg, #2a1a72, #161046); }
.cdg-digito { color: #fff; font-size: 1.35rem; font-weight: 800; }
.cdg-digito-vacio { color: rgba(255, 255, 255, .16); }

.cdg-copiar {
    display: inline-flex; align-items: center; gap: .45rem; margin-left: .4rem;
    padding: .62rem .9rem; border: 1px solid rgba(255, 255, 255, .11); border-radius: 10px;
    background: rgba(255, 255, 255, .05); color: #e6e6ee; font-size: .84rem; font-weight: 600; cursor: pointer;
}
.cdg-copiar:hover { background: rgba(255, 255, 255, .09); }
.cdg-copiar svg { width: 15px; height: 15px; }

/* Los tipos que en vez del código traen un botón (Netflix "acceso temporal"). */
.cdg-enlace {
    display: inline-flex; align-items: center; gap: .45rem; padding: .75rem 1.1rem; border-radius: 10px;
    background: linear-gradient(90deg, #8b5cf6, #4f8ef7); color: #fff; font-size: .88rem; font-weight: 700;
    text-decoration: none;
}
.cdg-enlace:hover { filter: brightness(1.08); color: #fff; }

.cdg-meta { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; margin-top: .85rem; color: #7f8595; font-size: .78rem; }
.cdg-meta svg { width: 13px; height: 13px; }
.cdg-meta i { font-style: normal; opacity: .5; }

/* Mientras se lee el buzón —tarda unos segundos— las casillas laten: sin esto parece colgada. */
.cdg-out-buscando .cdg-digito,
.cdg-out-buscando .cdg-marca { animation: cdg-buscando 1.1s ease-in-out infinite; }
.cdg-out-buscando .cdg-fila:nth-child(2) .cdg-digito,
.cdg-out-buscando .cdg-fila:nth-child(2) .cdg-marca { animation-delay: .15s; }
.cdg-out-buscando .cdg-fila:nth-child(3) .cdg-digito,
.cdg-out-buscando .cdg-fila:nth-child(3) .cdg-marca { animation-delay: .3s; }
@keyframes cdg-buscando {
    0%, 100% { opacity: .35; border-color: rgba(255, 255, 255, .09); }
    50% { opacity: 1; border-color: rgba(168, 85, 247, .55); }
}
/* Al llegar el código, las casillas entran una tras otra (el escalonado lo pone el JS con --i). */
.cdg-fila-nueva .cdg-digito,
.cdg-fila-nueva .cdg-marca,
.cdg-fila-nueva .cdg-enlace {
    animation: cdg-entrar .34s cubic-bezier(.2, .8, .3, 1) backwards;
    animation-delay: calc(var(--i, 0) * .055s);
}
@keyframes cdg-entrar {
    from { opacity: 0; transform: translateY(9px) scale(.94); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .cdg-out-buscando .cdg-digito, .cdg-out-buscando .cdg-marca,
    .cdg-fila-nueva .cdg-digito, .cdg-fila-nueva .cdg-marca, .cdg-fila-nueva .cdg-enlace { animation: none; }
}
@media (max-width: 640px) {
    .cdg-out { padding: .95rem .85rem; }
    .cdg-filas { grid-template-columns: 1fr; }
    .cdg-marca, .cdg-digito { width: 40px; height: 48px; }
    .cdg-marca-img { background-size: 52px auto; background-position: 50% 6px; }
    .cdg-fila-l .cdg-digito, .cdg-fila-l .cdg-marca { width: 32px; height: 42px; }
    .cdg-fila-xl { gap: .2rem; }
    .cdg-fila-xl .cdg-digito, .cdg-fila-xl .cdg-marca { width: 26px; max-width: 30px; height: 38px; border-radius: 8px; }
    .cdg-fila-xl .cdg-digito { font-size: .95rem; }
    .cdg-fila-l .cdg-marca-img, .cdg-fila-xl .cdg-marca-img { background-size: 36px auto; background-position: 50% 4px; }
    .cdg-digito { font-size: 1.2rem; }
    .cdg-copiar { margin-left: 0; width: 100%; justify-content: center; margin-top: .4rem; }
}

/* ============ Mensajes, consultas restantes y soporte (C51–C54) ============ */
.cdg-out .cod-msg { margin-top: .85rem; }
.cod-msg { margin: 0; color: #b9b2d4; font-size: .88rem; line-height: 1.5; }

/* Va DESPUÉS de .cod-msg a propósito: las dos clases pesan lo mismo, así que la que se escribe
   después es la que gana. Puesta antes, el color de .cod-msg la anulaba y no hacía nada. */
.cod-msg-ok { color: #9d97b5; }

/* C53 — Consultas que le quedan a esa cuenta. Discreto mientras le queden; en ámbar cuando se
   acaban, que es cuando el cliente necesita entender por qué no le sale el código. */
.cod-restantes {
    margin: .6rem 0 0; font-size: .82rem; color: #9d97b5; line-height: 1.5;
}
.cod-restantes-cero {
    color: #fde68a; background: rgba(234, 179, 8, .1);
    border: 1px solid rgba(234, 179, 8, .35); border-radius: 10px; padding: .55rem .7rem;
}

/* C54 — Botón para pedirle el código a soporte cuando el cliente agotó sus consultas. Verde de
   WhatsApp para que se reconozca de un vistazo, y a lo ancho porque en ese momento es LA acción
   que le queda: si compite con otros botones, el cliente se queda mirando la pantalla. */
.cod-soporte {
    display: flex; align-items: center; justify-content: center; gap: .5rem;
    margin: .7rem 0 0; padding: .75rem 1rem; border-radius: 12px;
    background: #25d366; color: #05300f; font-weight: 800; font-size: .92rem;
    text-decoration: none; transition: filter .15s ease;
}
.cod-soporte:hover { filter: brightness(1.07); color: #05300f; }
.cod-soporte svg { width: 20px; height: 20px; flex: 0 0 auto; }
.cod-msg-warn {
    color: #fca5a5; background: rgba(239, 68, 68, .1);
    border: 1px solid rgba(239, 68, 68, .35); border-radius: 10px; padding: .7rem .85rem;
}

.cod-nota {
    margin: 1rem 0 0; padding-top: .9rem; border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: .78rem; color: #9d97b5; line-height: 1.5;
}
.cod-nota b { color: #cdd7e6; }


/* Va al FINAL a propósito: pesa lo mismo que .cod-msg y tiene que ganarle. */
.cod-msg-mal { color: #fca5a5; }

/* C153 — Botones del reparto: "Este código no me funciona" y "Lo pedí hace más rato". Discretos
   (secundarios): lo principal sigue siendo el código. */
.cdg-acciones { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.cdg-accion {
    display: inline-flex; align-items: center; gap: .4rem; padding: .55rem .95rem; border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, .55); background: rgba(139, 92, 246, .12); color: #ddd6fe;
    font-size: .84rem; font-weight: 600; cursor: pointer;
}
.cdg-accion:hover { background: rgba(139, 92, 246, .22); color: #fff; }
.cdg-accion-sec { border-color: rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .05); color: #e6e6ee; }
.cdg-accion-sec:hover { background: rgba(255, 255, 255, .1); }
@media (max-width: 640px) { .cdg-accion { width: 100%; justify-content: center; } }
