/* ========================================================================= */
/* ESTILOS BASE (APLICAN POR DEFECTO Y A MÓVILES) */
/* ========================================================================= */

body {
    font-family: Arial, sans-serif;
    margin: 0; 
    padding: 0;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; 
}

/* -------------------- LAYOUT PRINCIPAL -------------------- */

header {
    background-color: #2e353f; 
    color: white;
    padding: 0; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
}

/* Contenedor principal del Header: Permite que los elementos se envuelvan */
#header-contenido {
    display: flex;
    flex-wrap: wrap; /* CLAVE: Permite que los elementos se envuelvan en móvil */
    justify-content: center; /* Centramos el contenido en móvil */
    align-items: center;
    padding: 10px 10px; 
}

/* **CLAVE MÓVIL: Ocultamos el contenedor de botones** */
.header-botones {
    display: none; 
}

/* El bloque central se apila en columna en móvil */
.header-centro {
    display: flex;
    flex-direction: column; 
    align-items: center;
    width: 100%; 
    margin: 5px 0;
}

/* El contenedor de contacto (teléfonos/email) se centra y ajusta */
.header-contacto {
    display: flex;
    flex-wrap: wrap; 
    justify-content: center;
    font-size: 14px;
    margin-bottom: 5px; 
}

.header-contacto .info-item {
    margin: 2px 10px;
    white-space: nowrap;
}

.header-marca {
    font-size: 1.2em; 
    font-weight: bold;
    margin: 5px 0; 
}

/* -------------------- CONTENIDO E IMAGEN -------------------- */

#fondo-rotatorio { 
    flex-grow: 1;
    position: relative;
    /* Ajuste de altura para móvil (El header es más alto ahora, ~80px) */
    height: calc(100vh - 100px); 
    overflow-y: auto; 
    
    transition: background-image 2s ease-in-out;
    background-size: contain; 
    background-repeat: no-repeat; 
    background-attachment: fixed;
    background-position: center center; 
    background-color: #f4f4f4; 
}

main {
    padding: 20px;
    margin-top: 0;
    margin-bottom: 0;
    box-sizing: border-box;
    height: 100%; 
}

/* -------------------- PIE DE PÁGINA Y COMPONENTES -------------------- */

footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 10px;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
}

/* Estilos para el círculo de redes sociales */
.circulo-social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background-color: #4a5461;
    color: white;
    font-size: 14px;
    margin-right: 10px;
}

.circulo-social:hover {
    background-color: #ff9933;
    color: white;
}

/* Estilos de botones para escritorio (son invisibles en móvil por .header-botones) */
.boton-header {
    display: inline-block;
    padding: 8px 15px;
    margin-left: 10px;
    font-size: 12px;
    font-weight: bold;
    text-decoration: none;
    color: white;
    text-align: center;
    border-radius: 4px;
    background-color: #ff9933;
    transition: background-color 0.3s;
}

.boton-header:hover {
    background-color: #e68a2e;
}

/* -------------------------------------------------------------------------- */
/* MEDIA QUERY: ESTILOS SOLO PARA ESCRITORIO (> 768px) */
/* -------------------------------------------------------------------------- */

@media (min-width: 769px) {
    
    /* Restaurar el layout Horizontal del Header */
    #header-contenido {
        justify-content: flex-start;
        flex-wrap: nowrap;
        padding: 5px 20px;
    }
    
    /* El bloque social vuelve a estar a la izquierda y separado */
    #header-contenido > .header-sociales {
        margin-right: 20px; 
    }
    
    /* MOSTRAR BOTONES y restaurar diseño de fila */
    .header-botones {
        display: flex;
        flex-direction: row;
        margin-left: 10px; 
        width: auto;
    }
    
    .boton-header {
        width: auto;
        margin-left: 10px;
        margin-right: 0;
    }
    
    /* El bloque central ahora va en orden normal: [Título] [Contacto] */
    .header-centro {
        flex-direction: row; /* Orden: Título, Contacto */
        flex-grow: 1; /* CLAVE: Ocupa todo el espacio entre Sociales y Botones */
        justify-content: space-between; /* Distribuye el espacio entre los dos elementos */
        align-items: center;
        margin: 0;
        width: auto;
    }

    /* El Título vuelve a estar en el extremo izquierdo del centro */
    .header-marca {
        flex-grow: 0; /* No crece, ocupa solo su ancho */
        margin-right: 30px; /* Margen para asegurar separación mínima */
        margin-left: 0; 
    }

    /* El bloque de contacto vuelve a estar en línea, pegado a los botones */
    .header-contacto {
        flex-wrap: nowrap;
        flex-grow: 0; /* No crece, solo ocupa el espacio necesario */
        justify-content: flex-end; /* Alinea los contactos a la derecha del bloque central */
        margin: 0;
    }
    
    .header-contacto .info-item {
        margin-right: 20px; /* Restaurar espaciado de escritorio */
    }

    /* Restaurar la altura para escritorio */
    #fondo-rotatorio { 
        height: calc(100vh - 80px); /* Vuelve al cálculo de 80px (40h + 40f) */
    }
}