/* =========================================
   1. VARIABLES Y RESET
   ========================================= */
:root {
    --color-primary: #187da0; /* Azul corporativo (basado en captura) */
    --color-secondary: #2c3e50; /* Gris oscuro para textos */
    --color-accent: #6e62ff; /* Morado (basado en modal de cookies) */
    --color-text: #555555;
    --color-bg-light: #f9f9f9;
    --color-white: #ffffff;
    --color-border: #e1e1e1;
    
    --font-main: 'Roboto', sans-serif;
    
    --header-height: 110px;
    --container-width: 1320px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    color: var(--color-text);
    background-color: var(--color-white);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* Container Utility */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Main Content Wrapper (para sticky footer) */
main {
    flex: 1;
}

/* =========================================
   2. HEADER Y NAVEGACIÓN
   ========================================= */
.main-header {
    background-color: var(--color-white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: relative;
    z-index: 1000;
}

.header-container {
    display: flex;
    flex-direction: column;
}

/* Brand Area (Logos) */
.brand-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.logo-parcesam {
    height: 80px; /* Ajustar según tamaño real */
}

.brand-text {
    text-align: center;
    flex-grow: 1;
    padding: 0 20px;
}

.brand-text h1 {
    font-size: 2.2rem;
   
text-transform: uppercase;
    font-weight: 400;
	color: #888;
}

.brand-text h2 {
    font-size: 1rem;
    color: #888;
    font-weight: 400;
    text-transform: uppercase;
}

.logo-escudo {
    height: 70px;
}

/* Navigation Bar */
.main-nav {
    background-color: var(--color-white);
    padding: 0;
}

.main-nav > ul {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.main-nav > ul > li {
    position: relative;
}

.main-nav > ul > li > a {
    display: block;
    padding: 15px 20px;
    font-size: 1.0rem;
    font-weight: 500;
    color: #6c767f;
    text-transform: uppercase;
    border-bottom: 3px solid transparent;
}

.main-nav > ul > li > a:hover,
.main-nav > ul > li > a.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    background-color: #f8fbff;
}

.main-nav i {
    margin-right: 5px; /* Espacio para iconos si decidimos ponerlos en desktop, aunque el diseño original es solo texto */
    display: none; /* Ocultamos iconos en desktop para mantener limpieza según imagen original, los mostramos en móvil */
}

/* =========================================
   3. DROPDOWNS (SUBMENÚS)
   ========================================= */
/* Submenu Nivel 1 */
.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--color-white);
    min-width: 280px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    border-top: 3px solid var(--color-primary);
    z-index: 1001;
}

.has-submenu:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.submenu li {
    border-bottom: 1px solid #eee;
    position: relative; /* Para posicionar el nivel 2 */
}

.submenu li:last-child {
    border-bottom: none;
}

.submenu a {
    display: block;
    padding: 12px 20px;
    font-size: 0.9rem;
    color: #555;
    text-transform: none; /* Texto normal en submenús */
    border-left: 3px solid transparent;
}

.submenu a:hover {
    background-color: #f9f9f9;
    color: var(--color-primary);
    border-left-color: var(--color-primary);
}

/* Submenu Nivel 2 (Licitaciones abiertas -> ...) */
.submenu-level-2 {
    position: absolute;
    top: 0;
    left: 100%; /* A la derecha del padre */
    background-color: var(--color-white);
    min-width: 280px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.3s ease;
    border-top: 3px solid var(--color-primary);
    z-index: 1002;
}

.has-submenu-level-2:hover .submenu-level-2 {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Flechas indicadoras */
.fa-chevron-down, .fa-chevron-right {
    font-size: 0.7em;
    margin-left: 5px;
    display: inline-block !important; /* Forzamos mostrar estas flechas especificas */
}

/* =========================================
   4. MODAL DE COOKIES Y LEGAL (Estilo imagen_cf8104.png)
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: none; /* Oculto por defecto */
    justify-content: center;
    align-items: center;
}

.modal-container {
    background-color: white;
    width: 90%;
    max-width: 900px;
    height: 80vh;
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Botón cerrar flotante circular */
.modal-close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 50px;
    height: 50px;
    background-color: var(--color-accent);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 100;
    transition: transform 0.2s;
}

.modal-close-btn:hover {
    transform: scale(1.1);
}

/* Barra lateral izquierda */
.modal-sidebar {
    width: 300px;
    background-color: #f5f5f5;
    padding: 30px 20px;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
}

.modal-logo {
    font-size: 60px;
    color: #ccc;
    font-weight: bold;
    margin-bottom: 30px;
    text-align: center;
    /* Simulando la 'P' grande de la imagen */
    background: linear-gradient(to bottom, #ddd, #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.1));
}

.modal-nav button {
    display: block;
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 10px;
    background-color: #eee;
    border: none;
    border-radius: 4px;
    text-align: left;
    color: var(--color-accent);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.modal-nav button:hover,
.modal-nav button.active {
    background-color: #e0dcfc; /* Morado muy claro */
    color: var(--color-accent);
    border-left: 4px solid var(--color-accent);
}

/* Área de contenido derecha */
.modal-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    position: relative;
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: black;
}

.modal-content p {
    margin-bottom: 15px;
    font-size: 0.95rem;
    color: #555;
    text-align: justify;
}

/* Botones de acción del modal (abajo) */
.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn-modal {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 4px;
    color: white;
    background-color: var(--color-accent);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-modal:hover {
    background-color: #5849d6;
}

/* =========================================
   5. FOOTER
   ========================================= */
.main-footer {
    background-color: #333;
    color: white;
    padding: 40px 0 20px;
    margin-top: 50px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 1px solid #444;
}

.footer-info p {
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #ccc;
}

.footer-legal-btn {
    background-color: var(--color-primary); /* Azul de la imagen */
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 2px;
    transition: background-color 0.3s;
}

.footer-legal-btn:hover {
    background-color: #125b75;
}

.footer-copyright {
    text-align: right;
    padding-top: 20px;
    font-size: 0.8rem;
    color: #888;
}

/* =========================================
   6. RESPONSIVE (MÓVIL)
   ========================================= */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-primary);
}

@media (max-width: 992px) {
    .brand-area {
        flex-direction: column;
        text-align: center;
    }
    
    .logo-parcesam, .logo-escudo {
        margin: 10px 0;
        height: 60px;
    }

    .brand-text {
        padding: 10px 0;
    }
    
    .brand-text h1 {
        font-size: 1.8rem;
    }

    /* Menú Móvil */
    .mobile-menu-btn {
        display: block;
        position: absolute;
        top: 20px;
        right: 20px;
    }

    .main-nav {
        display: none; /* Oculto por defecto en móvil */
        width: 100%;
        background-color: #fff;
    }

    .main-nav.active {
        display: block;
    }

    .main-nav > ul {
        flex-direction: column;
    }

    .main-nav > ul > li > a {
        border-bottom: 1px solid #eee;
        padding: 15px;
    }
    
    .main-nav i {
        display: inline-block; /* Mostrar iconos en móvil */
        width: 25px;
        text-align: center;
    }

    /* Submenús en móvil (estilo acordeón) */
    .submenu, .submenu-level-2 {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        min-width: 100%;
        display: none; /* Oculto inicialmente */
        background-color: #f9f9f9;
        border-top: none;
        padding-left: 20px; /* Indentación */
    }

    .submenu.open, .submenu-level-2.open {
        display: block;
    }

    .submenu-level-2 {
        background-color: #f0f0f0; /* Un poco más oscuro para diferenciar nivel 2 */
        border-left: 2px solid var(--color-primary);
    }

    /* Rotar flechas cuando está abierto */
    .rotate-icon {
        transform: rotate(180deg);
        transition: transform 0.3s;
    }
}