/* =========================================================
   NAVEGACIÓN DE ADMINISTRACIÓN
========================================================= */

.admin-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;

    margin-bottom: 22px;
    padding: 8px;

    background: rgba(255, 255, 255, 0.94);

    border: 1px solid rgba(60, 118, 155, 0.18);
    border-radius: 16px;

    box-shadow: 0 8px 24px rgba(35, 79, 115, 0.12);
}

.admin-nav a {
    display: inline-flex;
    align-items: center;

    padding: 9px 14px;

    border-radius: 11px;

    color: #48627a;

    font-size: 13px;
    font-weight: 800;

    text-decoration: none;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.admin-nav a:hover {
    background: #edf7fc;
}

.admin-nav a.active {
    color: #176e9c;
    background: #dff4ff;
}


/* =========================================================
   CABECERA DE CATÁLOGO
========================================================= */

.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;

    margin-bottom: 18px;
}

.catalog-header h2 {
    margin-bottom: 4px;
}

.catalog-count {
    color: #687e92;

    font-size: 13px;
    font-weight: 700;
}


/* =========================================================
   FILTROS
========================================================= */

.catalog-filters {
    display: grid;

    grid-template-columns:
        minmax(180px, 1fr)
        160px
        160px
        auto;

    gap: 10px;

    margin-bottom: 22px;
}

.catalog-filters .button {
    align-self: stretch;
}


/* =========================================================
   TARJETAS DE OBJETOS
========================================================= */

.catalog-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(270px, 1fr)
        );

    gap: 15px;
}

.catalog-card {
    display: grid;

    grid-template-columns:
        82px
        minmax(0, 1fr);

    gap: 14px;

    padding: 14px;

    background: #ffffff;

    border: 1px solid #dce8f0;
    border-radius: 16px;

    box-shadow:
        0 5px 16px rgba(40, 82, 112, 0.08);

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.catalog-card:hover {
    transform: translateY(-2px);

    box-shadow:
        0 9px 22px rgba(40, 82, 112, 0.13);
}


/* =========================================================
   MINIATURA DEL OBJETO
========================================================= */

.item-thumb {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 82px;
    height: 82px;

    overflow: hidden;

    border-radius: 14px;

    border: 1px solid rgba(0, 0, 0, 0.08);

    background: #eef3f6;
}


/*
 * Este bloque de color existe SIEMPRE.
 * Si hay una imagen WebP transparente,
 * la imagen se coloca encima.
 */

.item-thumb-placeholder {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    z-index: 1;
}


/*
 * Imagen del objeto.
 *
 * La dejamos algo más pequeña que el cuadrado
 * para que se siga viendo claramente
 * el fondo correspondiente a la rareza.
 */

.item-thumb img {
    position: relative;

    z-index: 2;

    width: 90%;
    height: 90%;

    object-fit: contain;

    pointer-events: none;
}


/* =========================================================
   FONDOS SEGÚN RAREZA
========================================================= */

/* LEGENDARIO */

.item-thumb-placeholder.quality-legendario {
    background:
        linear-gradient(
            135deg,
            #fff4b8 0%,
            #f0cd65 48%,
            #d9a71e 100%
        );
}


/* ÉPICO */

.item-thumb-placeholder.quality-epico {
    background:
        linear-gradient(
            135deg,
            #ead4ff 0%,
            #c68bf0 48%,
            #9a4dce 100%
        );
}


/* RARO */

.item-thumb-placeholder.quality-raro {
    background:
        linear-gradient(
            135deg,
            #d8ecff 0%,
            #8dc2f1 48%,
            #4b96da 100%
        );
}


/* MÁGICO */

.item-thumb-placeholder.quality-magico {
    background:
        linear-gradient(
            135deg,
            #d9f6e2 0%,
            #8edba9 48%,
            #47b774 100%
        );
}


/* NORMAL */

.item-thumb-placeholder.quality-normal {
    background:
        linear-gradient(
            135deg,
            #f3f5f6 0%,
            #d2d9de 48%,
            #aeb9c1 100%
        );
}


/* =========================================================
   CONTENIDO DE TARJETA
========================================================= */

.catalog-info {
    min-width: 0;
}

.catalog-name {
    margin-bottom: 5px;

    overflow: hidden;

    color: #20374e;

    font-size: 16px;
    font-weight: 850;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-meta {
    margin-bottom: 8px;

    color: #697f93;

    font-size: 12px;
    line-height: 1.5;
}

.catalog-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;

    margin-top: 9px;
}

.stock-pill {
    display: inline-flex;

    padding: 6px 9px;

    border-radius: 999px;

    color: #37617b;

    background: #edf7fc;

    font-size: 12px;
    font-weight: 800;
}

.stock-pill.stock-zero {
    color: #7a6870;
    background: #f1edef;
}

.edit-link {
    color: #247eaf;

    font-size: 12px;
    font-weight: 850;

    text-decoration: none;
}

.edit-link:hover {
    text-decoration: underline;
}


/* =========================================================
   EDICIÓN
========================================================= */

.edit-layout {
    display: grid;

    grid-template-columns:
        minmax(340px, 440px)
        minmax(0, 1fr);

    gap: 24px;
}

.current-object {
    display: flex;
    align-items: center;
    gap: 14px;

    margin-bottom: 20px;
    padding: 13px;

    border-radius: 15px;

    background: #f3f9fd;

    border: 1px solid #d6e6ef;
}

.current-object .item-thumb {
    flex-shrink: 0;

    width: 72px;
    height: 72px;
}


/* =========================================================
   SELECTOR DE IMÁGENES
========================================================= */

.image-picker-title {
    margin-bottom: 5px;

    color: #20374e;

    font-size: 20px;
    font-weight: 800;
}

.image-picker-description {
    margin-bottom: 17px;

    color: #6b8093;

    font-size: 13px;
    line-height: 1.5;
}

.image-picker-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(125px, 1fr)
        );

    gap: 12px;
}

.image-option {
    position: relative;

    display: block;

    cursor: pointer;
}

.image-option input {
    position: absolute;

    opacity: 0;

    pointer-events: none;
}

.image-card {
    padding: 8px;

    border: 2px solid transparent;
    border-radius: 14px;

    background: #f6f9fb;

    transition:
        border-color 0.15s ease,
        background 0.15s ease,
        transform 0.15s ease;
}

.image-option:hover .image-card {
    transform: translateY(-1px);
    background: #eef7fc;
}

.image-option input:checked + .image-card {
    border-color: #44aee3;

    background: #eaf7fe;

    box-shadow:
        0 0 0 3px rgba(68, 174, 227, 0.12);
}

.image-preview {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    aspect-ratio: 1 / 1;

    overflow: hidden;

    margin-bottom: 7px;

    border-radius: 10px;

    background: #e8eef2;
}

.image-preview img {
    width: 100%;
    height: 100%;

    object-fit: contain;
}

.image-none {
    color: #708294;

    font-size: 12px;
    font-weight: 800;

    text-align: center;
}

.image-filename {
    overflow: hidden;

    color: #596f83;

    font-size: 10px;
    font-weight: 700;

    text-align: center;

    text-overflow: ellipsis;
    white-space: nowrap;
}


/* =========================================================
   ACCIONES DE EDICIÓN
========================================================= */

.edit-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;

    margin-top: 19px;
}

.back-link {
    display: inline-flex;
    align-items: center;

    color: #567188;

    font-size: 13px;
    font-weight: 800;

    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 900px) {

    .edit-layout {
        grid-template-columns: 1fr;
    }

    .catalog-filters {
        grid-template-columns: 1fr 1fr;
    }

}


@media (max-width: 600px) {

    .catalog-filters {
        grid-template-columns: 1fr;
    }

    .catalog-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .catalog-grid {
        grid-template-columns: 1fr;
    }

}