/* =====================================================
   ESTILOS COMPARTIDOS - MANUALES IGLESIA
   ===================================================== */

/* Reset y Base */
html, body { 
    touch-action: manipulation; 
}
body { 
    background-color: #f3f4f6; 
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Logo Filters */
.logo-blue {
    filter: invert(45%) sepia(98%) saturate(1000%) hue-rotate(196deg) brightness(95%) contrast(90%);
}
.logo-slate {
    filter: invert(30%) sepia(10%) saturate(500%) hue-rotate(180deg) brightness(90%) contrast(95%);
}
.logo-orange {
    filter: invert(55%) sepia(90%) saturate(1500%) hue-rotate(360deg) brightness(100%) contrast(95%);
}

/* Scrollbar personalizada */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* Scroll Area Responsive */
.scroll-area {
    height: auto;
    overflow-y: visible;
}

@media (min-width: 1024px) {
    .scroll-area {
        height: 0;
        flex-grow: 1;
        overflow-y: auto;
        min-height: 0;
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .client-actions {
        opacity: 1 !important;
    }
    
    .catalog-qty-btn {
        width: 38px !important;
        height: 38px !important;
    }
    .catalog-qty-display {
        width: 32px !important;
        font-size: 15px !important;
    }
    .catalog-cart-btn {
        width: 42px !important;
        height: 42px !important;
    }
    .catalog-cart-btn i {
        font-size: 16px !important;
    }
}

/* =====================================================
   BOTÓN FLOTANTE DE CARRITO
   ===================================================== */
.floating-cart-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 50;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 50%, #1d4ed8 100%);
    color: white;
    border: 3px solid rgba(255,255,255,0.3);
    box-shadow: 
        0 8px 32px rgba(59, 130, 246, 0.5),
        0 4px 16px rgba(30, 64, 175, 0.3),
        inset 0 2px 4px rgba(255,255,255,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: cart-pulse 2s ease-in-out infinite;
}

@keyframes cart-pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 
            0 8px 32px rgba(59, 130, 246, 0.5),
            0 4px 16px rgba(30, 64, 175, 0.3),
            inset 0 2px 4px rgba(255,255,255,0.2);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 
            0 12px 40px rgba(59, 130, 246, 0.6),
            0 6px 24px rgba(30, 64, 175, 0.4),
            inset 0 2px 4px rgba(255,255,255,0.3);
    }
}

.floating-cart-btn:hover {
    transform: scale(1.15);
    animation: none;
    box-shadow: 
        0 12px 48px rgba(59, 130, 246, 0.7),
        0 8px 32px rgba(30, 64, 175, 0.5),
        inset 0 2px 6px rgba(255,255,255,0.3);
}

.floating-cart-btn:active {
    transform: scale(1.05);
}

.floating-cart-btn i {
    font-size: 26px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.floating-cart-btn .badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 13px;
    font-weight: bold;
    min-width: 26px;
    height: 26px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 
        0 4px 12px rgba(239, 68, 68, 0.5),
        0 2px 6px rgba(0,0,0,0.2);
    border: 2px solid white;
    animation: badge-bounce 0.3s ease-out;
}

@keyframes badge-bounce {
    0% { transform: scale(0.5); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.floating-cart-btn::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(30, 64, 175, 0.3));
    z-index: -1;
    animation: glow-ring 2s ease-in-out infinite;
}

@keyframes glow-ring {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

/* =====================================================
   SELECTION BUTTONS (Método de entrega/pago)
   ===================================================== */
.selection-group {
    display: flex;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 2px;
    gap: 0;
}

.selection-btn {
    flex: 1;
    padding: 7px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    background: transparent;
    color: #64748b;
}

.selection-btn:hover:not(.active) {
    background: #e2e8f0;
    color: #475569;
}

.selection-btn.envio-btn.active {
    background: #fef3c7;
    color: #92400e;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.selection-btn.sucursal-btn.active {
    background: #ede9fe;
    color: #5b21b6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.selection-btn.transferencia-btn.active {
    background: #dbeafe;
    color: #1e40af;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.selection-btn.efectivo-btn.active {
    background: #dcfce7;
    color: #166534;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* =====================================================
   MODAL STYLES
   ===================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 400px;
    width: 100%;
    padding: 2rem;
    animation: modal-appear 0.3s ease-out;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* =====================================================
   LOADING SPINNER
   ===================================================== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* =====================================================
   PANEL CONTAINER (Full Screen)
   ===================================================== */
.panel-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 1.25rem;
    border-bottom: 1px solid;
    flex-shrink: 0;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Variantes de color para paneles */
.panel-blue {
    border-top: 4px solid #3b82f6;
}
.panel-blue .panel-header {
    background: linear-gradient(to right, #eff6ff, white);
    border-color: #dbeafe;
}

.panel-slate {
    border-top: 4px solid #475569;
}
.panel-slate .panel-header {
    background: linear-gradient(to right, #f8fafc, white);
    border-color: #e2e8f0;
}

.panel-orange {
    border-top: 4px solid #f97316;
}
.panel-orange .panel-header {
    background: linear-gradient(to right, #fff7ed, white);
    border-color: #fed7aa;
}

/* =====================================================
   LOADING SCREEN - MINIMALISTA Y PROFESIONAL
   ===================================================== */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    transition: opacity 0.4s ease-out, visibility 0.4s ease-out;
}

.loading-screen.hiding {
    opacity: 0;
    visibility: hidden;
}

.loading-screen.hidden {
    display: none;
}

/* Variantes de color */
.loading-screen.loading-blue {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}
.loading-screen.loading-slate {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}
.loading-screen.loading-orange {
    background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
}

/* Logo container con pulso */
.loading-logo-container {
    position: relative;
    margin-bottom: 2rem;
}

.loading-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    animation: logo-pulse 2s ease-in-out infinite;
}

@keyframes logo-pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.05);
        opacity: 0.85;
    }
}

/* Spinner moderno */
.loading-spinner-wrapper {
    position: relative;
    width: 48px;
    height: 48px;
    margin-bottom: 1.5rem;
}

.loading-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    animation: ring-spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loading-ring.ring-1 {
    border-top-color: #cbd5e1;
    animation-delay: -0.45s;
}
.loading-ring.ring-2 {
    border-right-color: #94a3b8;
    animation-delay: -0.3s;
}
.loading-ring.ring-3 {
    border-bottom-color: #64748b;
    animation-delay: -0.15s;
}

/* Variantes de color para los anillos */
.loading-blue .loading-ring.ring-1 { border-top-color: #93c5fd; }
.loading-blue .loading-ring.ring-2 { border-right-color: #60a5fa; }
.loading-blue .loading-ring.ring-3 { border-bottom-color: #3b82f6; }

.loading-slate .loading-ring.ring-1 { border-top-color: #cbd5e1; }
.loading-slate .loading-ring.ring-2 { border-right-color: #94a3b8; }
.loading-slate .loading-ring.ring-3 { border-bottom-color: #64748b; }

.loading-orange .loading-ring.ring-1 { border-top-color: #fdba74; }
.loading-orange .loading-ring.ring-2 { border-right-color: #fb923c; }
.loading-orange .loading-ring.ring-3 { border-bottom-color: #f97316; }

@keyframes ring-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Punto central pulsante */
.loading-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: #64748b;
    animation: dot-pulse 1.2s ease-in-out infinite;
}

.loading-blue .loading-dot { background: #3b82f6; }
.loading-slate .loading-dot { background: #475569; }
.loading-orange .loading-dot { background: #f97316; }

@keyframes dot-pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.5);
        opacity: 0.6;
    }
}

/* Texto de carga */
.loading-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.loading-blue .loading-text { color: #3b82f6; }
.loading-slate .loading-text { color: #475569; }
.loading-orange .loading-text { color: #ea580c; }

/* Animación de puntos */
.loading-dots {
    display: flex;
    gap: 3px;
}

.loading-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    animation: dots-bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dots-bounce {
    0%, 80%, 100% { 
        transform: translateY(0);
        opacity: 0.4;
    }
    40% { 
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Barra de progreso opcional */
.loading-progress {
    width: 120px;
    height: 3px;
    background: rgba(0,0,0,0.1);
    border-radius: 3px;
    margin-top: 1rem;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    border-radius: 3px;
    background: #64748b;
    animation: progress-shimmer 1.5s ease-in-out infinite;
    width: 40%;
}

.loading-blue .loading-progress-bar { background: #3b82f6; }
.loading-slate .loading-progress-bar { background: #475569; }
.loading-orange .loading-progress-bar { background: #f97316; }

@keyframes progress-shimmer {
    0% { 
        transform: translateX(-100%);
    }
    100% { 
        transform: translateX(350%);
    }
}
