/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background-color: #fafafa;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo-link {
    text-decoration: none;
}

.logo {
    height: 50px;
    width: auto;
}

/* Barra de navegación - ESTILOS ACTUALIZADOS */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1000;
    min-height: 60px;
    display: flex;
    align-items: center;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

/* Botón de menú móvil (hamburguesa) */
.mobile-menu-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    cursor: pointer;
    padding: 6px 10px;
    z-index: 1002;
    margin-left: auto;
}

.mobile-menu-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 22px;
    height: 18px;
}

.mobile-menu-label {
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mobile-menu-toggle:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background-color: white;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 15px 20px;
    display: block;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

/* Dropdown Menu Principal */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    list-style: none;
    padding: 10px 0;
    margin: 0;
    z-index: 1001;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-link {
    color: #333;
    text-decoration: none;
    padding: 10px 20px;
    display: block;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.dropdown-link:hover {
    background-color: #f8f9fa;
    border-left-color: #667eea;
    padding-left: 25px;
}

/* Submenús anidados - NUEVOS ESTILOS */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu > .dropdown-link.has-submenu::after {
    content: '›';
    float: right;
    margin-left: 10px;
    transform: rotate(0deg);
    transition: transform 0.3s ease;
}

.dropdown-submenu:hover > .dropdown-link.has-submenu::after {
    transform: rotate(90deg);
}

.submenu {
    position: absolute;
    left: 100%;
    top: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    list-style: none;
    padding: 10px 0;
    z-index: 1002;
}

.dropdown-submenu:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.submenu-link {
    color: #333;
    text-decoration: none;
    padding: 10px 20px;
    display: block;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.submenu-link:hover {
    background-color: #f8f9fa;
    border-left-color: #764ba2;
    padding-left: 25px;
}

/* Toast de logros */
.achievement-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #2ecc71;
    color: #ffffff;
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.15);
    font-weight: 600;
    z-index: 2000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.achievement-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Estilos para autenticación - ACTUALIZADOS */
.auth-item {
    margin-left: auto;
}

.auth-buttons {
    display: flex;
    gap: 10px;
}

.login-btn, .register-btn, .logout-btn, .panel-btn {
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
}

.login-btn {
    background: transparent;
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
}

.login-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
}

.register-btn {
    background: white;
    color: #667eea;
    border: 2px solid white;
}

.register-btn:hover {
    background: transparent;
    color: white;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
}

.user-welcome {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.1);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.user-badge {
    color: gold;
    font-size: 1.1em;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

.logout-btn, .panel-btn {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    font-size: 0.9em;
    padding: 6px 12px;
}

.logout-btn:hover, .panel-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

.user-with-panel {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-with-panel .user-welcome {
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.2) 0%, rgba(230, 126, 34, 0.2) 100%);
    border: 1px solid rgba(243, 156, 18, 0.3);
}

/* Menú de usuario dropdown - ACTUALIZADO */
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    border: 1px solid #e1e8ed;
}

.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-link {
    display: flex;
    align-items: center;
    padding: 0.9rem 1.2rem;
    color: #2c3e50;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    font-weight: 500;
    gap: 0.5rem;
}

.user-link:hover {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    transform: translateX(5px);
}

.user-link:last-child {
    border-bottom: none;
}

.user-link.logout {
    color: #e74c3c;
}

.user-link.logout:hover {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.panel-link {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: #2c3e50
    margin: 0.2rem;
    border-radius: 4px;
    font-weight: 600;
}

.panel-link:hover {
    background: linear-gradient(135deg, #e67e22 0%, #f39c12 100%) !important;
    transform: translateX(5px) !important;
}

.link-icon {
    font-size: 0.9rem;
}

/* Modal de autenticación */
.auth-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.auth-modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.4s ease;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from { 
        transform: translateY(-50px) scale(0.9); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
    }
}

.auth-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-modal-header h2 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
}

.close-modal {
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
    opacity: 0.8;
}

.close-modal:hover {
    opacity: 1;
    color: #ecf0f1;
}

.auth-form {
    padding: 2.5rem;
}

.form-group {
    margin-bottom: 1.8rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.7rem;
    color: #2c3e50;
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.auth-submit-button {
    width: 100%;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    border: none;
    padding: 1.1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
}

.auth-submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.3);
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.auth-submit-button:active {
    transform: translateY(0);
}

/* Contenido principal */
.main-content {
    flex: 1 0 auto;
    padding: 2rem 0;
}

.hero {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.hero-title {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    font-weight: 300;
}

.hero-description {
    font-size: 1.2rem;
    color: #7f8c8d;
    max-width: 600px;
    margin: 0 auto;
}

/* Grid de características */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-card h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.feature-card p {
    color: #7f8c8d;
    line-height: 1.6;
}

/* Overlay para menú móvil */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 900;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-guest-access {
    display: none;
}

/* Responsive - ACTUALIZADO */
@media (max-width: 768px) {
    /* Mostrar botón hamburguesa */
    .mobile-menu-toggle {
        display: flex !important;
        min-height: 38px;
    }
    
    .navbar {
        min-height: 60px;
    }
    
    /* Menú móvil */
    .nav-menu {
        position: fixed !important;
        top: 0 !important;
        left: -100% !important;
        width: 80% !important;
        max-width: 300px;
        height: 100vh !important;
        background: #2c3e50 !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 80px 0 20px 0 !important;
        transition: left 0.3s ease !important;
        overflow-y: auto !important;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3) !important;
        z-index: 1000 !important;
        justify-content: flex-start !important;
    }
    
    .nav-menu.active {
        left: 0 !important;
    }
    
    /* Padding para nav-container en móvil */
    .nav-container {
        padding: 0 20px;
        min-height: 60px;
    }
    
    .nav-item {
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .nav-link {
        padding: 15px 25px;
        width: 100%;
        border-bottom: none;
    }
    
    /* Dropdowns en móvil */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(255,255,255,0.1);
        display: none;
        width: 100%;
        border-radius: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .dropdown.active .dropdown-menu,
    .dropdown.show .dropdown-menu,
    .dropdown-menu.show,
    .dropdown-menu.active {
        display: block;
        max-height: 1000px;
        overflow: visible;
    }
    
    .dropdown-link {
        color: white;
        border-left: 3px solid transparent;
        padding: 12px 35px;
        font-size: 0.95rem;
        cursor: pointer;
        pointer-events: auto;
        position: relative;
        z-index: 1;
    }
    
    .dropdown-link:hover {
        background: rgba(255,255,255,0.15);
        border-left-color: white;
        padding-left: 40px;
    }
    
    /* Submenús en móvil */
    .submenu {
        position: static;
        transform: none;
        box-shadow: none;
        background: rgba(255,255,255,0.05);
        display: none;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .dropdown-submenu.active .submenu,
    .dropdown-submenu.show .submenu,
    .submenu.show,
    .submenu.active {
        display: block;
        max-height: 500px;
    }
    
    .submenu-link {
        color: white;
        padding: 10px 45px;
        border-left: 3px solid transparent;
        font-size: 0.9rem;
    }
    
    .submenu-link:hover {
        background: rgba(255,255,255,0.1);
        border-left-color: #ffeb3b;
        padding-left: 50px;
    }
    
    /* Área de autenticación en móvil */
    .auth-item {
        margin-left: 0;
        width: 100%;
        padding: 15px 25px;
        border-top: 2px solid rgba(255,255,255,0.2);
        margin-top: 10px;
    }
    
    .auth-buttons, .user-menu {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .login-btn, .register-btn, .logout-btn, .panel-btn {
        width: 100%;
        text-align: center;
        padding: 12px;
        font-size: 1rem;
    }
    
    .user-welcome {
        justify-content: center;
        width: 100%;
        padding: 12px 16px;
        font-size: 0.95rem;
    }
    
    .user-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        margin-top: 10px;
        width: 100%;
        background: rgba(255,255,255,0.95);
        border-radius: 8px;
    }
    
    .user-link {
        padding: 12px 15px;
    }
    
    /* Modal de autenticación en móvil */
    .auth-modal-content {
        margin: 5% auto;
        width: 95%;
        max-width: 95%;
    }
    
    .auth-form {
        padding: 1.5rem;
    }
    
    .auth-modal-header {
        padding: 1.5rem;
    }
    
    .auth-modal-header h2 {
        font-size: 1.3rem;
    }
    
    /* Hero section en móvil */
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-description {
        font-size: 1rem;
        padding: 0 15px;
    }
    
    /* Grid de características en móvil */
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Contenedor principal en móvil */
    .container {
        padding: 0 15px;
    }
    
    /* Logo en móvil */
    .logo {
        height: 40px;
    }
    
    .header {
        padding: 0.8rem 0;
    }

    .mobile-guest-access {
        display: block;
        padding: 10px 20px 14px;
        background: #2c3e50;
    }

    .mobile-guest-login-button {
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
        display: block;
        padding: 12px 16px;
        font-size: 1rem;
        font-weight: 600;
    }
}

/* Ajustes para pantallas muy pequeñas */
@media (max-width: 480px) {
    .nav-menu {
        width: 90%;
    }
    
    .mobile-menu-toggle {
        right: 15px;
    }
    
    .auth-modal-content {
        margin: 2% auto;
        width: 98%;
    }
    
    .auth-form {
        padding: 1.2rem;
    }
    
    .auth-modal-header {
        padding: 1.2rem;
    }
    
    .auth-modal-header h2 {
        font-size: 1.2rem;
    }
    
    .form-group input {
        padding: 0.8rem;
        font-size: 0.95rem;
    }
    
    .auth-submit-button {
        padding: 0.9rem;
        font-size: 1rem;
    }
    
    .user-link {
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
    }
    
    .nav-container {
        padding: 12px 15px;
    }
    
    .nav-link {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
    
    .dropdown-link {
        padding: 10px 30px;
        font-size: 0.9rem;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .logo {
        height: 35px;
    }

    .mobile-guest-access {
        padding: 8px 15px 12px;
    }
}

/* ============================================
   FOOTER STYLES
   ============================================ */

.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 0 1.5rem;
    margin-top: auto;
}

.footer .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer .row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.footer .col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
    padding: 0 15px;
}

.footer .col-12 {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 15px;
}

.footer .text-center {
    text-align: center;
}

.footer h5 {
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.2rem;
}

.footer p {
    margin: 0.5rem 0;
    opacity: 0.9;
}

.theme-switcher {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

/* Responsive text alignment helper */
.text-md-end {
    text-align: right;
}
@media (max-width: 768px) {
    .text-md-end {
        text-align: center;
    }
}

.theme-toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    font-size: 0.95rem;
    white-space: nowrap;
}

.theme-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.theme-toggle-btn:active {
    transform: translateY(0);
}

.theme-toggle-btn i {
    font-size: 1.1em;
}

/* Responsive Footer */
@media (max-width: 768px) {
    .footer .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1.5rem;
        text-align: center;
    }
    
    .theme-toggle-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Animaciones para alertas de logros */
@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}
