* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #dfe8f6;
    overflow: hidden;
}

/* PANTALLA PRINCIPAL */

.unlock-page {
    position: relative;
    width: min(100vw, calc(100svh * 16 / 9));
    height: min(100svh, calc(100vw * 9 / 16));
    margin: auto;
    overflow: hidden;
    background: #001b5c;
}

.unlock-bg {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.unlock-bg img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
}

/* BOTÓN VOLVER */

.back-button {
    position: absolute;
    top: 5.6%;
    left: 4.1%;
    z-index: 10;

    min-width: clamp(92px, 8vw, 130px);
    height: clamp(34px, 3vw, 46px);
    padding: 0 16px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    border: 3px solid rgba(255, 255, 255, 0.92);
    border-radius: 9px;

    background: rgba(0, 75, 175, 0.75);
    color: #ffffff;

    font-size: clamp(13px, 1.1vw, 18px);
    font-weight: 950;
    text-decoration: none;

    box-shadow:
        0 0 14px rgba(53, 156, 255, 0.68),
        inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

/* CONTENIDO */

.unlock-content {
    position: relative;
    z-index: 3;

    width: 100%;
    height: 100%;

    padding: 4% 6.5% 4.3%;

    display: flex;
    flex-direction: column;
    align-items: center;
}

/* HEADER */

.unlock-header {
    width: 100%;
    text-align: center;
    margin-bottom: 2.1%;
}

.unlock-header h1 {
    color: #ffa31a;

    font-size: clamp(48px, 6.3vw, 105px);
    line-height: 0.9;
    font-weight: 950;
    letter-spacing: -2px;

    text-shadow:
        0 5px 0 rgba(105, 60, 0, 0.65),
        0 10px 24px rgba(0, 0, 0, 0.35);
}

.unlock-header p {
    width: min(92%, 950px);
    margin: 1.5% auto 0;

    color: #ffffff;

    font-size: clamp(16px, 1.55vw, 27px);
    font-weight: 950;
    line-height: 1.18;

    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.55);
}

/* PANEL DE SOBRES */

.packs-panel {
    width: min(78%, 1180px);
    height: 64%;
    padding: 3% 4%;

    border: 2px solid rgba(255, 255, 255, 0.42);
    border-radius: 18px;

    background: rgba(178, 202, 238, 0.62);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    box-shadow:
        0 0 22px rgba(255, 255, 255, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);

    overflow-y: auto;
    overflow-x: hidden;
}

.packs-panel::-webkit-scrollbar {
    width: 8px;
}

.packs-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
}

.packs-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.65);
    border-radius: 999px;
}

/* GRID */

.packs-grid {
    width: 100%;

    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 8%;
    row-gap: 12%;
}

.pack-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(12px, 1.6vw, 24px);
}

.pack-card img {
    width: clamp(100px, 9vw, 165px);
    height: auto;
    object-fit: contain;

    filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.25));
    transition: transform 0.25s ease;
}

.pack-card:hover img {
    transform: translateY(-4px) scale(1.04);
}

/* BOTÓN DESBLOQUEAR */

.unlock-pack-btn {
    width: clamp(150px, 12vw, 210px);
    height: clamp(42px, 3.9vw, 58px);

    border: 2px solid rgba(255, 255, 255, 0.82);
    border-radius: 15px;

    background: linear-gradient(180deg, #ffb040, #f29421);
    color: #ffffff;

    font-size: clamp(13px, 1vw, 17px);
    font-weight: 950;

    cursor: pointer;

    box-shadow:
        0 5px 0 rgba(152, 87, 14, 0.85),
        0 10px 18px rgba(0, 0, 0, 0.25);

    transition: transform 0.2s ease, filter 0.2s ease;
}

.unlock-pack-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.07);
}

.unlock-pack-btn:disabled {
    cursor: not-allowed;
    background: linear-gradient(180deg, #4fb85f, #198b37);
    box-shadow:
        0 5px 0 rgba(9, 83, 27, 0.85),
        0 10px 18px rgba(0, 0, 0, 0.25);
}

.pack-card.is-unlocked img {
    filter: grayscale(1) brightness(0.8);
    opacity: 0.7;
}

/* PANTALLAS WEB BAJITAS */

@media (min-width: 769px) and (max-height: 760px) {
    .unlock-content {
        padding-top: 3.5%;
        padding-bottom: 3.2%;
    }

    .unlock-header {
        margin-bottom: 1.5%;
    }

    .unlock-header h1 {
        font-size: clamp(42px, 5.4vw, 82px);
    }

    .unlock-header p {
        font-size: clamp(14px, 1.28vw, 22px);
        margin-top: 1%;
    }

    .packs-panel {
        height: 65%;
        padding: 2.5% 4%;
    }

    .packs-grid {
        row-gap: 9%;
    }

    .pack-card img {
        width: clamp(88px, 7.8vw, 135px);
    }

    .unlock-pack-btn {
        height: 42px;
        width: 170px;
        font-size: 13px;
    }
}

/* TABLET */

@media (max-width: 1024px) and (orientation: landscape) {
    .packs-panel {
        width: 82%;
    }

    .packs-grid {
        column-gap: 6%;
    }
}

/* MÓVIL */

@media (max-width: 768px) and (orientation: portrait) {
    html,
    body {
        width: 100%;
        min-height: 100%;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }

    body {
        display: block;
        background: #001b5c;
    }

    .unlock-page {
        width: 100%;
        min-height: 100svh;
        height: auto;
        margin: 0;
        overflow: hidden;
    }

    .unlock-bg {
        position: fixed;
        inset: 0;
    }

    .unlock-bg img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .back-button {
        position: fixed;
        top: 16px;
        left: 14px;

        min-width: 96px;
        height: 36px;
        padding: 0 12px;

        border-width: 2px;
        font-size: 14px;
    }

    .unlock-content {
        width: 100%;
        min-height: 100svh;
        height: auto;

        padding: 72px 14px 24px;

        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .unlock-header {
        margin-bottom: 16px;
    }

    .unlock-header h1 {
        font-size: clamp(40px, 12vw, 54px);
        letter-spacing: -1px;
    }

    .unlock-header p {
        width: 94%;
        margin-top: 10px;

        font-size: clamp(13px, 4vw, 16px);
        line-height: 1.24;
    }

    .packs-panel {
        width: 100%;
        max-width: 430px;

        height: 62svh;
        padding: 20px 14px;

        border-radius: 18px;

        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .packs-grid {
        grid-template-columns: repeat(2, 1fr);
        column-gap: 12px;
        row-gap: 28px;
    }

    .pack-card {
        gap: 14px;
    }

    .pack-card img {
        width: clamp(92px, 30vw, 130px);
    }

    .unlock-pack-btn {
        width: 100%;
        max-width: 150px;
        height: 42px;

        border-radius: 12px;

        font-size: 12px;
        line-height: 1.05;
        padding: 0 8px;
    }
}

/* MÓVIL PEQUEÑO */

@media (max-width: 390px) and (orientation: portrait) {
    .unlock-content {
        padding: 68px 10px 20px;
    }

    .unlock-header h1 {
        font-size: 38px;
    }

    .unlock-header p {
        font-size: 12px;
    }

    .packs-panel {
        height: 63svh;
        padding: 18px 10px;
    }

    .packs-grid {
        column-gap: 8px;
        row-gap: 24px;
    }

    .pack-card img {
        width: 94px;
    }

    .unlock-pack-btn {
        max-width: 136px;
        height: 39px;
        font-size: 11px;
    }
}

/* ======================================================
   AJUSTE: MENOS ESPACIO ABAJO EN EL CUADRO
====================================================== */

@media (min-width: 769px) {

    .packs-panel {
        height: 70%;
        padding: 28px 52px 32px;
        scroll-padding-bottom: 32px;
    }

    .packs-grid {
        column-gap: 70px;
        row-gap: 42px;
        padding: 0 0 22px;
    }

    .pack-card {
        gap: 16px;
        padding-bottom: 0;
    }

    .unlock-pack-btn {
        margin-bottom: 0;
    }
}

/* Pantallas bajitas */
@media (min-width: 769px) and (max-height: 760px) {

    .packs-panel {
        height: 71%;
        padding: 24px 46px 28px;
        scroll-padding-bottom: 28px;
    }

    .packs-grid {
        column-gap: 64px;
        row-gap: 36px;
        padding: 0 0 18px;
    }

    .pack-card {
        gap: 14px;
        padding-bottom: 0;
    }
}

/* Móvil */
@media (max-width: 768px) and (orientation: portrait) {

    .packs-panel {
        padding: 20px 14px 28px;
        scroll-padding-bottom: 28px;
    }

    .packs-grid {
        row-gap: 28px;
        padding-bottom: 20px;
    }

    .pack-card {
        padding-bottom: 0;
    }
}

/* ======================================================
   FIX IPAD / TABLET VERTICAL
   Evita que se vea como pantalla 16:9 cortada arriba
====================================================== */

@media (min-width: 769px) and (max-width: 1180px) and (orientation: portrait) {

    html,
    body {
        width: 100%;
        min-height: 100%;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        background: #001b5c;
    }

    body {
        display: block;
    }

    .unlock-page {
        width: 100%;
        min-height: 100svh;
        height: auto;
        margin: 0;
        overflow-x: hidden;
        overflow-y: hidden;
        background: #001b5c;
    }

    .unlock-bg {
        position: fixed;
        inset: 0;
        z-index: 1;
    }

    .unlock-bg img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .back-button {
        position: fixed;
        top: 24px;
        left: 24px;
        z-index: 20;

        min-width: 110px;
        height: 40px;

        font-size: 16px;
    }

    .unlock-content {
        width: 100%;
        min-height: 100svh;
        height: auto;

        padding: 78px 34px 32px;

        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
    }

    .unlock-header {
        margin-bottom: 22px;
    }

    .unlock-header h1 {
        font-size: clamp(54px, 9vw, 82px);
        line-height: 0.9;
        letter-spacing: -2px;
    }

    .unlock-header p {
        width: min(92%, 760px);
        margin-top: 12px;

        font-size: clamp(17px, 2.5vw, 22px);
        line-height: 1.18;
    }

    .packs-panel {
        width: min(100%, 760px);
        height: 62svh;

        padding: 32px 34px 34px;

        border-radius: 20px;

        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .packs-grid {
        grid-template-columns: repeat(3, 1fr);
        column-gap: 28px;
        row-gap: 38px;

        padding: 0 0 18px;
    }

    .pack-card {
        gap: 16px;
    }

    .pack-card img {
        width: clamp(92px, 16vw, 128px);
    }

    .unlock-pack-btn {
        width: 100%;
        max-width: 160px;
        height: 42px;

        font-size: 12px;
        border-radius: 13px;
    }
}

/* IPAD MINI / TABLET MÁS ANGOSTA */
@media (min-width: 769px) and (max-width: 900px) and (orientation: portrait) {

    .unlock-content {
        padding: 74px 24px 28px;
    }

    .unlock-header h1 {
        font-size: clamp(48px, 8.5vw, 68px);
    }

    .unlock-header p {
        font-size: 16px;
    }

    .packs-panel {
        width: min(100%, 700px);
        height: 63svh;
        padding: 28px 28px 32px;
    }

    .packs-grid {
        column-gap: 22px;
        row-gap: 34px;
    }

    .pack-card img {
        width: clamp(86px, 15vw, 115px);
    }

    .unlock-pack-btn {
        max-width: 145px;
        height: 40px;
        font-size: 11px;
    }
}

/* ======================================================
   MODAL DE SELECCIÓN DE USUARIOS
====================================================== */

.user-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1;
}

.user-modal-content {
    position: relative;
    z-index: 2;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.user-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-modal-header h2 {
    color: #001b5c;
    font-size: 22px;
    font-weight: 950;
    margin: 0;
}

.user-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-modal-close:hover {
    color: #333;
}

.user-modal-body {
    padding: 20px 24px;
    flex: 1;
    overflow-y: auto;
}

.user-modal-help {
    color: #666;
    font-size: 14px;
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.user-selection-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-item:hover {
    border-color: #ffb040;
    background: #fff9f0;
}

.user-item.selected {
    border-color: #ffb040;
    background: #fffbf5;
    box-shadow: 0 0 0 3px rgba(255, 176, 64, 0.1);
}

.user-item-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: white;
    transition: all 0.2s ease;
}

.user-item.selected .user-item-checkbox {
    background: #ffb040;
    border-color: #ffb040;
    color: white;
}

.user-item-info {
    flex: 1;
    min-width: 0;
}

.user-item-name {
    font-weight: 600;
    color: #001b5c;
    font-size: 14px;
    margin: 0;
}

.user-item-email {
    font-size: 12px;
    color: #999;
    margin: 2px 0 0 0;
}

.user-item-position {
    font-size: 12px;
    color: #666;
    margin: 2px 0 0 0;
    font-style: italic;
}

.user-selection-loading {
    text-align: center;
    padding: 32px 16px;
    color: #666;
    font-size: 14px;
}

.user-selection-error {
    padding: 12px;
    background: #ffe0e0;
    border: 1px solid #ff9999;
    border-radius: 6px;
    color: #c00;
    font-size: 13px;
}

.user-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e0e0e0;
    background: #f9f9f9;
    border-radius: 0 0 16px 16px;
}

.user-selected-count {
    font-size: 13px;
    color: #666;
    margin: 0 0 12px 0;
}

.count-value {
    font-weight: 600;
    color: #ffb040;
}

.user-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.user-modal-cancel,
.user-modal-confirm {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-modal-cancel {
    background: #e0e0e0;
    color: #333;
}

.user-modal-cancel:hover {
    background: #d0d0d0;
}

.user-modal-confirm {
    background: linear-gradient(180deg, #ffb040, #f29421);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 176, 64, 0.3);
}

.user-modal-confirm:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 176, 64, 0.4);
}

.user-modal-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Media queries para modal en móvil */
@media (max-width: 768px) {
    .user-modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .user-modal-header {
        padding: 18px 16px 12px;
    }

    .user-modal-header h2 {
        font-size: 18px;
    }

    .user-modal-body {
        padding: 16px;
    }

    .user-modal-footer {
        padding: 16px;
    }

    .user-modal-actions {
        flex-direction: column-reverse;
    }

    .user-modal-cancel,
    .user-modal-confirm {
        width: 100%;
        padding: 12px 16px;
    }
}