/* ===== Scroll general en toda la página ===== */
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: auto; /* Scroll vertical y horizontal si el contenido lo necesita */
  scroll-behavior: smooth; /* Scroll suave */
  font-family: Arial, Georgia, Serif;
  font-size: 15px;
  background: #f9f9f9;
  color: #333;
}

/* Forzar scrollbars visibles */
body {
  overflow-x: scroll;
  overflow-y: scroll;
}

/* Scrollbars personalizados modernos */
body::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}
body::-webkit-scrollbar-track {
    background: #f1f1f1;
}
body::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 6px;
    border: 3px solid #f1f1f1;
}
body::-webkit-scrollbar-thumb:hover {
    background-color: #555;
}

/* Firefox scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: #888 #f1f1f1;
}

/* ===== Contenedor ===== */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* ===== Header ===== */
header {
    text-align: center;
    border: 1px solid #666;
    background: #cccccc;
    padding: 10px 0;
}

/* ===== Links ===== */
a {
    color: #333;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ===== Navigation ===== */
nav {
    padding: 0.5%;
    background: #f06156;
    height: auto;
}

nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    text-align: center;
}

nav ul li {
    display: inline-block;
    margin: 2px;
}

nav ul li a {
    display: inline-block;
    text-align: center;
    text-decoration: none;
    color: #75302a;
    font-weight: bold;
    padding: 6px 15px;
    background: #fafafa;
    border-radius: 3px;
    transition: all 0.3s ease;
}

nav ul li a:hover {
    background-color: grey;
    color: blueviolet;
    font-size: 20px;
    text-decoration: underline;
}

/* ===== Section & Aside ===== */
section, aside {
    margin-top: 5px;
    padding: 10px;
    border-radius: 3px;
    box-sizing: border-box;
}

section {
    float: left;
    width: 100%;
    background: #fafafa;
    border: 1px solid #ccc;
}

aside {
    float: right;
    width: 0%;
    background: #ccc;
    color: #333;
}

/* ===== Footer ===== */
footer {
    padding: 5px 10px;
    background-color: #333;
    text-align: right;
    font-size: 0.85em;
    color: #fff;
}

footer a {
    color: #fff;
    font-size: 0.85em;
}

/* ===== Headings ===== */
h2 {
    color: #f06156;
    font-size: 1.5em;
    margin-bottom: 10px;
}

h3 {
    font-size: 24px;
    padding: 5px;
    color: #333;
    background-color: pink;
    text-align: center;
    font-style: italic;
    border: 3px solid red; 
    border-radius: 10px; 
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5); 
    padding: 20px; 
    text-decoration: underline;
}

/* ===== Inputs y Formularios ===== */
input, select, textarea, button {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    margin-bottom: 10px;
    border: 2px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    display: block;
    transition: all 0.3s ease;
}

input:valid, textarea:valid, select:valid {
    border: 2px solid green;
    background-color: #E5FFE5;
}

input:invalid, textarea:invalid, select:invalid {
    border: 2px solid red;
    background-color: #fdd;
}

/* Botones */
.boton-consulta, input[type="submit"] {
    background-color: #4CAF50;
    color: black;
    padding: 10px 20px;
    text-align: center;
    font-size: 16px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.boton-consulta:hover, input[type="submit"]:hover:enabled {
    color: red;
    background-color: grey;
    text-decoration: underline;
}

input[type="submit"]:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Campos "Otros" */
.otros-input {
    display: none;
    margin-top: 10px;
}

/* ===== Mensajes de error ===== */
.error-msg {
    color: red;
    font-size: 0.85em;
    margin: 3px 0 10px 0;
}

/* ===== Toast ===== */
.toast-success, .toast-error {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 5px;
    color: #fff;
    font-weight: bold;
    z-index: 9999;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    opacity: 0.95;
    transition: all 0.3s ease;
}

.toast-success { background-color: #28a745; }
.toast-error   { background-color: #dc3545; }

.toast-success.hide,
.toast-error.hide {
    opacity: 0;
    transform: translateX(100%);
}

.toast.fadeout { animation: fadeOut 1s ease-in forwards; }

.enlace {
    display: inline-block;
    padding: 10px 20px;
    font-size: 16px;
    background-color: #0056b3;
    color: #fff;
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.enlace:hover {
    color: #fff;
    background-color: #007bff;
    cursor: pointer;
    transform: scale(1.1);
}

/* ===== Animaciones ===== */
@keyframes slideFadeIn {
    from { opacity: 0; transform: translateY(-30px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-20px); }
}

/* ===== Responsive ===== */
@media screen and (max-width: 980px) {
    .container { width: 95%; }
    section { width: 100%; }
    nav ul { flex-direction: column; width: 100%; }
    nav ul li { display: block; width: 100%; }
}

@media screen and (max-width: 700px) {
    section, aside { float: none; width: 100%; }
    nav ul { flex-direction: column; width: 100%; }
    nav ul li { display: block; width: 100%; }
}

@media screen and (max-width: 480px) {
    aside { display: block; background: #333; color: #fff; font-size: 1.2em; }
    nav, section { font-size: 1.2em; }
    section { width: 94%; }
    nav ul { display: table; width: 100%; }
    input, select, textarea, button { max-width: 100%; font-size: 1em; padding: 8px; }
}

/* ===== Tablas responsive ===== */
#tabla-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    margin: 15px 0;
}

.tabla-resultados {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-family: Arial, sans-serif;
    font-size: 12px;
    table-layout: fixed;
}

.tabla-resultados th,
.tabla-resultados td {
    border: 1px solid #999;
    padding: 6px;
    text-align: left;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.tabla-resultados th {
    background-color: #f0f0f0;
    color: #333;
    font-weight: bold;
}

.tabla-resultados tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.tabla-resultados tbody tr:hover {
    background-color: #d0e7f9;
}

/* Paginación */
.paginacion {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
}

.paginacion a {
    text-decoration: none;
    color: #007bff;
    padding: 2px 6px;
    margin: 0 2px;
    border: 1px solid #007bff;
    border-radius: 3px;
}

.paginacion a:hover {
    background-color: #007bff;
    color: #fff;
}

.paginacion strong {
    padding: 2px 6px;
    margin: 0 2px;
    background-color: #007bff;
    color: #fff;
    border-radius: 3px;
}

.campo-fecha {
    display: flex;
    align-items: center;
    gap: 10px;
}
.campo-fecha span {
    color: red;
}

/* ===== Responsive móvil - tabla tipo tarjeta ===== */
@media (max-width: 480px) {
    .tabla-resultados,
    .tabla-resultados thead,
    .tabla-resultados tbody,
    .tabla-resultados th,
    .tabla-resultados td,
    .tabla-resultados tr {
        display: block;
    }

    .tabla-resultados thead tr {
        display: none;
    }

    .tabla-resultados tbody td {
        position: relative;
        padding-left: 50%;
        text-align: left;
        white-space: normal;
    }

    .tabla-resultados tbody td::before {
        position: absolute;
        top: 0;
        left: 0;
        width: 45%;
        padding-left: 6px;
        white-space: nowrap;
        font-weight: bold;
        content: attr(data-label);
    }
}

/* ===== Título fijo ===== */
.titulo1 {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 9999;
}
