/* --- HEADER / NAVEGACIÓN (Para páginas fuera del portal) --- */
.main-header {
    background-color: rgba(13, 13, 17, 0.8);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    border-bottom: 1px solid #2a2a2e;
    width: 100%;
    top: 0;
    z-index: 1000;
    position: relative; /* Needed for absolute positioning of collapsible menu */
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}
.logo i {
    color: var(--accent-primary);
    font-size: 1.5rem;
}

.menu-toggle {
    display: none; /* Hidden by default on large screens */
    cursor: pointer;
    font-size: 1.8rem;
    color: var(--text-primary);
    align-items: center;
    justify-content: center;
}

.collapsible-menu {
    /* Por defecto en escritorio: flex en fila, visible */
    display: flex;
    flex-direction: row;
    align-items: center;
    width: auto;
    overflow: visible; /* Asegura que el contenido no se recorte en desktop */
    /* Aseguramos que el menú desplegable esté por encima de otros elementos del header */
    z-index: 990; /* ligeramente menor que el header principal pero aún alto */
    
    /* Transiciones para suavizar el cambio de estado (serán anuladas o controladas por JS en móvil) */
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, visibility 0.3s ease-out;
}

.main-nav ul {
    display: flex;
    gap: 2rem;
    margin-right: 1rem;
}
.main-nav a {
    font-weight: 500;
    position: relative;
    padding-bottom: 5px;
}
.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}
.main-nav a:hover::after {
    width: 100%;
}

.auth-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Style for "Login" button (outline) */
.auth-buttons .btn-login {
    background-color: transparent;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
    border-radius: 30px;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}
.auth-buttons .btn-login:hover {
    background-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(232, 67, 147, 0.3);
}

/* Style for "Register" button (primary) */
.auth-buttons .btn-register {
    background: var(--gradient-primary);
    color: var(--text-primary);
    border: none;
    border-radius: 30px;
    padding: calc(0.6rem + 2px) calc(1.5rem + 2px); /* Compensation for visual size matching */
    font-weight: 500;
    transition: all 0.3s ease;
}
.auth-buttons .btn-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(232, 67, 147, 0.4);
}

/* --- FOOTER --- */
.main-footer {
    text-align: center;
    padding: 2rem 0;
    background-color: #09090b;
    border-top: 1px solid #2a2a2e;
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-size: 1.8rem;
}
.social-icons i {
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
}
.social-icons i:hover {
    color: var(--accent-primary);
    transform: translateY(-5px);
}

.design-credit {
    margin-top: 20px;
    font-size: 0.9em;
    color: #888;
}
.design-credit a {
    color: #ff69b4; /* Specific color for design credit link */
    text-decoration: none;
    font-weight: bold;
}

/* --- Responsive styles for HEADER/FOOTER --- */
@media (max-width: 992px) {
    .main-header .container {
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .main-header .menu-toggle {
        display: flex; /* Show hamburger icon */
        order: 2; /* Position after logo */
    }

    /* Base state for collapsible menu in mobile view (hidden) */
    .main-header .collapsible-menu {
        flex-direction: column; /* Stack children vertically */
        width: 100%;
        height: auto; /* Allow content to dictate height, combined with max-height below */
        max-height: 0; /* Initially hidden, collapse via max-height */
        opacity: 0;
        visibility: hidden;
        padding: 0 1rem;
        box-shadow: none;
        margin-top: 0;
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        background-color: var(--bg-dark-secondary);
        border-bottom-left-radius: 10px;
        border-bottom-right-radius: 10px;
        z-index: 999; /* Asegura que esté sobre el contenido principal */
        box-sizing: border-box;
        overflow: hidden; /* Crucial para ocultar contenido cuando está colapsado */
        transition: max-height 0.3s ease-out, opacity 0.3s ease-out, visibility 0.3s ease-out;
    }

    /* Active state for collapsible menu in mobile view (shown) */
    .main-header .collapsible-menu.active {
        max-height: 500px; /* A generous max-height for smooth transition (JS calculates actual height) */
        opacity: 1;
        visibility: visible;
        padding: 1rem;
        border-top: 1px solid #2a2a2e;
        margin-top: 0;
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
        /* flex-direction, align-items, justify-content from base .collapsible-menu in mobile apply */
        overflow: visible; /* Allow content to overflow during active state if max-height is exceeded */
    }

    /* Styles for immediate children of .collapsible-menu when it's active (Desanidado) */
    .main-header .collapsible-menu.active .main-nav {
        display: flex; /* Show this flex container */
        flex-direction: column; /* Stack their children vertically */
        width: 100%; /* Take full width of parent */
        align-items: center; /* Center horizontally */
        padding: 0; /* Reset padding if necessary */
        margin-right: 0; /* Remove right margin */
        margin-bottom: 1rem; /* Space between nav and auth buttons */
    }

    .main-header .collapsible-menu.active .main-nav ul {
        display: flex; /* Ensure ul is a flex container */
        flex-direction: column; /* Stack list items */
        width: 100%;
        text-align: center;
        padding: 0;
        gap: 5px; /* Space between items */
    }

    .main-header .collapsible-menu.active .main-nav ul li {
        width: 100%;
        border-bottom: 1px solid #2a2a2e; /* Separator between menu items */
    }
    .main-header .collapsible-menu.active .main-nav ul li:last-child {
        border-bottom: none; /* No border for the last item */
    }
    .main-header .collapsible-menu.active .main-nav ul li a {
        padding: 15px; /* Ample padding for touch targets */
        display: block; /* Make the whole area clickable */
    }

    .main-header .collapsible-menu.active .auth-buttons {
        display: flex; /* Show auth buttons */
        flex-direction: column;
        padding: 15px;
        gap: 10px;
        width: 100%; /* Ensure buttons take full width */
    }
}

/* --- Estilos para el Aviso Permanente de Reestructuración --- */
.permanent-alert {
    position: sticky; /* Makes it stick to the top when scrolling */
    top: 0; /* Sticks to the top of the viewport */
    left: 0;
    width: 100%;
    background-color: var(--accent-primary); /* Uses your accent color for attention */
    color: var(--text-primary); /* White text */
    text-align: center;
    padding: 10px 20px;
    font-size: 1.1rem;
    font-weight: 600;
    z-index: 1001; /* Higher than main-header to be on top of it */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap; /* Allows text to wrap on small screens */
}

.permanent-alert p {
    margin: 0; /* Remove default paragraph margin */
}

.permanent-alert i {
    font-size: 1.3rem;
    color: var(--text-primary);
}

/* Ajuste para móviles si es necesario para el aviso */
@media (max-width: 768px) {
    .permanent-alert {
        font-size: 0.95rem;
        padding: 8px 15px;
    }
    .permanent-alert i {
        font-size: 1.1rem;
    }
}

/* --- Mobile Compatibility Warning --- */
.mobile-warning-message {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(26, 26, 30, 0.95); /* bg-dark-secondary with opacity */
    color: #FFFFFF; /* text-primary */
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5); /* shadow-dark */
    z-index: 9999; /* Ensures it's on top of almost everything */
    max-width: 90%;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.4;
    
    /* Hidden by default on all screens, controlled by JS logic for showing/hiding.
       This is the base state. */
    display: none; 
    
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.mobile-warning-message p {
    margin: 0;
    color: var(--text-secondary);
}

.mobile-warning-message .close-mobile-warning {
    background-color: var(--accent-primary);
    color: var(--text-primary);
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.mobile-warning-message .close-mobile-warning:hover {
    background-color: #C2277B; /* Darker accent-primary */
}

/* Rule to force display as flex ONLY when screen is mobile size,
   if JS removes .hidden class, this makes it visible with flex. */
@media (max-width: 768px) {
    /* REMOVED !important. JS will now toggle 'hidden' class. */
    .mobile-warning-message:not(.hidden) { /* Show only if not explicitly hidden by JS */
        display: flex;
    }
}
