/* Estilos Compartidos para Header, Footer y Elementos Comunes */
/*
 * Se utiliza el "system font stack" para una apariencia nativa y un rendimiento óptimo.
 * En dispositivos Apple, usará "San Francisco". En Windows, "Segoe UI", etc.
 * Es una técnica moderna que se alinea con la estética de Apple.
*/
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: #f8f9fa; /* Un fondo global suave */
}

/* --- Estructura Base del Header (Común para ambas versiones) --- */
.header-content {
    position: relative; /* Añadido para posicionar el menú de forma absoluta */
    padding: 15px 30px; /* Padding reducido para mantener altura original */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    height: 30px; /* Ligeramente más pequeño para un look más refinado */
}

.main-nav {
    position: absolute; /* Centrado absoluto */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 35px; /* Más espacio */
}
.main-nav a {
    font-weight: 600; /* Semi-bold para un look moderno */
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px; /* Espacio entre el perfil de usuario y los botones */
}

.auth-buttons {
    display: flex;
    align-items: center;
    gap: 12px; /* Espacio consistente entre elementos */
}

.perfil-usuario {
    width: 40px; /* Tamaño del círculo del perfil */
    height: 40px;
    border-radius: 50%;
    background-color: #e0f0ff; /* Fondo por defecto si no hay imagen */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    cursor: pointer;
    position: relative; /* Para el menú desplegable */
    flex-shrink: 0; /* Evita que se encoja */
}

.perfil-usuario img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.perfil-usuario span {
    font-size: 18px;
    font-weight: 600;
    color: #007aff; /* Color de la letra por defecto */
}

/* Avatar del header para emprendedores y proveedores */
.perfil-usuario-header {
    width: 36px; /* Reducido para mantener altura del header */
    height: 36px; /* Reducido para mantener altura del header */
    border-radius: 50%;
    background-color: #e9e9eb;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible; /* Cambiado a visible para que el menú se vea */
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid transparent;
    z-index: 10001; /* Z-index alto para estar sobre otros elementos */
}

.perfil-usuario-header:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
    border-color: rgba(0, 122, 255, 0.3);
}

.perfil-usuario-header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.perfil-usuario-header span {
    font-size: 16px; /* Reducido para mantener proporción */
    font-weight: 600;
    color: #007aff;
}

/* Avatar de invitado */
.perfil-usuario-header.perfil-invitado {
    background-color: #e9e9eb;
    text-decoration: none;
    border: 2px solid #d1d1d6;
    position: relative;
}

.perfil-usuario-header.perfil-invitado::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'%3E%3C/path%3E%3Ccircle cx='12' cy='7' r='4'%3E%3C/circle%3E%3C/svg%3E");
    background-size: 20px 20px;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
}

.perfil-usuario-header.perfil-invitado:hover {
    border-color: rgba(0, 122, 255, 0.4);
    background-color: #e8f0fe;
}

.perfil-usuario-header.perfil-invitado:hover::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23007aff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'%3E%3C/path%3E%3Ccircle cx='12' cy='7' r='4'%3E%3C/circle%3E%3C/svg%3E");
}

.menu-perfil-desplegable {
    position: absolute;
    top: calc(100% + 10px); /* Debajo del perfil-usuario con espacio */
    right: 0; /* Alineado a la derecha del perfil-usuario */
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 200px;
    padding: 8px 0;
    display: none; /* Oculto por defecto */
    z-index: 10002; /* Z-index muy alto para estar sobre todo */
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    visibility: hidden; /* Oculto pero mantiene espacio */
    pointer-events: none; /* No captura eventos cuando está oculto */
}

.menu-perfil-desplegable.active {
    display: block !important; /* Forzar display block cuando está activo */
    opacity: 1 !important;
    transform: translateY(0) !important;
    visibility: visible !important; /* Visible cuando está activo */
    pointer-events: auto !important; /* Captura eventos cuando está activo */
    z-index: 10002 !important; /* Asegurar z-index alto */
}

/* Menú del header específico */
#menu-perfil-header {
    margin-top: 8px;
}

.menu-perfil-desplegable .info-perfil {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 5px;
}

.menu-perfil-desplegable .info-perfil p {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin: 0;
}

.menu-perfil-desplegable a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: 0;
    cursor: pointer;
    pointer-events: auto; /* Asegurar que los enlaces sean clickeables */
}

.menu-perfil-desplegable a:hover {
    background-color: #f5f5f7;
    color: #007aff;
}

.auth-buttons a {
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 20px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap; /* Evitar que el texto se parta */
}

/* El gap en .auth-buttons ya maneja el espaciado */

/* --- VERSIÓN 1: Header Transparente Dinámico (para index.php) --- */
.directorio-header-transparent {
    position: absolute; /* Debe ser absoluto para flotar sobre la imagen */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
.main-nav a.nav-cta {
    background-color: #007aff;
    color: white;
}
.main-nav a.nav-cta:hover {
    background-color: #005bb5;
}
.directorio-header-transparent .main-nav a:not(.nav-cta) { color: #e5e5ea; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.directorio-header-transparent .main-nav a:not(.nav-cta):hover { color: white; }
.directorio-header-transparent .auth-buttons .btn-login { 
    color: white; 
    border: 1px solid rgba(255, 255, 255, 0.3); /* Borde más sutil */
    background-color: rgba(255, 255, 255, 0.15); /* Fondo blanco translúcido */
    backdrop-filter: blur(10px); /* Desenfoque similar al nav-bar */
    -webkit-backdrop-filter: blur(10px);
    text-shadow: 0 1px 4px rgba(0,0,0,0.5); /* Sombra de texto un poco más fuerte */
}
.directorio-header-transparent .auth-buttons .btn-login:hover { background-color: rgba(255, 255, 255, 0.1); }
.directorio-header-transparent .auth-buttons .btn-register { background-color: #007aff; color: white; border: 1px solid #007aff; }
.directorio-header-transparent .auth-buttons .btn-register:hover { background-color: #005bb5; }

/* Efecto al hacer scroll */
.directorio-header-transparent.scrolled {
    position: fixed; /* Se vuelve fijo al hacer scroll */
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.directorio-header-transparent.scrolled .main-nav a:not(.nav-cta) { color: #333; }
.directorio-header-transparent.scrolled .main-nav a:not(.nav-cta):hover { color: #007aff; }
.directorio-header-transparent.scrolled .auth-buttons .btn-login { color: #1d1d1f; border: 1px solid #ccc; }
.directorio-header-transparent.scrolled .auth-buttons .btn-login:hover { background-color: #f0f0f0; }

/* --- VERSIÓN 2: Header Blanco Profesional (para páginas internas) --- */
.directorio-header-white {
    background-color: #fff;
    border-bottom: 1px solid #e5e5ea;
    position: sticky;
    top: 0;
    z-index: 100;
}

.directorio-header-white .main-nav a:not(.nav-cta) { color: #333; }
.directorio-header-white .main-nav a:not(.nav-cta):hover { color: #007aff; }
.directorio-header-white .auth-buttons .btn-login { color: #1d1d1f; border: 1px solid #ccc; }
.directorio-header-white .auth-buttons .btn-login:hover { background-color: #f0f0f0; }
.directorio-header-white .auth-buttons .btn-register { background-color: #007aff; color: white; border: 1px solid #007aff; }
.directorio-header-white .auth-buttons .btn-register:hover { background-color: #005bb5; }

/* --- VERSIÓN 3: Header con Buscador (para perfil_publico.php, sector.php, etc.) --- */
.public-header {
    background-color: #fff;
    padding: 20px 30px; /* Aumentado para consistencia */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e5ea;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 30px; /* Más espacio */
}
.public-header .auth-buttons .btn-login { color: #1d1d1f; border: 1px solid #ccc; }
.public-header .auth-buttons .btn-login:hover { background-color: #f0f0f0; }
.public-header .auth-buttons .btn-register { background-color: #007aff; color: white; border: 1px solid #007aff; }
.public-header .auth-buttons .btn-register:hover { background-color: #005bb5; }


.header-search-form { flex-grow: 1; display: flex; max-width: 500px; }
.header-search-form input { width: 100%; padding: 10px 18px; border: 1px solid #e5e5ea; border-radius: 50px 0 0 50px; font-size: 14px; outline: none; background-color: #f8f9fa; transition: border-color 0.2s ease; }
.header-search-form input:focus { border-color: #007aff; }
.header-search-form button { padding: 10px 20px; border: none; background-color: #007aff; color: white; font-size: 14px; font-weight: 500; border-radius: 0 50px 50px 0; cursor: pointer; transition: background-color 0.2s ease; }
.header-search-form button:hover { background-color: #005bb5; }
@media (max-width: 768px) { .header-search-form { display: none; } }

/* --- Footer Profesional (Reutilizable) --- */
.public-footer {
    background-color: #1d1d1f;
    color: #e5e5ea;
    padding: 50px 20px 80px 20px;
    border-radius: 50px 50px 0 0;
}.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}
.footer-col.about .footer-logo {
    height: 40px;
    margin-bottom: 15px;
}
.footer-col.about p {
    color: #999;
    line-height: 1.7;
    max-width: 350px;
}
.footer-col h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #fff;
}
.footer-col p {
    font-size: 14px;
    color: #999;
    margin-bottom: 10px;
}
.footer-col a {
    display: block;
    color: #e5e5ea;
    text-decoration: none;
    margin-bottom: 5px;
    transition: color 0.2s ease;
}
.footer-col a:hover {
    color: #007aff;
}
.footer-bottom {
    border-top: 1px solid #444;
    padding-top: 20px;
    text-align: center;
    font-size: 14px;
    color: #999;
}
.footer-bottom a {
    color: #ccc;
    text-decoration: none;
    margin: 0 10px;
}
.footer-bottom a:hover {
    text-decoration: underline;
}

.social-icons {
    display: flex;
    gap: 15px;
}
.social-icons a {
    color: #999;
    transition: color 0.2s ease;
}
.social-icons a:hover {
    color: #fff;
}

/* Responsividad para Footer */
@media (max-width: 768px) {
    .footer-container { 
        grid-template-columns: 1fr; 
        text-align: center; 
    }
    .footer-col.about p { 
        margin-left: auto; 
        margin-right: auto; 
    }
    .social-icons { 
        justify-content: center; 
    }
}

/* ============================================
   MEJORAS RESPONSIVE PARA HEADER Y NAVEGACIÓN
   ============================================ */

@media (max-width: 992px) {
    .header-content {
        padding: 12px 20px;
    }
    
    .logo {
        height: 28px;
    }
    
    .auth-buttons {
        gap: 8px;
    }
    
    .auth-buttons a {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    /* Menú hamburguesa para navegación principal */
    .mobile-nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: transparent;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        cursor: pointer;
        color: var(--text-dark);
    }
    
    .main-nav {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: calc(100vh - 70px);
        background: #fff;
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        transition: left 0.3s ease;
        z-index: 999;
        gap: 0;
    }
    
    .main-nav.active {
        left: 0;
    }
    
    .main-nav a {
        width: 100%;
        padding: 15px 0;
        border-bottom: 1px solid #eee;
        color: var(--text-dark);
    }
    
    .main-nav a:hover {
        background-color: var(--background-color);
        padding-left: 10px;
    }
}

@media (max-width: 768px) {
    /* Ocultar header completamente en móvil para TODAS las páginas */
    #main-header,
    .directorio-header-transparent,
    .directorio-header-white,
    .public-header {
        display: none !important;
    }
    
    /* Eliminar padding-top del body en móvil */
    body {
        padding-top: 0 !important;
    }
    
    .header-content {
        padding: 10px 15px;
    }
    
    .perfil-usuario-header {
        width: 32px;
        height: 32px;
    }
    
    .perfil-usuario-header span {
        font-size: 14px;
    }
    
    .auth-buttons .btn-register {
        display: none; /* Ocultar registro en móvil, mostrar solo login */
    }
    
    .auth-buttons .btn-login {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    /* Footer responsive mejorado */
    .public-footer {
        padding: 30px 15px 50px 15px;
        border-radius: 30px 30px 0 0;
    }
    
    .footer-container {
        gap: 30px;
    }
    
    /* Header search form en móvil */
    .header-search-form {
        display: none; /* Ocultar búsqueda del header en móvil */
    }
}

/* FAQ Section */
.faq-section {
    padding: 5rem 1rem;
    background-color: #f9f9f9; /* Light background for contrast */
    position: relative;
    overflow: hidden;
}

.faq-section .section-title {
    margin-bottom: 3rem;
    color: #333;
}

.faq-list {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
}

.faq-item {
    background-color: #fff;
    border-radius: 12px;
    margin-bottom: 1rem;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #F0F0F0;
}

.faq-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #E0E0E0;
}

.faq-item.active {
    border-color: #007AFF;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
}

.faq-question {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1C1C1E;
    margin-bottom: 0;
    cursor: pointer;
    transition: color 0.2s ease;
}

.faq-item.active .faq-question {
    color: #007AFF;
}

.faq-answer {
    font-size: 1rem;
    color: #555;
    line-height: 1.6;
}

/* FAQ Section - Accordion Functionality */
.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    /* Existing styles for faq-question remain */
}

.faq-toggle-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 12px;
    color: #8E8E93;
    flex-shrink: 0;
}

.faq-item.active .faq-toggle-icon {
    color: #007AFF;
}

.faq-item.active .faq-toggle-icon {
    transform: rotate(180deg);
}

.faq-answer-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s ease;
    padding-top: 0;
}

.faq-item.active .faq-answer-wrapper {
    max-height: 500px;
    padding-top: 12px;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s ease;
}

.faq-answer-content {
    color: #6E6E73;
    line-height: 1.6;
    font-size: 0.95rem;
}
