﻿/* Variables CSS mejoradas */
:root {
    --primary-color: #0d6efd;
    --primary-gradient: linear-gradient(135deg, #0d6efd, #6610f2);
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    
    --text-dark: #2c3e50;
    --text-muted: #6c757d;
    --text-light: #ffffff;
    
    --bg-overlay: rgba(0, 0, 0, 0.05);
    --bg-card: rgba(255, 255, 255, 0.80);
    --bg-hover: rgba(255, 255, 255, 0.1);
    
    --shadow-glow: 0 0 30px rgba(13, 110, 253, 0.3);
    --shadow-light: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-heavy: 0 15px 50px rgba(0, 0, 0, 0.15);
    
    --border-radius: 20px;
    --border-radius-small: 12px;
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-medium: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    
    --gradient-rainbow: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
    --gradient-tech: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Reset y configuración base */
html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    font-weight: 400;
}

.modulos-body {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    position: relative;
}

/* Overlay suave */
.modulos-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    backdrop-filter: blur(1px);
    z-index: 1;
}

/* Partículas flotantes */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-gradient);
    border-radius: 50%;
    opacity: 0.6;
    animation: float 6s infinite linear;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 30%; animation-delay: 1s; }
.particle:nth-child(3) { left: 50%; animation-delay: 2s; }
.particle:nth-child(4) { left: 70%; animation-delay: 3s; }
.particle:nth-child(5) { left: 90%; animation-delay: 4s; }

@keyframes float {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { transform: translateY(-100px) rotate(360deg); opacity: 0; }
}

/* Container principal */
.modulos-container {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

/* Card principal espectacular */
.modulos-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    border: 1px solid rgba(255, 255, 255, 0.4);
    width: 100%;
    max-width: 1000px;
    max-height: 95vh;
    overflow: auto;
    position: relative;
    animation: cardEntrance var(--transition-slow);
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Loader futurista */
.modulos-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-card);
    z-index: 10;
    border-radius: var(--border-radius);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-medium);
}

.modulos-loader.active {
    opacity: 1;
    pointer-events: all;
}

.ai-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 30px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-ring:nth-child(2) {
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
    border-top: 2px solid var(--info-color);
    animation-delay: 0.2s;
}

.spinner-ring:nth-child(3) {
    width: 40px;
    height: 40px;
    top: 20px;
    left: 20px;
    border-top: 2px solid var(--warning-color);
    animation-delay: 0.4s;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-text {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Contenido principal */
.modulos-content {
    padding: 40px;
}

/* Header espectacular */
.modulos-header {
    margin-bottom: 40px;
    position: relative;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.title-logo-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
}

.logo-container {
    flex-shrink: 0;
}

.empresa-logo {
    width: 200px;
    height: auto;
    max-height: 120px;
    object-fit: contain;
    display: block;
}

.title-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.header-description {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--gradient-tech);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 15px;
    box-shadow: var(--shadow-light);
    animation: badgeFloat 2s ease-in-out infinite;
}

@keyframes badgeFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.main-title {
    color: var(--text-dark);
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 20px 0;
    line-height: 1.1;
}

.title-part-1 {
    display: block;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-part-2 {
    display: block;
    color: var(--text-dark);
}

.ai-feature-highlight {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.1), rgba(102, 16, 242, 0.1));
    padding: 20px;
    border-radius: var(--border-radius-small);
    border: 1px solid rgba(13, 110, 253, 0.2);
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
}

.ai-feature-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.feature-icon {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
    box-shadow: var(--shadow-light);
}

.feature-text {
    flex: 1;
}

.feature-main {
    font-size: 1.2rem;
    color: var(--text-dark);
    margin: 0 0 5px 0;
    font-weight: 600;
}

.feature-sub {
    font-size: 1rem;
    color: var(--text-muted);
    margin: 0;
}

.benefits-row {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.benefit-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    box-shadow: var(--shadow-light);
    border: 1px solid rgba(13, 110, 253, 0.1);
}

.benefit-mini i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Llamada a la acción */
.cta-section {
    text-align: center;
    margin-bottom: 5px;
}

.cta-title {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 15px 0;
    background: var(--gradient-rainbow);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowShift 4s ease-in-out infinite;
}

@keyframes rainbowShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}


@keyframes lineShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Grid de módulos espectacular */
.modulos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

/* Cards de módulos increíbles */
.modulo-card {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    height: 200px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid transparent;
    box-shadow: var(--shadow-light);
    transition: all var(--transition-medium);
    cursor: pointer;
}

.modulo-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity var(--transition-medium);
    z-index: 1;
}

.modulo-card:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: var(--shadow-heavy);
    border-color: var(--primary-color);
}

.modulo-card:hover::before {
    opacity: 0.05;
}

.card-glow {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--primary-gradient);
    border-radius: var(--border-radius);
    opacity: 0;
    transition: opacity var(--transition-medium);
    z-index: -1;
}

.modulo-card:hover .card-glow {
    opacity: 0.7;
    animation: glowPulse 2s infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.4; }
}

.modulo-link {
    display: block;
    height: 100%;
    text-decoration: none;
    color: inherit;
    position: relative;
    z-index: 2;
}

.modulo-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.1;
    z-index: 1;
}

.bg-pattern {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

/*.bg-pattern-bano { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.bg-pattern-cocina { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.bg-pattern-pintura { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.bg-pattern-carpinteria { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.bg-pattern-electricidad { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.bg-pattern-fontaneria { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); }
.bg-pattern-general { background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%); }*/

.modulo-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 25px;
    position: relative;
    z-index: 2;
}

.modulo-icon-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.modulo-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    transition: all var(--transition-fast);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.modulo-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
    transition: all var(--transition-fast);
}

.modulo-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.ai-preview-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-top: auto;
    justify-content: center;
}

/* Colores específicos por módulo */
.icon-bano { color: #667eea; }
.icon-cocina { color: #f5576c; }
.icon-pintura {
    color: #ff6f00;
}
.icon-carpinteria { color: #38f9d7; }
.icon-electricidad { color: #fee140; }
.icon-fontaneria { color: #a8edea; }
.icon-general { color: #d299c2; }

/* Overlay de hover espectacular */
.modulo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    opacity: 0;
    transition: all var(--transition-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.modulo-card:hover .modulo-overlay {
    opacity: 0.95;
}

.overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: white;
    text-align: center;
    transform: translateY(20px);
    transition: transform var(--transition-medium);
}

.modulo-card:hover .overlay-content {
    transform: translateY(0);
}

.pulse-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    animation: iconPulse 2s infinite;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
}

.overlay-text {
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.overlay-arrow {
    font-size: 1.4rem;
    animation: arrowBounce 1s infinite;
}

@keyframes arrowBounce {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
}

/* Efectos de hover en íconos y texto */
.modulo-card:hover .modulo-icon {
    transform: scale(1.3) rotate(5deg);
    filter: brightness(1.3) drop-shadow(0 0 20px currentColor);
}

.modulo-card:hover .modulo-title,
.modulo-card:hover .modulo-description,
.modulo-card:hover .ai-preview-badge {
    color: var(--text-light);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Estado cuando no hay módulos */
.no-modulos {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    color: var(--text-muted);
}

.no-modulos-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 2.5rem;
    animation: robotThink 2s infinite;
}

@keyframes robotThink {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

/* Footer tecnológico */
.modulos-footer {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(13, 110, 253, 0.1);
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.02), rgba(102, 16, 242, 0.02));
    margin: -35px -35px 0;
    padding: 25px 40px 0;
}

.tech-showcase {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tech-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.9rem;
}

.tech-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    box-shadow: var(--shadow-light);
    transition: all var(--transition-fast);
}

.tech-icon:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
}

.tech-divider {
    width: 2px;
    height: 40px;
    background: linear-gradient(to bottom, transparent, var(--primary-color), transparent);
    opacity: 0.5;
}

.powered-by {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 0;
    font-style: italic;
    background: var(--gradient-tech);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Toast notifications mejoradas */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background: var(--bg-card);
    border-radius: var(--border-radius-small);
    box-shadow: var(--shadow-heavy);
    padding: 18px 24px;
    margin-bottom: 12px;
    border-left: 4px solid var(--primary-color);
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateX(100%);
    transition: all var(--transition-medium);
    min-width: 300px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success { border-left-color: var(--success-color); }
.toast.error { border-left-color: var(--danger-color); }
.toast.warning { border-left-color: var(--warning-color); }
.toast.info { border-left-color: var(--info-color); }

/* Eliminar efectos de focus */
a:focus, a:active, button:focus, button:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Scrollbar personalizada */
.modulos-card::-webkit-scrollbar {
    width: 8px;
}

.modulos-card::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.modulos-card::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 4px;
}

.modulos-card::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-tech);
}

/* Animaciones adicionales */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Estados de interacción */
.modulo-card.selecting {
    transform: scale(0.98);
    opacity: 0.8;
}

.modulo-card.touch-active {
    transform: scale(0.97);
}

/* RESPONSIVE DESIGN */
@media (max-width: 992px) {
    .modulos-header {
        gap: 30px;
    }
    
    .main-title {
        font-size: 2.2rem;
    }
    
    .empresa-logo {
        width: 150px;
        max-height: 80px;
    }
}

@media (max-width: 768px) {
    .modulos-container {
        padding: 15px;
    }
    
    .modulos-card {
        max-height: 95vh;
    }
    
    .modulos-content {
        padding: 25px;
    }
    
    .modulos-header {
        flex-direction: column;
        text-align: center;
        margin-bottom: 30px;
        gap: 25px;
    }
    
    .main-title {
        font-size: 1.8rem;
    }
    
    .ai-feature-highlight {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .feature-main {
        font-size: 1.1rem;
    }
    
    .feature-sub {
        font-size: 0.95rem;
    }
    
    .benefits-row {
        gap: 15px;
        justify-content: center;
    }
    
    .benefit-mini {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .cta-title {
        font-size: 1.5rem;
    }
    
    .modulos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .modulo-card {
        height: 180px;
    }
    
    .modulo-icon {
        font-size: 2.5rem;
    }
    
    .modulo-title {
        font-size: 1.1rem;
    }
    
    .modulo-description {
        font-size: 0.8rem;
    }
    
    .tech-showcase {
        gap: 20px;
    }
    
    .tech-divider {
        display: none;
    }
}

@media (max-width: 576px) {
    .modulos-content {
        padding: 20px;
    }
    
    .logo-glow {
        padding: 10px;
    }
    
    .empresa-logo {
        max-height: 80px;
        max-width: 120px;
    }
    
    .main-title {
        font-size: 1.6rem;
    }
    
    .ai-badge {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .feature-main {
        font-size: 1rem;
    }
    
    .feature-sub {
        font-size: 0.9rem;
    }
    
    .cta-title {
        font-size: 1.3rem;
    }
    
    .modulos-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .modulo-card {
        height: 160px;
    }
    
    .modulo-content {
        padding: 20px;
    }
    
    .modulo-icon {
        font-size: 2.2rem;
    }
    
    .overlay-text {
        font-size: 1rem;
    }
    
    .pulse-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .tech-showcase {
        flex-direction: column;
        gap: 15px;
    }
    
    .tech-item {
        font-size: 0.8rem;
    }
    
    .tech-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .powered-by {
        font-size: 0.9rem;
    }
    
    .toast {
        min-width: 250px;
        margin-right: 10px;
    }
}

/* Modo oscuro automático */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-card: rgba(20, 25, 31, 0.98);
        --text-dark: #f8f9fa;
        --text-muted: #adb5bd;
        --bg-overlay: rgba(0, 0, 0, 0.2);
    }
    
    .modulo-card {
        background: rgba(30, 35, 41, 0.9);
    }
    
    .ai-feature-highlight {
        background: linear-gradient(135deg, rgba(13, 110, 253, 0.15), rgba(102, 16, 242, 0.15));
    }
    
    .benefit-mini {
        background: rgba(40, 45, 51, 0.8);
    }
}

/* Animaciones de performance optimizadas */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .particle {
        display: none;
    }
}