/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Navbar */
#navbar {
    position: sticky;
    top: 0;
    z-index: 50;
}

/* Scroll offset para que el navbar no tape el contenido */
section {
    scroll-margin-top: 70px;
}

/* Pricing toggle buttons */
#pricing-toggle button {
    transition: background 0.3s ease, color 0.3s ease;
    min-width: 100px;
}

#pricing-toggle button.text-gray-600:hover {
    background: linear-gradient(135deg, #0ea5e9, #0284c7) !important;
    color: white !important;
}

#pricing-toggle button.bg-gradient-to-r:hover {
    opacity: 0.9;
}

/* Pricing toggle sticky en móvil */
@media (max-width: 768px) {
    #pricing-toggle {
        position: sticky;
        top: 70px;
        z-index: 40;
        margin-bottom: 1rem;
    }
}

/* Efecto de página doblada 3D para cambio de plan (solo móvil) */
.mobile-plan-toggle {
    display: none;
}

@media (max-width: 768px) {
    /* Asegurar que las tarjetas permitan ver la esquina */
    .card-hover {
        position: relative;
    }
    
    /* Papel de atrás (base del doblez) */
    .mobile-plan-toggle {
        display: block;
        position: absolute;
        top: 0;
        right: 0;
        width: 50%;
        height: 20%;
        background: linear-gradient(225deg, #dc2626 0%, #b91c1c 100%);
        cursor: pointer;
        z-index: 20;
        clip-path: polygon(40% 0, 100% 0, 100% 60%);
        transition: all 0.3s ease;
        box-shadow: 
            inset -3px -3px 8px rgba(0, 0, 0, 0.3),
            inset 3px 3px 8px rgba(255, 255, 255, 0.1);
        animation: pulse-corner 2s ease-in-out infinite;
    }
    
    /* Doblez del papel - efecto de curvatura */
    .mobile-plan-toggle::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 100%;
        height: 100%;
        background: 
            radial-gradient(ellipse at 0% 0%, rgba(255, 255, 255, 0.95) 0%, transparent 50%),
            linear-gradient(135deg,
                rgba(255, 255, 255, 0.98) 0%,
                rgba(254, 226, 226, 0.95) 18%,
                rgba(252, 165, 165, 0.9) 30%,
                rgba(248, 113, 113, 0.85) 45%,
                rgba(239, 68, 68, 0.9) 65%,
                rgba(220, 38, 38, 0.95) 100%);
        clip-path: polygon(0 0, 100% 0, 100% 100%);
        box-shadow: 
            -10px 10px 25px rgba(0, 0, 0, 0.5),
            -5px 5px 15px rgba(0, 0, 0, 0.4),
            -2px 2px 8px rgba(0, 0, 0, 0.3);
        filter: brightness(1.15);
    }
    
    /* Texto en la esquina */
    .mobile-plan-toggle::before {
        content: attr(data-text);
        position: absolute;
        top: 18%;
        right: 5%;
        transform: rotate(45deg);
        color: white;
        font-size: 10px;
        font-weight: 900;
        white-space: nowrap;
        text-transform: uppercase;
        letter-spacing: 0.8px;
        text-shadow: 
            0 2px 4px rgba(0, 0, 0, 1),
            0 3px 10px rgba(0, 0, 0, 0.9),
            0 0 15px rgba(220, 38, 38, 0.8),
            1px 1px 0 rgba(0, 0, 0, 0.8);
        z-index: 100;
        pointer-events: none;
        animation: text-glow 2s ease-in-out infinite;
    }
    
    @keyframes text-glow {
        0%, 100% {
            text-shadow: 
                0 2px 4px rgba(0, 0, 0, 1),
                0 3px 10px rgba(0, 0, 0, 0.9),
                0 0 15px rgba(220, 38, 38, 0.8);
        }
        50% {
            text-shadow: 
                0 2px 4px rgba(0, 0, 0, 1),
                0 3px 10px rgba(0, 0, 0, 0.9),
                0 0 25px rgba(255, 255, 255, 1),
                0 0 35px rgba(220, 38, 38, 1);
        }
    }
    
    @keyframes pulse-corner {
        0%, 100% {
            box-shadow: 
                inset -3px -3px 8px rgba(0, 0, 0, 0.3),
                inset 3px 3px 8px rgba(255, 255, 255, 0.1);
            transform: scale(1);
        }
        50% {
            box-shadow: 
                inset -3px -3px 8px rgba(0, 0, 0, 0.3),
                inset 3px 3px 8px rgba(255, 255, 255, 0.2),
                0 0 20px rgba(220, 38, 38, 0.8),
                0 0 30px rgba(220, 38, 38, 0.5);
            transform: scale(1.05);
        }
    }
    
    .mobile-plan-toggle:hover {
        background: linear-gradient(225deg, #b91c1c 0%, #991b1b 100%);
        animation: none;
    }
    
    .mobile-plan-toggle:hover::after {
        filter: brightness(1.2);
    }
    
    .mobile-plan-toggle:active {
        transform: scale(0.97);
    }
}

/* Animations - Solo Desktop */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animaciones rápidas para elementos */
@media (min-width: 769px) {
    .animate-fade {
        animation: fadeIn 0.4s ease-out;
    }
    
    .animate-scale {
        animation: fadeInScale 0.5s ease-out;
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.animate-slide-up {
    animation: slideUp 0.5s ease-out;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Card Hover Effect */
.card-hover {
    transition: all 0.3s ease;
    position: relative;
}

.card-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Pricing Card Popular */
.pricing-popular {
    transform: scale(1.05);
    border: 2px solid #0ea5e9;
}

/* FAQ Accordion */
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-answer.active {
    max-height: 500px;
}

/* Smooth Scroll Offset for Fixed Navbar */
section {
    scroll-margin-top: 80px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #0284c7, #0ea5e9);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #0369a1, #0284c7);
}

/* Tooltips */
.tooltip {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    white-space: normal;
    line-height: 1.4;
}

.tooltip-arrow {
    position: absolute;
    bottom: -4px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #1f2937;
}

/* Tooltip hover effect */
.group:hover .tooltip {
    display: block !important;
}

/* Table Container */
.comparison-table-container {
    position: relative;
    overflow-x: auto;
    overflow-y: visible;
    padding-top: 100px;
    margin-top: -100px;
    padding-bottom: 50px;
}

.comparison-table thead th {
    background: linear-gradient(to right, #0284c7, #0ea5e9) !important;
}

/* Floating CTA Button */
.floating-cta {
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.floating-cta.visible {
    opacity: 1;
    visibility: visible;
}

.floating-cta button {
    background: linear-gradient(to right, #0284c7, #0ea5e9);
    color: white;
    padding: 16px 32px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 10px 25px rgba(2, 132, 199, 0.4);
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.floating-cta button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(2, 132, 199, 0.5);
}

/* Mobile CTA Float Button */
.mobile-cta-float {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: white;
    border: none;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
    z-index: 99;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: pulse-cta 2s infinite;
}

.mobile-cta-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.6);
}

@media (max-width: 768px) {
    .mobile-cta-float {
        display: flex;
    }
    
    /* Ocultar el floating-cta en móvil */
    .floating-cta {
        display: none;
    }
}

@keyframes pulse-cta {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(14, 165, 233, 0.7);
    }
}

/* WhatsApp Floating Button */
.whatsapp-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #25D366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    z-index: 100;
    transition: all 0.3s ease;
    animation: pulse-whatsapp 2s infinite;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

@keyframes pulse-whatsapp {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.7);
    }
}

/* Contact Form Drawer */
.contact-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 500px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.contact-drawer.open {
    right: 0;
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.drawer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.drawer-close:hover {
    background: #e5e7eb;
    transform: rotate(90deg);
}

@media (max-width: 640px) {
    .contact-drawer {
        max-width: 100%;
    }
}

/* Animaciones dinámicas */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Clases de animación */
.animate-on-scroll {
    opacity: 0;
    transition: all 0.6s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

.fade-in-left {
    animation: fadeInLeft 0.8s ease-out forwards;
}

.fade-in-right {
    animation: fadeInRight 0.8s ease-out forwards;
}

.scale-in {
    animation: scaleIn 0.6s ease-out forwards;
}

/* Efectos hover mejorados */
.card-hover {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Gradientes animados */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-animated {
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
}

/* Responsive optimizations */
@media (max-width: 768px) {
    /* Desactivar animaciones complejas en móvil para mejor performance */
    .animate-on-scroll {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    
    /* Desactivar todas las animaciones de entrada */
    .fadeInUp,
    .fadeInLeft,
    .fadeInRight,
    .scaleIn {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Tooltip en tabla */
.table-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: 4px;
}

.table-tooltip .tooltip-text {
    visibility: hidden;
    width: 220px;
    background-color: #1f2937;
    color: #fff;
    text-align: left;
    border-radius: 8px;
    padding: 10px 14px;
    position: absolute;
    z-index: 9999;
    bottom: 150%;
    left: 0;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    white-space: normal;
}

.table-tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 20px;
    border-width: 6px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

.table-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Responsive tooltips */
@media (max-width: 768px) {
    .table-tooltip .tooltip-text {
        width: 180px;
        font-size: 11px;
        padding: 8px 12px;
        bottom: 130%;
        left: -10px;
    }
    
    .table-tooltip .tooltip-text::after {
        left: 15px;
    }
}
