/**
 * =====================================================================
 *  ESTILOS PERSONALIZADOS - Parce.ro Soporte Técnico Remoto
 * =====================================================================
 * 
 * Propósito: Estilos complementarios a Tailwind CSS.
 * Incluye: glassmorphism, animaciones personalizadas, scrollbar, debug.
 * 
 * DISEÑO CORPORATIVO BLANCO.
 * 
 * @author    Parce.ro Team
 * @version   1.0.0
 * @since     2026-06-17
 * =====================================================================
 */

/* =========================================================================
 *  RESET / BASE
 * ========================================================================= */

/* Scrollbar personalizado (navegadores webkit) - versión clara */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* =========================================================================
 *  GLASSMORPHISM - Tarjetas y elementos con efecto vidrio claro
 * ========================================================================= */

.glass {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.glass:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.05);
}

.glass-sm {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
}

.glass-strong {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* =========================================================================
 *  ANIMACIONES
 * ========================================================================= */

/* Animación de entrada: fade-in + slide-up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.animate-fade-in-up-delay-1 {
    animation: fadeInUp 0.8s ease-out 0.1s forwards;
    opacity: 0;
}

.animate-fade-in-up-delay-2 {
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
    opacity: 0;
}

.animate-fade-in-up-delay-3 {
    animation: fadeInUp 0.8s ease-out 0.3s forwards;
    opacity: 0;
}

.animate-fade-in-up-delay-4 {
    animation: fadeInUp 0.8s ease-out 0.4s forwards;
    opacity: 0;
}

.animate-fade-in-up-delay-5 {
    animation: fadeInUp 0.8s ease-out 0.5s forwards;
    opacity: 0;
}

/* Animación flotante para el botón de WhatsApp */
@keyframes whatsappFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

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

/* Animación de pulso para el glow de acento */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(37, 99, 235, 0.08);
    }
    50% {
        box-shadow: 0 0 30px rgba(37, 99, 235, 0.15);
    }
}

.animate-pulse-glow {
    animation: pulseGlow 3s ease-in-out infinite;
}

/* Animación de aparición para tarjetas en grid (scroll) */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* =========================================================================
 *  TARJETAS DE SERVICIO - Hover Effect
 * ========================================================================= */

.service-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.03) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.service-card:hover::before {
    opacity: 1;
}

.service-card:hover {
    transform: translateY(-4px);
    border-color: rgba(37, 99, 235, 0.2);
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.service-card .service-icon {
    transition: all 0.4s ease;
}

.service-card:hover .service-icon {
    transform: scale(1.15) rotate(-5deg);
    color: #2563eb;
}

/* =========================================================================
 *  FORMULARIOS - Estilos personalizados
 * ========================================================================= */

.form-input-custom {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: #1f2937;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    width: 100%;
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.form-input-custom:focus {
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input-custom::placeholder {
    color: rgba(0, 0, 0, 0.3);
}

.form-input-custom.error {
    border-color: #ef4444;
    background: #fef2f2;
}

.form-input-custom.success {
    border-color: #00c853;
    background: #f0fdf4;
}

textarea.form-input-custom {
    min-height: 120px;
    resize: vertical;
}

/* =========================================================================
 *  SELECT PERSONALIZADO
 * ========================================================================= */

select.form-input-custom {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}

/* =========================================================================
 *  BOTONES
 * ========================================================================= */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-nequi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    background: linear-gradient(135deg, #00c853, #00a844);
    color: white;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-nequi:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 200, 83, 0.25);
}

/* =========================================================================
 *  BARRA DE DEBUG
 * ========================================================================= */

#debug-bar {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.6;
    background: #ffffff;
    color: #6b7280;
}

#debug-bar .debug-label {
    color: #2563eb;
    font-weight: 600;
}

#debug-bar .debug-value {
    color: #6b7280;
}

#debug-bar .debug-error {
    color: #ef4444;
    font-weight: 600;
}

#debug-bar .debug-success {
    color: #00c853;
    font-weight: 600;
}

/* =========================================================================
 *  MODAL / OVERLAY
 * ========================================================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9997;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    padding: 2rem;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* =========================================================================
 *  TOAST / NOTIFICACIONES
 * ========================================================================= */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    animation: slideInRight 0.3s ease-out forwards;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.toast-success {
    background: #f0fdf4;
    border-color: rgba(0, 200, 83, 0.3);
    color: #059669;
}

.toast-error {
    background: #fef2f2;
    border-color: rgba(239, 68, 68, 0.3);
    color: #dc2626;
}

.toast-info {
    background: #eff6ff;
    border-color: rgba(37, 99, 235, 0.3);
    color: #2563eb;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =========================================================================
 *  SECCIÓN HERO - Fondo animado (versión clara)
 * ========================================================================= */

.hero-gradient {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.hero-gradient::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.04) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    animation: floatGlow 8s ease-in-out infinite;
}

.hero-gradient::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 200, 83, 0.03) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    animation: floatGlow 10s ease-in-out infinite reverse;
}

@keyframes floatGlow {
    0%, 100% {
        transform: translate(0, 0);
    }
    33% {
        transform: translate(30px, -30px);
    }
    66% {
        transform: translate(-20px, 20px);
    }
}

/* =========================================================================
 *  ERRORES DE FORMULARIO
 * ========================================================================= */

.field-error {
    display: block;
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* =========================================================================
 *  LINE-CLAMP (para truncar texto)
 * ========================================================================= */

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =========================================================================
 *  RESPONSIVE - Ajustes adicionales
 * ========================================================================= */

/* Para pantallas muy pequeñas */
@media (max-width: 360px) {
    .service-card {
        border-radius: 12px;
    }
    
    .modal-content {
        padding: 1.25rem;
    }
}

/* Preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-whatsapp-float {
        animation: none;
    }
}

/* =========================================================================
 *  SECCIONES DE PROBLEMA
 * ========================================================================= */

.problema-section {
    scroll-margin-top: 6rem;
    transition: all 0.3s ease;
}

.problema-section:hover {
    border-color: rgba(37, 99, 235, 0.15);
}

.problema-indice {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.75rem;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.2);
    color: #2563eb;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Botón flotante de descarga */
#anydesk-float-btn {
    position: fixed;
    bottom: 6rem;
    right: 1.5rem;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: #ffffff;
    border: 2px solid #EB001B;
    color: #EB001B;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 50px;
    box-shadow: 0 4px 16px rgba(235, 0, 27, 0.15);
    transition: all 0.3s ease;
    text-decoration: none;
    animation: anydeskFloat 3s ease-in-out infinite;
}

#anydesk-float-btn:hover {
    background: #EB001B;
    color: white;
    transform: scale(1.05) !important;
    box-shadow: 0 8px 24px rgba(235, 0, 27, 0.25);
    animation: none;
}

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

@media (max-width: 640px) {
    #anydesk-float-btn {
        bottom: 5rem;
        right: 1rem;
        padding: 0.6rem 1rem;
        font-size: 0.75rem;
    }
    
    .problema-section {
        scroll-margin-top: 5rem;
    }
}

/* =========================================================================
 *  CHAT WIDGET
 * ========================================================================= */

#chat-widget {
    font-family: 'Inter', sans-serif;
}

#chat-messages {
    scrollbar-width: thin;
}

#chat-messages::-webkit-scrollbar {
    width: 4px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

/* Bounce animation for typing indicator */
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.animate-bounce {
    animation: bounce 1.4s infinite ease-in-out both;
}

/* =========================================================================
 *  BINARY FLOATING PARTICLES (0s and 1s flotando)
 *  Aparecen aleatoriamente en toda la página en gris oscuro.
 * ========================================================================= */
@keyframes matrixRain {
    0% { transform: translateY(-100%); opacity: 0; }
    10% { opacity: 0.25; }
    80% { opacity: 0.25; }
    100% { transform: translateY(100vh); opacity: 0; }
}
.binary-particle {
    position: fixed;
    font-family: 'Courier New', monospace;
    font-weight: 800;
    pointer-events: none;
    z-index: 1;
    animation: matrixRain linear infinite;
    user-select: none;
}

/* =========================================================================
 *  INDUSTRIAL CATERPILLAR STYLES
 *  Botones metalizados con tornillos, hover a charcoal, texto gradiente.
 * ========================================================================= */

/* Botón industrial base (blanco -> charcoal en hover) */
.btn-industrial-base {
    position: relative;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(0,0,0,0.06);
    font-size: 0.875rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #ffffff;
    color: #374151;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
    cursor: pointer;
    text-decoration: none;
}
.btn-industrial-base:hover {
    background: #1c1c1c;
    color: #fbc02c;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}
.btn-industrial-base i {
    color: #6b7280;
    transition: color 0.3s ease;
}
.btn-industrial-base:hover i {
    color: #ffffff;
}

/* Botón CAT style (charcoal + yellow border) */
.btn-cat-style {
    position: relative;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    border: 2px solid #fbc02c;
    font-size: 0.875rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #1c1c1c;
    color: #fbc02c;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    cursor: pointer;
    text-decoration: none;
}
.btn-cat-style:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}
.btn-cat-style i {
    color: #fbc02c;
    transition: color 0.3s ease;
}
.btn-cat-style:hover i {
    color: #ffffff;
}

/* Texto metalizado amarillo */
.text-metal-yellow {
    background-image: linear-gradient(90deg, #fbc02c 25%, #fffec0 50%, #fbc02c 75%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: brightness(1.1);
}
.group:hover .text-metal-yellow {
    animation: metalGlint 1.5s ease-out infinite;
}

/* Texto metalizado blanco */
.text-metal-white {
    background-image: linear-gradient(90deg, #f3f4f6 25%, #ffffff 50%, #f3f4f6 75%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: brightness(1.1);
}

/* Tornillos en esquinas */
.metal-bolt {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #a1a1aa;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.3);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.group:hover .metal-bolt {
    opacity: 1;
}
.metal-bolt-tl { top: 4px; left: 4px; }
.metal-bolt-tr { top: 4px; right: 4px; }
.metal-bolt-bl { bottom: 4px; left: 4px; }
.metal-bolt-br { bottom: 4px; right: 4px; }

/* Animación metal glint */
@keyframes metalGlint {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}
