/**
 * ============================================================================
 * SERVICIOS DE PROYECTO CON IA - ESTILOS CSS
 * ============================================================================
 * 
 * Diseño conversacional híbrido tipo Typeform/Chat
 * - Interfaz limpia y centrada en el chat
 * - Transiciones suaves entre mensajes
 * - Responsive mobile-first
 * 
 * ============================================================================
 */

/* ============================================================================
   VARIABLES CSS
   ============================================================================ */
:root {
    /* Colores primarios */
    --sp-primary: #7C3AED;
    --sp-primary-dark: #6D28D9;
    --sp-primary-light: #A78BFA;
    --sp-primary-bg: #F5F3FF;
    
    /* Colores secundarios */
    --sp-secondary: #06B6D4;
    --sp-secondary-dark: #0891B2;
    
    /* Escala de grises */
    --sp-gray-50: #F8FAFC;
    --sp-gray-100: #F1F5F9;
    --sp-gray-200: #E2E8F0;
    --sp-gray-300: #CBD5E1;
    --sp-gray-400: #94A3B8;
    --sp-gray-500: #64748B;
    --sp-gray-600: #475569;
    --sp-gray-700: #334155;
    --sp-gray-800: #1E293B;
    --sp-gray-900: #0F172A;
    
    /* Estados */
    --sp-success: #10B981;
    --sp-success-bg: #D1FAE5;
    --sp-warning: #F59E0B;
    --sp-warning-bg: #FEF3C7;
    --sp-error: #EF4444;
    --sp-error-bg: #FEE2E2;
    
    /* Layout */
    --sp-header-height: 64px;
    --sp-sidebar-width: 280px;
    --sp-preview-width: 320px;
    --sp-chat-max-width: 720px;
    
    /* Tipografía */
    --sp-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Sombras */
    --sp-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --sp-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --sp-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --sp-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --sp-shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    
    /* Bordes */
    --sp-radius-sm: 6px;
    --sp-radius: 10px;
    --sp-radius-lg: 16px;
    --sp-radius-xl: 24px;
    --sp-radius-full: 9999px;
    
    /* Transiciones */
    --sp-transition: 0.2s ease;
    --sp-transition-slow: 0.3s ease;
}

/* ============================================================================
   RESET Y BASE
   ============================================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.sp-body {
    font-family: var(--sp-font-family);
    background: linear-gradient(135deg, #F8FAFC 0%, #EEF2FF 100%);
    color: var(--sp-gray-800);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================================
   HEADER
   ============================================================================ */
.sp-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--sp-header-height);
    background: linear-gradient(135deg, #ffffff 0%, #F8FAFC 100%);
    border-bottom: 1px solid var(--sp-gray-200);
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.08);
}

.sp-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: 1920px;
    margin: 0 auto;
    padding: 0 24px;
}

.sp-logo img {
    height: 36px;
    width: auto;
}

.sp-header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.sp-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--sp-primary), var(--sp-secondary));
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--sp-radius-full);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
    animation: pulse-badge 2s ease-in-out infinite;
}

.sp-header-badge i {
    font-size: 10px;
}

@keyframes pulse-badge {
    0%, 100% { 
        box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
    }
    50% { 
        box-shadow: 0 2px 16px rgba(124, 58, 237, 0.5);
    }
}

.sp-badge-new {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--sp-primary), var(--sp-secondary));
    color: white;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: var(--sp-radius-full);
    text-transform: uppercase;
}

.sp-header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--sp-gray-800);
    letter-spacing: -0.02em;
}

.sp-header-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--sp-radius);
    color: var(--sp-gray-500);
    text-decoration: none;
    transition: var(--sp-transition);
}

.sp-header-close:hover {
    background: var(--sp-gray-100);
    color: var(--sp-gray-700);
}

/* ============================================================================
   LAYOUT PRINCIPAL
   ============================================================================ */
.sp-main {
    padding-top: var(--sp-header-height);
    min-height: 100vh;
}

.sp-layout {
    display: grid;
    grid-template-columns: var(--sp-sidebar-width) 1fr var(--sp-preview-width);
    min-height: calc(100vh - var(--sp-header-height));
}

/* ============================================================================
   SIDEBAR (Izquierda y Derecha)
   ============================================================================ */
.sp-sidebar {
    background: white;
    border-right: 1px solid var(--sp-gray-200);
    padding: 24px;
    overflow-y: auto;
    height: calc(100vh - var(--sp-header-height));
    position: sticky;
    top: var(--sp-header-height);
}

.sp-sidebar-right {
    border-right: none;
    border-left: 1px solid var(--sp-gray-200);
}

/* Tarjetas del Sidebar */
.sp-progress-card,
.sp-summary-card,
.sp-preview-card,
.sp-refs-card,
.sp-products-card {
    background: var(--sp-gray-50);
    border-radius: var(--sp-radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.sp-progress-header,
.sp-summary-header,
.sp-preview-header,
.sp-refs-header,
.sp-products-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--sp-gray-700);
    margin-bottom: 16px;
    font-size: 14px;
}

.sp-progress-header i,
.sp-summary-header i,
.sp-preview-header i,
.sp-refs-header i,
.sp-products-header i {
    color: var(--sp-primary);
}

/* Productos Sugeridos */
.sp-products-card {
    background: linear-gradient(135deg, var(--sp-primary-bg) 0%, #EEF2FF 100%);
    border: 1px solid rgba(124, 58, 237, 0.1);
}

.sp-products-header {
    color: var(--sp-primary-dark);
}

.sp-products-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sp-product-item {
    background: white;
    border-radius: var(--sp-radius);
    overflow: hidden;
    box-shadow: var(--sp-shadow-sm);
    transition: var(--sp-transition);
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.sp-product-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--sp-shadow-md);
}

.sp-product-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.sp-product-info {
    padding: 12px;
}

.sp-product-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--sp-gray-800);
    margin-bottom: 4px;
    line-height: 1.3;
}

.sp-product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--sp-primary);
    margin-bottom: 6px;
}

.sp-product-link {
    font-size: 12px;
    color: var(--sp-secondary-dark);
    display: flex;
    align-items: center;
    gap: 4px;
}

.sp-product-link i {
    font-size: 10px;
}

/* Barra de Progreso */
.sp-progress-bar {
    height: 8px;
    background: var(--sp-gray-200);
    border-radius: var(--sp-radius-full);
    overflow: hidden;
    margin-bottom: 20px;
}

.sp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sp-primary), var(--sp-secondary));
    border-radius: var(--sp-radius-full);
    width: 0%;
    transition: width 0.5s ease;
}

/* Pasos del Progreso */
.sp-progress-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sp-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--sp-gray-500);
    transition: var(--sp-transition);
}

.sp-step.active {
    color: var(--sp-primary);
    font-weight: 500;
}

.sp-step.completed {
    color: var(--sp-success);
}

.sp-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--sp-gray-300);
    flex-shrink: 0;
    transition: var(--sp-transition);
}

.sp-step.active .sp-step-dot {
    background: var(--sp-primary);
    box-shadow: 0 0 0 4px var(--sp-primary-bg);
}

.sp-step.completed .sp-step-dot {
    background: var(--sp-success);
}

/* Resumen */
.sp-summary-content {
    font-size: 13px;
    color: var(--sp-gray-600);
}

.sp-summary-empty {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--sp-gray-400);
    font-style: italic;
}

.sp-summary-empty i {
    margin-top: 2px;
}

.sp-summary-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--sp-gray-200);
}

.sp-summary-item:last-child {
    border-bottom: none;
}

.sp-summary-item strong {
    color: var(--sp-gray-700);
    min-width: 70px;
}

/* Vista Previa */
.sp-preview-content {
    min-height: 200px;
}

.sp-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-align: center;
    color: var(--sp-gray-400);
}

.sp-preview-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.sp-preview-placeholder p {
    font-size: 13px;
    max-width: 180px;
}

/* Referencias Grid */
.sp-refs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.sp-refs-grid img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--sp-radius);
    cursor: pointer;
    transition: var(--sp-transition);
}

.sp-refs-grid img:hover {
    transform: scale(1.05);
}

/* ============================================================================
   ZONA CENTRAL: CHAT
   ============================================================================ */
.sp-chat-section {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--sp-header-height));
    background: transparent;
}

.sp-chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px 24px;
}

.sp-chat-messages {
    max-width: var(--sp-chat-max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ============================================================================
   MENSAJES
   ============================================================================ */
.sp-message {
    display: flex;
    gap: 16px;
    animation: messageIn 0.3s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mensaje del Asistente */
.sp-message-assistant {
    align-items: flex-start;
}

.sp-message-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--sp-radius-lg);
    background: linear-gradient(135deg, var(--sp-primary), var(--sp-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: var(--sp-shadow);
}

.sp-message-content {
    flex: 1;
    max-width: calc(100% - 60px);
}

.sp-message-bubble {
    background: white;
    padding: 16px 20px;
    border-radius: var(--sp-radius-lg);
    border-top-left-radius: 4px;
    box-shadow: var(--sp-shadow);
    line-height: 1.6;
}

.sp-message-text {
    color: var(--sp-gray-700);
}

.sp-message-text p {
    margin-bottom: 12px;
}

.sp-message-text p:last-child {
    margin-bottom: 0;
}

.sp-message-time {
    font-size: 11px;
    color: var(--sp-gray-400);
    margin-top: 8px;
}

/* Mensaje del Usuario */
.sp-message-user {
    flex-direction: row-reverse;
}

.sp-message-user .sp-message-bubble {
    background: var(--sp-primary);
    color: white;
    border-radius: var(--sp-radius-lg);
    border-top-right-radius: 4px;
}

.sp-message-user .sp-message-text {
    color: white;
}

.sp-message-user .sp-message-time {
    text-align: right;
}

/* Imagen en Mensaje */
.sp-message-image {
    margin-top: 12px;
    border-radius: var(--sp-radius);
    overflow: hidden;
    max-width: 300px;
}

.sp-message-image img {
    display: block;
    width: 100%;
    height: auto;
}

/* Indicador de Escritura */
.sp-typing {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.sp-typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.sp-typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--sp-gray-400);
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

.sp-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.sp-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* ============================================================================
   ÁREA DE INPUT
   ============================================================================ */
.sp-input-area {
    background: white;
    border-top: 1px solid var(--sp-gray-200);
    padding: 20px 24px;
}

.sp-input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    max-width: var(--sp-chat-max-width);
    margin: 0 auto;
}

.sp-input-field {
    flex: 1;
    position: relative;
}

.sp-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--sp-gray-200);
    border-radius: var(--sp-radius-lg);
    font-family: var(--sp-font-family);
    font-size: 15px;
    color: var(--sp-gray-800);
    resize: none;
    transition: var(--sp-transition);
    max-height: 150px;
}

.sp-input:focus {
    outline: none;
    border-color: var(--sp-primary);
    box-shadow: 0 0 0 4px var(--sp-primary-bg);
}

.sp-input::placeholder {
    color: var(--sp-gray-400);
}

/* Botones de Input */
.sp-btn-attach,
.sp-btn-send {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: var(--sp-radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--sp-transition);
    flex-shrink: 0;
}

.sp-btn-attach {
    background: var(--sp-gray-100);
    color: var(--sp-gray-500);
}

.sp-btn-attach:hover {
    background: var(--sp-gray-200);
    color: var(--sp-gray-700);
}

.sp-btn-send {
    background: var(--sp-primary);
    color: white;
}

.sp-btn-send:hover:not(:disabled) {
    background: var(--sp-primary-dark);
}

.sp-btn-send:disabled {
    background: var(--sp-gray-200);
    color: var(--sp-gray-400);
    cursor: not-allowed;
}

.sp-input-help {
    max-width: var(--sp-chat-max-width);
    margin: 12px auto 0;
    font-size: 12px;
    color: var(--sp-gray-400);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sp-input-help i {
    color: var(--sp-warning);
}

/* ============================================================================
   OPCIONES (Botones/Tarjetas)
   ============================================================================ */
.sp-options-wrapper {
    max-width: var(--sp-chat-max-width);
    margin: 0 auto 20px;
}

.sp-options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Botones de Opción */
.sp-option-btn {
    padding: 12px 20px;
    background: white;
    border: 2px solid var(--sp-gray-200);
    border-radius: var(--sp-radius-full);
    font-family: var(--sp-font-family);
    font-size: 14px;
    font-weight: 500;
    color: var(--sp-gray-700);
    cursor: pointer;
    transition: var(--sp-transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sp-option-btn:hover {
    border-color: var(--sp-primary);
    color: var(--sp-primary);
    background: var(--sp-primary-bg);
}

.sp-option-btn.selected {
    border-color: var(--sp-primary);
    background: var(--sp-primary);
    color: white;
}

.sp-option-btn i {
    font-size: 16px;
}

/* Tarjetas de Opción con Imagen */
.sp-option-card {
    flex: 0 0 calc(50% - 5px);
    background: white;
    border: 2px solid var(--sp-gray-200);
    border-radius: var(--sp-radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: var(--sp-transition);
    text-align: center;
}

.sp-option-card:hover {
    border-color: var(--sp-primary);
    transform: translateY(-2px);
    box-shadow: var(--sp-shadow-md);
}

.sp-option-card.selected {
    border-color: var(--sp-primary);
    background: var(--sp-primary-bg);
}

.sp-option-card img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--sp-radius);
    margin-bottom: 12px;
}

.sp-option-card-title {
    font-weight: 600;
    color: var(--sp-gray-800);
    font-size: 14px;
}

/* ============================================================================
   GALERÍA DE IMÁGENES DE REFERENCIA
   ============================================================================ */
.sp-gallery-wrapper {
    max-width: var(--sp-chat-max-width);
    margin: 0 auto 20px;
}

.sp-gallery-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--sp-gray-600);
    margin-bottom: 12px;
}

.sp-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.sp-gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--sp-radius-lg);
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--sp-transition);
}

.sp-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sp-gallery-item:hover {
    transform: scale(1.03);
    box-shadow: var(--sp-shadow-lg);
}

.sp-gallery-item.selected {
    border-color: var(--sp-primary);
}

.sp-gallery-item.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: var(--sp-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* ============================================================================
   MODALES
   ============================================================================ */
.sp-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.sp-modal.active {
    display: flex;
}

.sp-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.sp-modal-dialog {
    position: relative;
    background: white;
    border-radius: var(--sp-radius-xl);
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--sp-shadow-xl);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.sp-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--sp-gray-100);
    border-radius: var(--sp-radius);
    cursor: pointer;
    color: var(--sp-gray-500);
    font-size: 16px;
    transition: var(--sp-transition);
    z-index: 1;
}

.sp-modal-close:hover {
    background: var(--sp-gray-200);
    color: var(--sp-gray-700);
}

.sp-modal-header {
    padding: 32px 32px 0;
    text-align: center;
}

.sp-modal-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    background: var(--sp-primary-bg);
    color: var(--sp-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.sp-modal-icon-success {
    background: var(--sp-primary-bg);
    color: var(--sp-primary);
}

.sp-modal-icon-check {
    background: var(--sp-success-bg);
    color: var(--sp-success);
}

.sp-modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--sp-gray-800);
    margin-bottom: 8px;
}

.sp-modal-header p {
    color: var(--sp-gray-500);
    font-size: 15px;
}

.sp-modal-body {
    padding: 24px 32px;
}

.sp-modal-footer {
    padding: 0 32px 32px;
    display: flex;
    gap: 12px;
}

.sp-modal-footer-center {
    justify-content: center;
}

/* ============================================================================
   FORMULARIO DE CONTACTO
   ============================================================================ */
.sp-contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sp-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sp-form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--sp-gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sp-form-group label i {
    color: var(--sp-primary);
    font-size: 14px;
}

.sp-optional {
    font-weight: 400;
    color: var(--sp-gray-400);
    font-size: 12px;
}

.sp-form-group input[type="text"],
.sp-form-group input[type="email"],
.sp-form-group input[type="tel"] {
    padding: 14px 16px;
    border: 2px solid var(--sp-gray-200);
    border-radius: var(--sp-radius);
    font-family: var(--sp-font-family);
    font-size: 15px;
    color: var(--sp-gray-800);
    transition: var(--sp-transition);
}

.sp-form-group input:focus {
    outline: none;
    border-color: var(--sp-primary);
    box-shadow: 0 0 0 4px var(--sp-primary-bg);
}

.sp-form-group input::placeholder {
    color: var(--sp-gray-400);
}

/* Checkbox */
.sp-form-checkbox {
    flex-direction: row;
    align-items: flex-start;
}

.sp-form-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--sp-primary);
    cursor: pointer;
}

.sp-form-checkbox label {
    font-size: 13px;
    font-weight: 400;
    color: var(--sp-gray-600);
    cursor: pointer;
}

.sp-form-checkbox label a {
    color: var(--sp-primary);
    text-decoration: none;
}

.sp-form-checkbox label a:hover {
    text-decoration: underline;
}

/* ============================================================================
   ZONA DE UPLOAD
   ============================================================================ */
.sp-upload-zone {
    border: 2px dashed var(--sp-gray-300);
    border-radius: var(--sp-radius-lg);
    padding: 32px;
    text-align: center;
    transition: var(--sp-transition);
    cursor: pointer;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sp-upload-zone:hover,
.sp-upload-zone.dragover {
    border-color: var(--sp-primary);
    background: var(--sp-primary-bg);
}

.sp-upload-placeholder i {
    font-size: 48px;
    color: var(--sp-gray-400);
    margin-bottom: 16px;
}

.sp-upload-placeholder p {
    font-size: 16px;
    font-weight: 500;
    color: var(--sp-gray-700);
    margin-bottom: 4px;
}

.sp-upload-placeholder span {
    font-size: 14px;
    color: var(--sp-gray-500);
}

.sp-upload-placeholder small {
    display: block;
    margin-top: 12px;
    font-size: 12px;
    color: var(--sp-gray-400);
}

.sp-upload-preview {
    position: relative;
    display: inline-block;
}

.sp-upload-preview img {
    max-width: 100%;
    max-height: 250px;
    border-radius: var(--sp-radius);
}

.sp-upload-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 8px 12px;
    background: var(--sp-error);
    color: white;
    border: none;
    border-radius: var(--sp-radius);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--sp-transition);
}

.sp-upload-remove:hover {
    background: #DC2626;
}

/* ============================================================================
   BOTONES
   ============================================================================ */
.sp-btn {
    padding: 14px 24px;
    border: none;
    border-radius: var(--sp-radius);
    font-family: var(--sp-font-family);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--sp-transition);
    text-decoration: none;
}

.sp-btn-primary {
    background: var(--sp-primary);
    color: white;
}

.sp-btn-primary:hover {
    background: var(--sp-primary-dark);
}

.sp-btn-primary:disabled {
    background: var(--sp-gray-300);
    cursor: not-allowed;
}

.sp-btn-secondary {
    background: var(--sp-gray-100);
    color: var(--sp-gray-700);
}

.sp-btn-secondary:hover {
    background: var(--sp-gray-200);
}

.sp-btn-block {
    width: 100%;
}

.sp-btn-lg {
    padding: 16px 28px;
    font-size: 16px;
}

/* ============================================================================
   ÉXITO
   ============================================================================ */
.sp-success-info {
    background: var(--sp-gray-50);
    border-radius: var(--sp-radius-lg);
    padding: 20px;
}

.sp-success-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--sp-gray-200);
    font-size: 14px;
    color: var(--sp-gray-700);
}

.sp-success-item:last-child {
    border-bottom: none;
}

.sp-success-item i {
    width: 32px;
    height: 32px;
    background: var(--sp-primary-bg);
    color: var(--sp-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

/* ============================================================================
   LOADING
   ============================================================================ */
.sp-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: none; /* Hidden by default - JS will show it when needed */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.sp-loading.active {
    display: flex;
}

.sp-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--sp-gray-200);
    border-top-color: var(--sp-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.sp-loading p {
    font-size: 16px;
    color: var(--sp-gray-600);
    font-weight: 500;
}

/* ============================================================================
   RESPONSIVE: TABLET
   ============================================================================ */
@media (max-width: 1200px) {
    .sp-layout {
        grid-template-columns: 1fr;
    }
    
    .sp-sidebar {
        display: none;
    }
    
    .sp-chat-section {
        height: calc(100vh - var(--sp-header-height));
    }
}

/* ============================================================================
   RESPONSIVE: MOBILE
   ============================================================================ */
@media (max-width: 768px) {
    :root {
        --sp-header-height: 60px;
    }
    
    .sp-header-inner {
        padding: 0 12px;
    }
    
    .sp-header-center {
        position: static;
        transform: none;
        flex: 1;
        justify-content: center;
    }
    
    .sp-header-badge {
        font-size: 9px;
        padding: 3px 8px;
    }
    
    .sp-header-title {
        font-size: 14px;
    }
    
    .sp-logo img {
        height: 28px;
    }
    
    .sp-header-close {
        width: 36px;
        height: 36px;
    }
    
    .sp-chat-container {
        padding: 20px 16px;
    }
    
    .sp-message {
        gap: 12px;
    }
    
    .sp-message-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .sp-message-bubble {
        padding: 12px 16px;
        max-width: 90%;
    }
    
    .sp-input-area {
        padding: 12px;
    }
    
    .sp-input-row {
        gap: 8px;
    }
    
    .sp-btn-attach,
    .sp-btn-send {
        width: 44px;
        height: 44px;
    }
    
    .sp-input {
        padding: 12px 14px;
        font-size: 16px; /* Prevenir zoom en iOS */
    }
    
    .sp-input-help {
        display: none;
    }
    
    .sp-options-container {
        gap: 8px;
        flex-direction: column;
    }
    
    .sp-option-btn {
        padding: 12px 16px;
        font-size: 14px;
        width: 100%;
        justify-content: center;
    }
    
    .sp-option-card {
        flex: 0 0 calc(50% - 4px);
        padding: 12px;
    }
    
    .sp-option-card img {
        height: 80px;
    }
    
    .sp-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .sp-modal-dialog {
        margin: 16px;
        border-radius: var(--sp-radius-lg);
    }
    
    .sp-modal-header {
        padding: 24px 20px 0;
    }
    
    .sp-modal-body {
        padding: 20px;
    }
    
    .sp-modal-footer {
        padding: 0 20px 24px;
        flex-direction: column;
    }
    
    .sp-modal-icon {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }
    
    .sp-modal-header h2 {
        font-size: 20px;
    }
}

/* ============================================================================
   ANIMACIONES DE ENTRADA
   ============================================================================ */
.sp-fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.sp-slide-up {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   SELECCIÓN MÚLTIPLE DE ZONAS
   ============================================================================ */
.sp-zones-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.sp-zone-btn {
    position: relative;
    transition: all 0.2s ease;
}

.sp-zone-btn.selected {
    background: var(--sp-primary);
    color: white;
    border-color: var(--sp-primary);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.sp-zone-btn.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: var(--sp-success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid white;
}

.sp-zones-help {
    font-size: 13px;
    color: var(--sp-text-light);
    margin: 12px 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sp-zones-help i {
    color: var(--sp-primary);
}

.sp-continue-btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--sp-primary) 0%, var(--sp-primary-light) 100%);
    color: white;
    border: none;
    border-radius: var(--sp-radius-lg);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.sp-continue-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.sp-continue-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================================
   BOTONES CTA DE CONFIRMACIÓN
   ============================================================================ */
.sp-cta-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.sp-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 28px;
    border-radius: var(--sp-radius-lg);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.sp-cta-primary {
    background: linear-gradient(135deg, var(--sp-primary) 0%, #6D28D9 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}

.sp-cta-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
}

.sp-cta-primary i {
    font-size: 18px;
}

.sp-cta-secondary {
    background: white;
    color: var(--sp-text);
    border: 2px solid var(--sp-border);
}

.sp-cta-secondary:hover {
    border-color: var(--sp-primary);
    color: var(--sp-primary);
    background: var(--sp-primary-bg);
}

/* Responsive para CTAs */
@media (min-width: 500px) {
    .sp-cta-container {
        flex-direction: row;
    }
    
    .sp-cta-btn {
        flex: 1;
    }
}

/* ============================================================================
   MEJORAS ADICIONALES
   ============================================================================ */

/* Botones de opción más espaciados */
.sp-options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

/* Asegurar que el input no tenga zoom en iOS */
.sp-input-field {
    font-size: 16px !important;
}

/* ============================================================================
   FORMATO DE RESUMEN DE PROYECTO
   ============================================================================ */
.sp-summary-title {
    font-size: 18px;
    color: var(--sp-primary);
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-radius: var(--sp-radius-lg);
    margin-bottom: 16px;
    border-left: 4px solid var(--sp-primary);
}

.sp-summary-line {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--sp-border);
}

.sp-summary-line:last-of-type {
    border-bottom: none;
}

.sp-summary-line .sp-label {
    font-weight: 600;
    color: var(--sp-text);
    min-width: 140px;
}

.sp-summary-line .sp-value {
    color: var(--sp-text-light);
    flex: 1;
}

.sp-summary-service {
    margin-top: 16px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-radius: var(--sp-radius-lg);
    border-left: 4px solid var(--sp-success);
    color: #065f46;
}

/* ============================================================================
   GALERÍA DE FACHADAS
   ============================================================================ */
.sp-fachada-item {
    position: relative;
    overflow: hidden;
}

.sp-fachada-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
    color: white;
    font-size: 13px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sp-fachada-item:hover .sp-fachada-overlay {
    opacity: 1;
}

.sp-gallery-actions {
    grid-column: 1 / -1;
    text-align: center;
    padding: 16px 0;
}

/* ============================================================================
   SOLICITUD DE LOGOTIPO
   ============================================================================ */
.sp-logo-request {
    text-align: center;
    padding: 24px;
}

.sp-logo-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--sp-primary-bg) 0%, rgba(124, 58, 237, 0.1) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sp-logo-icon i {
    font-size: 32px;
    color: var(--sp-primary);
}

.sp-logo-request h4 {
    font-size: 18px;
    color: var(--sp-text);
    margin-bottom: 8px;
}

.sp-logo-request p {
    color: var(--sp-text-light);
    font-size: 14px;
    margin-bottom: 20px;
}

.sp-logo-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 300px;
    margin: 0 auto;
}

@media (min-width: 400px) {
    .sp-logo-buttons {
        flex-direction: row;
        max-width: 100%;
    }
    
    .sp-logo-buttons .sp-cta-btn {
        flex: 1;
    }
}

/* ============================================================================
   SELECCIÓN MÚLTIPLE MEJORADA
   ============================================================================ */
.sp-multi-select-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 16px;
}

.sp-multi-btn {
    position: relative;
    transition: all 0.2s ease;
}

.sp-multi-btn.selected {
    background: var(--sp-primary);
    color: white;
    border-color: var(--sp-primary);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.sp-multi-btn.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: var(--sp-success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid white;
}

.sp-multi-help {
    font-size: 13px;
    color: var(--sp-text-light);
    margin: 12px 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sp-multi-help i {
    color: var(--sp-primary);
}

/* ============================================================================
   SUBIR FACHADA PERSONAL
   ============================================================================ */

.sp-upload-fachada-prompt {
    background: var(--sp-gradient-soft);
    border: 2px dashed var(--sp-primary-light);
    border-radius: var(--sp-radius-lg);
    padding: 20px;
    margin: 16px 0;
    animation: fadeInUp 0.3s ease;
}

.sp-upload-fachada-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.sp-upload-fachada-icon {
    width: 50px;
    height: 50px;
    background: var(--sp-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.sp-upload-fachada-text p {
    margin: 0;
    color: var(--sp-text);
}

.sp-upload-fachada-text p strong {
    font-size: 15px;
}

.sp-upload-fachada-desc {
    font-size: 13px !important;
    color: var(--sp-text-muted) !important;
}

.sp-upload-fachada-btns {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.sp-btn-upload-fachada {
    padding: 12px 24px;
    background: linear-gradient(135deg, #7C3AED, #5B21B6);
    border: none;
    border-radius: var(--sp-radius);
    color: #FFFFFF !important;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--sp-transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
    text-decoration: none;
}

.sp-btn-upload-fachada i {
    color: #FFFFFF !important;
}

.sp-btn-upload-fachada:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
    background: linear-gradient(135deg, #8B5CF6, #6D28D9);
}

.sp-btn-skip-fachada {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius);
    color: var(--sp-text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: var(--sp-transition);
}

.sp-btn-skip-fachada:hover {
    border-color: var(--sp-text-muted);
    background: var(--sp-bg);
}

/* ============================================================================
   VISTA PREVIA DINÁMICA
   ============================================================================ */

.sp-preview-mockup {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sp-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--sp-text-light);
    min-height: 180px;
}

.sp-preview-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.sp-preview-placeholder p {
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

/* Preview con fachada subida */
.sp-preview-fachada-container {
    position: relative;
    border-radius: var(--sp-radius);
    overflow: hidden;
}

.sp-preview-fachada-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.sp-preview-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
}

.sp-preview-name {
    font-size: 18px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sp-preview-badge {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    margin-top: 4px;
    font-style: italic;
}

/* Preview genérico sin fachada */
.sp-preview-generic {
    background: var(--sp-gradient-soft);
    border-radius: var(--sp-radius);
    padding: 24px;
    text-align: center;
}

.sp-preview-icon-large {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: var(--sp-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.sp-preview-name-display {
    font-size: 18px;
    font-weight: 700;
    color: var(--sp-text);
    margin-bottom: 4px;
}

.sp-preview-type {
    font-size: 13px;
    color: var(--sp-text-muted);
    text-transform: capitalize;
}

/* Secciones de preview (zonas, productos) */
.sp-preview-section {
    background: var(--sp-bg);
    padding: 12px;
    border-radius: var(--sp-radius-sm);
}

.sp-preview-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--sp-text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.sp-preview-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sp-preview-tag {
    display: inline-block;
    padding: 4px 10px;
    background: var(--sp-white);
    border: 1px solid var(--sp-border);
    color: var(--sp-text);
    border-radius: 20px;
    font-size: 11px;
}

.sp-preview-tags-products .sp-preview-tag-product {
    display: inline-block;
    padding: 4px 10px;
    background: var(--sp-primary-bg);
    border: 1px solid var(--sp-primary-light);
    color: var(--sp-primary);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

/* ============================================================================
   RESPONSIVE PARA NUEVAS FUNCIONALIDADES
   ============================================================================ */

@media (max-width: 768px) {
    .sp-upload-fachada-btns {
        flex-direction: column;
        width: 100%;
    }
    
    .sp-btn-upload-fachada,
    .sp-btn-skip-fachada {
        width: 100%;
        justify-content: center;
    }
    
    .sp-preview-fachada-img {
        height: 150px;
    }
    
    .sp-preview-name {
        font-size: 16px;
    }
}

/* ============================================================================
   RENDER IA - Estilos para generación de renders con IA
   ============================================================================ */

.sp-preview-render-section {
    margin-top: 16px;
    padding: 12px;
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    border-radius: 10px;
    text-align: center;
}

.sp-btn-generate-render {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #7C3AED, #5B21B6);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.sp-btn-generate-render:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
}

.sp-btn-generate-render:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.sp-btn-generate-render i {
    font-size: 16px;
}

.sp-render-hint {
    margin: 8px 0 0;
    font-size: 11px;
    color: #6b7280;
}

/* Resultado del render */
.sp-render-result {
    margin-bottom: 16px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.sp-render-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #7C3AED, #5B21B6);
}

.sp-render-badge {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 12px;
    color: white;
}

.sp-render-title {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.sp-render-image-container {
    position: relative;
    width: 100%;
    background: #f8fafc;
}

.sp-render-image {
    width: 100%;
    height: auto;
    display: block;
}

.sp-render-disclaimer {
    padding: 8px 16px;
    margin: 0;
    font-size: 11px;
    color: #6b7280;
    background: #f9fafb;
    text-align: center;
}

.sp-btn-regenerate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    background: #f3f4f6;
    border: none;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sp-btn-regenerate:hover {
    background: #e5e7eb;
    color: #374151;
}

@media (max-width: 768px) {
    .sp-btn-generate-render {
        width: 100%;
        justify-content: center;
    }
}
