.frasebienvenida {
    text-align: center;
    font-size: 28px;
    font-style: italic;
    font-family: math;
    width: 100%;
    display: block;
    margin: 2rem auto 2rem auto;
}

/* ── Editar perfil ── */
.perfil-editar {
    max-width: 500px;
    margin: 0 auto 2rem;
    padding-top: 120px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.perfil-usuario {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    text-align: center;
    margin: 0 0 10px;
}
.perfil-campo {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.perfil-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #2c3e50;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.perfil-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.perfil-input {
    flex: 1;
    padding: 9px 12px;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: Verdana, sans-serif;
    transition: border-color 0.3s;
    background-color: #ffffff;
}
.perfil-input:focus {
    outline: none;
    border-color: #1abc9c;
}
.perfil-pass-wrap {
    flex: 1;
    position: relative;
    display: flex;
}
.perfil-pass-wrap .perfil-input {
    width: 100%;
    padding-right: 42px;
}
.perfil-ojo {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
    line-height: 1;
}
.perfil-btn {
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background-color: #bdc3c7;
    color: #fff;
    transition: background-color 0.3s;
    white-space: nowrap;
}
.perfil-btn:disabled {
    cursor: default;
    opacity: 0.7;
}
.perfil-btn-activo {
    background-color: #2ecc71;
    opacity: 1;
}
.perfil-btn-activo:hover {
    background-color: #27ae60;
}
.perfil-msg {
    font-size: 0.8rem;
    min-height: 1.2em;
}
.perfil-btn-eliminar {
    background-color: #e74c3c;
    max-width: 200px;
}
.perfil-btn-eliminar:hover {
    background-color: #c0392b;
}

.cerrarsesion {
    display: flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    margin: 3rem auto 2.5rem;
}

.cerrarsesion a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.6rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #ffffff !important;
    font-family: "Trebuchet MS", Arial, sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    font-style: normal;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.35);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.cerrarsesion a::before {
    content: "⏻";
    font-size: 1rem;
    line-height: 1;
}

.cerrarsesion a:hover {
    background: linear-gradient(135deg, #a93226, #c0392b);
    transform: translateY(-2px);
    box-shadow: 0 7px 18px rgba(231, 76, 60, 0.45);
}

.cerrarsesion a:active {
    transform: scale(0.97);
    box-shadow: 0 3px 8px rgba(231, 76, 60, 0.3);
}

#esquinatabla {
    background-color: aliceblue;
}

a:link {
    text-decoration: none;
}
a:visited {
    text-decoration: none;
}

.table {
    border-collapse: collapse;
    margin: 24px auto;
    width: min(90%, 900px);
    background-color: #ffffff;
    font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", Arial, sans-serif;

    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
    text-align: center;
    font-size: 0.95rem;
    border-radius: 0 0 14px 14px;
    overflow: hidden;
}

/* filas en “zebra” */
.table tr:nth-child(even) td {
    background-color: #f8fbfd;
}

/* última columna (Valor medio) resaltada */
.table td:last-child {
    font-weight: 600;
}

/* hover filas */
.table tbody tr:hover td {
    background-color: #fff9ec;
}

/* celdas normales */
td {
    padding: 8px 10px;
    font-size: 0.9rem;
    border-bottom: 1px solid #e3e6ec;
    border-right: 1px solid #e8ebf0;
    background-color: #fdfefe;
}

th {
    padding: 10px 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.03em;
    text-transform: uppercase;

    color: #f7f9fb;
    background: linear-gradient(120deg, #006c7b, #018e9c);
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

caption {
    caption-side: top;
    padding: 12px 16px;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;

    background: linear-gradient(120deg, #ffb347, #ffcc6b);
    color: #333;
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
    /*border-radius: inherit;*/
    border-radius: 14px 14px 0 0;    /* solo esquina superior izq/der */
    overflow: hidden;
}


/******** SUBAPARTADOS ********/

/* Celda principal (cualquier apartado con botón) */
.celda-titulo-con-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding-left: 14px;
    padding-right: 14px;
    white-space: nowrap;
    overflow: hidden;
}

/* Botón extensible con icono (guion / guion abierto) */
.toggle-subapartados {
    width: 26px;
    height: 22px;
    margin-left: 8px;
    margin-top: 0;
    padding: 0;
    border: none;
    border-radius: 5px;

    background-color: transparent;
    background-image: url("../Imagenes/guion.png");
    background-size: 85% auto;
    background-position: center;
    background-repeat: no-repeat;

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

    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.toggle-subapartados:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 7px rgba(0,0,0,0.28);
}

/* Estado abierto → cambia solo la imagen */
.toggle-subapartados.abierto {
    background-image: url("../Imagenes/guion_abierto.png");
}

.toggle-subapartados.abierto::after {
    content: "";
}

/* Por defecto, las subfilas están ocultas */
.subfila-oculta {
   display: none;
}

/* Estilo común de la celda del nombre del subapartado */
.celda-subapartado {
    padding-left: 28px;
    font-weight: 500;
    text-align: left;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Todas las subfilas (cualquiera que empiece por "subfila-") */
[class^="subfila-"] td {
    border-top: 1px solid #e3e6ec;
}

/******** FIN SUBAPARTADOS ********/

.centrado {
    margin: 0;
    padding: 0;
}


/* ------------------ MEDIA PARA TABLAS / SUBAPARTADOS ------------------ */

@media (max-width: 1024px) { /* tamaño iPad horizontal */

    th {
        font-size: 10px;
        padding: 3px;
    }

    .toggle-subapartados {
        width: 24px;
        height: 20px;
    }

    caption {
        font-size: 15px;
    }

    td {
        font-size: 10px;
    }
}


/* ====================== BLOQUE ACCESO / REGISTRO ====================== */

/* Cabecera "Acceso" */
.p {
    max-width: 420px;
    margin: 2.5rem auto 0.2rem;
    padding: 0.9rem 1.6rem;
    font-size: 1.05rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
    color: #ffffff;
    background: linear-gradient(135deg, #273647, #34495e);
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
}

/* Contenedor de pestañas (Iniciar sesión / Registrarse) */
.contenedoracceso {
    max-width: 420px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #ecf0f1;
    border-bottom: 1px solid #d0d7de;
}

.contenedoracceso button {
    border: none;
    background: transparent;
    padding: 0.7rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Trebuchet MS', Arial, sans-serif;
    color: #34495e;
    cursor: pointer;

    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;

    transition: 0.25s ease;
}

/* Botón de pestaña activo */
.contenedoracceso button.activo {
    background: #ffffff;
    color: #1a5276;
    box-shadow: inset 0 -3px 0 #1abc9c;
}

/* Tarjeta contenedora de los formularios */
.contenedordatosacceso {
    max-width: 420px;
    margin: 0 auto 2.5rem;
    padding: 1.6rem;
    background: #ffffff;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.14);
}

/* Formularios: ocultos por defecto */
.formularioacceso,
.formularioregistro {
    display: none;
}

/* Clases que se añaden desde JS para mostrarlos */
.formularioacceso_visible,
.formularioregistro_visible {
    display: block;
}

/* Inputs de los formularios de acceso/registro */
.contenedordatosacceso input[type="text"],
.contenedordatosacceso input[type="password"],
.contenedordatosacceso input[type="email"] {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    border: 1px solid #d0d7de;
    background: #fafbfc;
    margin-bottom: 0.85rem;
    font-size: 0.94rem;
    font-family: "Trebuchet MS", Arial, sans-serif;
    transition: .2s;
}

.contenedordatosacceso input:focus {
    outline: none;
    border-color: #1abc9c;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(26,188,156,.28);
}

/* Botones de envío: Iniciar sesión / Registrarse / Recuperar */
#registrarse,
#inciarsesion,
#btn_solicitar_reset,
#btn_cambiar_clave {
    width: 100%;
    padding: 0.75rem;
    border-radius: 999px;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    background: linear-gradient(135deg, #1abc9c, #16a085);
    cursor: pointer;
    transition: .2s;
}

#registrarse:hover,
#inciarsesion:hover,
#btn_solicitar_reset:hover,
#btn_cambiar_clave:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(0,0,0,.22);
}

#registrarse:active,
#inciarsesion:active,
#btn_solicitar_reset:active,
#btn_cambiar_clave:active {
    transform: scale(.98);
}

/* Enlace "¿Olvidaste tu contraseña?" y navegación en recuperar */
.link-recuperar,
.link-recuperar a {
    display: block;
    text-align: center;
    font-size: 0.82rem;
    color: #1abc9c;
    text-decoration: none;
    margin-top: 0.55rem;
    transition: color 0.15s ease;
}
.link-recuperar a:hover { color: #16a085; text-decoration: underline; }

/* ==========================================================
   VALIDACIÓN DE CORREO ELECTRÓNICO
   ========================================================== */

/* Mensaje debajo del input */
.input-hint {
    font-size: 0.75rem;
    margin-top: -0.4rem;
    margin-bottom: 0.8rem;
    color: #888;
    display: none; /* se activa desde JS */
    padding-left: 4px;
}

/* Input incorrecto */
input.email-error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.25) !important;
}

/* Input correcto */
input.email-ok {
    border-color: #2ecc71 !important;
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.25) !important;
    background-color: #ffffff !important;
}

/* Texto de error */
.hint-error {
    color: #e74c3c !important;
    display: block !important;
}

/* Texto válido */
.hint-ok {
    color: #2ecc71 !important;
    display: block !important;
}

/* Campo "código" del formulario de registro */
.formularioregistro input[name="codigo"],
.formularioregistro input#codigo {
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    text-align: center;
}

/* Mensajes de estado de registro/confirmación */
.registro-msg {
    max-width: 420px;
    margin: 1rem auto 0;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.4;
}
.registro-msg::before { flex-shrink: 0; }

.registro-msg-info {
    background: rgba(26, 188, 156, 0.08);
    border: 1px solid rgba(26, 188, 156, 0.35);
    border-left: 3px solid #1abc9c;
    color: #0e6655;
}
.registro-msg-info::before { content: "ℹ"; }

.registro-msg-ok {
    background: rgba(46, 204, 113, 0.08);
    border: 1px solid rgba(46, 204, 113, 0.35);
    border-left: 3px solid #2ecc71;
    color: #1a5b30;
}
.registro-msg-ok::before { content: "✓"; }

.registro-msg-error {
    background: rgba(231, 76, 60, 0.08);
    border: 1px solid rgba(231, 76, 60, 0.35);
    border-left: 3px solid #e74c3c;
    color: #c0392b;
}
.registro-msg-error::before { content: "⚠"; }

/* Mensaje de error en formulario de login */
.login-error-msg {
    background: rgba(231, 76, 60, 0.08);
    border: 1px solid rgba(231, 76, 60, 0.35);
    border-left: 3px solid #e74c3c;
    color: #c0392b;
    border-radius: 8px;
    padding: 0.55rem 0.8rem;
    margin-bottom: 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.login-error-msg::before {
    content: "⚠";
    flex-shrink: 0;
}

/* Imagen del código (captcha) más grande, contrastada y legible */
#codigoimg,
img[alt="codigo"],
img[alt="Código"],
img.codigo {
    width: 180px !important;
    height: auto !important;
    display: block;
    margin: 0.4rem auto 0.7rem auto;
    image-rendering: pixelated;
    filter: contrast(130%) brightness(1.2);
}


/* ------------ MEDIA QUERIES ACCESO / REGISTRO ------------ */

/* Tablet horizontal: 1024px */
@media (max-width: 1024px) {
    .p,
    .contenedoracceso,
    .contenedordatosacceso {
        max-width: 480px;
        margin-left: auto;
        margin-right: auto;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Tablet vertical: 768px */
@media (max-width: 768px) {
    .p,
    .contenedoracceso,
    .contenedordatosacceso {
        max-width: 440px;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .formularioregistro img {
        width: 180px !important;
        height: auto !important;
    }

    .p {
        font-size: 1rem;
        padding: 0.85rem 1.2rem;
    }

    .contenedoracceso button {
        font-size: 0.9rem;
        padding: 0.6rem 0;
    }

    .contenedordatosacceso {
        padding: 1.3rem 1.4rem;
    }
}

/* Móviles: 500px */
@media (max-width: 500px) {
    .p,
    .contenedoracceso,
    .contenedordatosacceso {
        max-width: 94% !important;
        margin-left: auto;
        margin-right: auto;
        padding-left: 0.7rem;
        padding-right: 0.7rem;
    }

    .p {
        font-size: 0.95rem;
        padding: 0.7rem 1rem;
        border-radius: 14px 14px 0 0;
    }

    .contenedoracceso {
        grid-template-columns: 1fr 1fr;
        border-radius: 0;
    }

    .contenedoracceso button {
        padding: 0.55rem 0;
        font-size: 0.85rem;
    }

    .contenedordatosacceso {
        padding: 1rem 1.2rem;
        border-radius: 0 0 14px 14px;
    }

    .formularioregistro img {
        width: 180px !important;
        height: auto !important;
    }

    input {
        font-size: .9rem;
    }
}

/* ── Panel administracion ── */
.admin-panel {
    max-width: 1400px;
    margin: 0 auto 2rem;
    padding: 0 10px;
}
.admin-titulo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1abc9c;
    text-align: center;
    margin: 0 0 1.5rem;
    counter-reset: none;
}
.admin-titulo::before,
.admin-subtitulo::before {
    content: none !important;
}
.admin-subtitulo {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 1.5rem 0 0.5rem;
    border-bottom: 2px solid #1abc9c;
    padding-bottom: 4px;
    text-align: center;
}
.admin-cards {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.admin-cards:nth-of-type(1) .admin-card { background: #2c3e50; }
.admin-cards:nth-of-type(2) .admin-card { background: #1a3a4a; }
.admin-cards:nth-of-type(3) .admin-card { background: #16594e; }
.admin-card {
    color: #ecf0f1;
    border-radius: 8px;
    padding: 16px 24px;
    text-align: center;
    min-width: 140px;
    flex: 1;
    max-width: 200px;
}
.admin-card-num {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #1abc9c;
}
.admin-card-label {
    display: block;
    font-size: 0.75rem;
    margin-top: 4px;
    color: #bdc3c7;
}
.admin-tabla-wrap {
    overflow-x: auto;
    margin-bottom: 1rem;
}
.admin-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.admin-tabla th {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 6px 8px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
}
.admin-tabla td {
    padding: 5px 8px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap;
}
.admin-tabla tbody tr:hover {
    background: #f0faf8;
}
.admin-td-anio {
    font-weight: 700;
    color: #2c3e50;
}
.admin-td-total {
    font-weight: 700;
    color: #1abc9c;
}
.admin-td-ip {
    font-family: monospace;
    font-size: 0.78rem;
}
.admin-tipo-bot {
    background: #e74c3c;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}
.admin-tipo-user {
    background: #27ae60;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}
.admin-btn-borrar {
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}
.admin-btn-borrar:hover {
    background: #c0392b;
}
