/* ========================
   VARIABLES Y BASE
======================== */
:root {
    --bg-normal: #121212;
    --card-normal: #1e1e1e;
    --text-normal: #f5f5f5;
    --border-normal: #444;
    --header-normal: #2c2c2c;
    --row-alt-normal: #252525;
    --accent-normal: #d71920;

    --bg-dark: #0b0b0b;
    --card-dark: #1a1a1a;
    --text-dark: #ffffff;
    --border-dark: #333;
    --header-dark: #222;
    --row-alt-dark: #1f1f1f;
    --accent-dark: #d71920;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Orbitron', sans-serif;
    background: var(--bg-normal);
    color: var(--text-normal);
}

body.dark-mode {
    background: var(--bg-dark);
    color: var(--text-dark);
}

.table-container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 16px;
}

/* ========================
   TABLA
======================== */
table.rangos-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 12px rgba(215,25,32,0.6), 0 4px 16px rgba(0,0,0,0.5);
    background: var(--card-normal);
}

body.dark-mode table.rangos-table {
    background: var(--card-dark);
    box-shadow: 0 0 16px rgba(215,25,32,0.7), 0 4px 24px rgba(0,0,0,0.7);
}

/* ========================
   ENCABEZADOS
======================== */
table.rangos-table thead {
    background: var(--header-normal);
}

body.dark-mode table.rangos-table thead {
    background: var(--header-dark);
}

table.rangos-table th {
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    text-shadow: 0 0 4px rgba(255,255,255,0.2);
    color: var(--text-normal);
}

body.dark-mode table.rangos-table th {
    color: var(--text-dark);
    text-shadow: 0 0 6px rgba(255,255,255,0.15);
}

/* ========================
   FILAS
======================== */
table.rangos-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-normal);
    vertical-align: middle;
    color: var(--text-normal);
}

body.dark-mode table.rangos-table td {
    border-bottom: 1px solid var(--border-dark);
    color: var(--text-dark);
}

/* Fila alterna */
tbody tr:nth-child(odd) { background: var(--row-alt-normal); }
tbody tr:hover { background: #2f2f2f; box-shadow: inset 0 0 8px var(--accent-normal); }

body.dark-mode tbody tr:nth-child(odd) { background: var(--row-alt-dark); }
body.dark-mode tbody tr:hover { background: #2c2c2c; box-shadow: inset 0 0 10px var(--accent-dark); }

/* ========================
   SUB-COLUMNA ESTÁNDAR
======================== */
.estandar-sub {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.estandar-sub > div {
    padding: 4px 6px;
    border-radius: 4px;
    text-align: center;
    font-size: 13px;
    transition: 0.3s;
    border: 1px solid var(--accent-normal);
    background: #2a2a2a;
    color: var(--text-normal);
}

.estandar-sub > div:hover {
    background: var(--accent-normal);
    color: #fff;
    box-shadow: 0 0 8px var(--accent-normal), 0 0 12px rgba(0,0,0,0.5);
}

body.dark-mode .estandar-sub > div {
    border: 1px solid var(--accent-dark);
    background: #1f1f1f;
    color: var(--text-dark);
}

body.dark-mode .estandar-sub > div:hover {
    background: var(--accent-dark);
    box-shadow: 0 0 10px var(--accent-dark), 0 0 18px rgba(0,0,0,0.6);
}

/* ========================
   ALINEACIÓN
======================== */
.left { text-align: left; }
.center { text-align: center; }
.right { text-align: right; }

/* ========================
   RESPONSIVE
======================== */
@media (max-width: 800px) {
    table.rangos-table thead { display: none; }
    table.rangos-table, table.rangos-table tbody, table.rangos-table tr, table.rangos-table td {
        display: block;
        width: 100%;
    }

    table.rangos-table tr {
        margin-bottom: 12px;
        padding: 0 0 12px;
        border-bottom: 2px solid #333;
    }

    table.rangos-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
    }

    table.rangos-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-left: 14px;
        font-weight: 600;
        text-align: left;
        color: var(--accent-normal);
    }

    body.dark-mode table.rangos-table td::before {
        color: var(--accent-dark);
    }
}

/* =====================================================
   MINIATURAS RANGOS
===================================================== */

.miniatura-rango {
    max-width: 100%;
    cursor: default;
}


/* Solo si tiene HD */
.miniatura-rango-hd {
    cursor: pointer;
    transition:
        transform .2s ease,
        filter .2s ease,
        box-shadow .2s ease;
}

.miniatura-rango-hd:hover {
    transform: scale(1.08);
    filter: brightness(1.15);

    box-shadow:
        0 0 8px rgba(215,25,32,.8),
        0 0 14px rgba(0,0,0,.6);
}


/* =====================================================
   MODAL GLOBAL HD
===================================================== */

.modal-rango-hd {
    display: none;

    position: fixed;
    inset: 0;

    z-index: 999999;

    background: rgba(0,0,0,.90);

    align-items: center;
    justify-content: center;

    padding: 30px;
}


.modal-rango-hd.activo {
    display: flex;
}


.modal-rango-hd img {
    width: auto;
    height: auto;

    max-width: 90vw;
    max-height: 88vh;

    object-fit: contain;

    border: 2px solid #d71920;
    border-radius: 7px;

    box-shadow:
        0 0 20px rgba(0,0,0,.85),
        0 0 30px rgba(215,25,32,.35);
}


.cerrar-rango-hd {
    position: fixed;

    top: 20px;
    right: 30px;

    z-index: 1000000;

    color: #ffffff;

    font-size: 42px;
    font-weight: bold;
    line-height: 1;

    cursor: pointer;
}


.cerrar-rango-hd:hover {
    color: #d71920;
}

/* =====================================================
   MINIATURAS CON IMAGEN HD
===================================================== */

.miniatura-rango {
    max-width: 100%;
    height: auto;
}

.miniatura-rango-hd {
    cursor: pointer;
    transition: transform .20s ease,
                filter .20s ease,
                box-shadow .20s ease;
}

.miniatura-rango-hd:hover {
    transform: scale(1.10);
    filter: brightness(1.18);

    box-shadow:
        0 0 8px rgba(215,25,32,.9),
        0 0 14px rgba(215,25,32,.6);
}


/* =====================================================
   MODAL IMAGEN HD
===================================================== */

.modal-rango-hd {
    display: none;

    position: fixed;
    inset: 0;

    width: 100%;
    height: 100%;

    z-index: 999999;

    background: rgba(0,0,0,.90);

    align-items: center;
    justify-content: center;

    padding: 25px;
}


/* Cuando se abre */
.modal-rango-hd.activo {
    display: flex;
}


/* Imagen HD */
.modal-rango-hd #imagenRangoHD {
    display: block;

    width: auto;
    height: auto;

    max-width: 90vw;
    max-height: 88vh;

    object-fit: contain;

    border: 2px solid #d71920;
    border-radius: 6px;

    box-shadow:
        0 0 20px rgba(0,0,0,.9),
        0 0 25px rgba(215,25,32,.45);
}


/* Botón X */
.cerrar-rango-hd {
    position: fixed;

    top: 20px;
    right: 30px;

    color: #fff;

    font-size: 42px;
    font-weight: bold;
    line-height: 1;

    cursor: pointer;

    z-index: 1000000;

    transition: color .2s ease,
                transform .2s ease;
}

.cerrar-rango-hd:hover {
    color: #d71920;
    transform: scale(1.15);
}


/* MÓVIL */
@media (max-width: 640px) {

    .modal-rango-hd {
        padding: 15px;
    }

    .modal-rango-hd #imagenRangoHD {
        max-width: 95vw;
        max-height: 85vh;
    }

    .cerrar-rango-hd {
        top: 12px;
        right: 18px;
        font-size: 36px;
    }
}

/* SIN IMAGEN DE RANGO */
.sin-imagen-rango {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 28px;

    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

/* =====================================================
   MODO CLARO - TABLA RANGOS Y GP
   El modo oscuro actual NO se modifica
===================================================== */

/* Fondo general de la tabla */
body:not(.dark-mode) table.rangos-table {
    background: #ffffff;
    color: #222222;

    box-shadow:
        0 0 12px rgba(215,25,32,0.35),
        0 4px 16px rgba(0,0,0,0.18);
}


/* CABECERA */
body:not(.dark-mode) table.rangos-table thead {
    background: #eeeeee;
}

body:not(.dark-mode) table.rangos-table th {
    color: #222222;
    border-bottom: 1px solid #cfcfcf;
    text-shadow: none;
}


/* FILAS NORMALES */
body:not(.dark-mode) table.rangos-table tbody tr {
    background: #ffffff;
}


/* FILAS ALTERNADAS */
body:not(.dark-mode) table.rangos-table tbody tr:nth-child(odd) {
    background: #f3f3f3;
}


/* CELDAS */
body:not(.dark-mode) table.rangos-table td {
    color: #222222;
    border-bottom: 1px solid #d4d4d4;
}


/* HOVER DE CADA FILA */
body:not(.dark-mode) table.rangos-table tbody tr:hover {
    background: #e8e8e8;

    box-shadow:
        inset 0 0 8px rgba(215,25,32,0.35);
}


/* =====================================================
   CUADROS DE LAS IMÁGENES
===================================================== */

body:not(.dark-mode) .estandar-sub > div {
    background: #f5f5f5;
    color: #222222;

    border: 1px solid #d71920;

    box-shadow:
        inset 0 0 3px rgba(0,0,0,0.08);
}


/* HOVER DE LOS CUADROS */
body:not(.dark-mode) .estandar-sub > div:hover {
    background: #eeeeee;
    color: #222222;

    box-shadow:
        0 0 8px rgba(215,25,32,0.55);
}


/* =====================================================
   GUION CUANDO NO HAY IMAGEN
===================================================== */

body:not(.dark-mode) .sin-imagen-rango {
    color: #333333;
}


/* =====================================================
   MINIATURAS HD
===================================================== */

body:not(.dark-mode) .miniatura-rango-hd:hover {
    filter: brightness(1.08);

    box-shadow:
        0 0 8px rgba(215,25,32,.65),
        0 0 12px rgba(0,0,0,.15);
}

/* =========================================
   RANGO AGRUPADO COMO WOLF-ZONE
========================================= */

.rangos-table td.rango-agrupado {
    vertical-align: middle;
    text-align: left;
}