:root {
    --color-primary: #7e22ce;
    --color-secondary: #9333ea;
    --color-light: #a78bfa;
    --color-accent: #ec4899;
    --color-bg-dark: #0f172a;
    --color-card-bg: rgba(30, 41, 59, 0.7);
    --color-input-bg: rgba(15, 23, 42, 0.6);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --color-success: #10b981;
    --color-error: #ef4444;
}

/* 1. FONDO Y AMBIENTE GENERAL */
body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: linear-gradient(135deg, #020617, #1e1b4b, #312e81);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Efecto de ruido/partículas sutil */
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: -1;
}

/* Contenedor Principal Glassmorphism */
.glass-container {
    background: rgba(30, 41, 59, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 1.5rem;
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(30px);
}

/* 2. ANIMACIONES */
@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}
.shake-anim { animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both; }

@keyframes gradientText {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Stagger para secciones */
.form-section-anim {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }

/* 3. TIPOGRAFÍA */
h1.main-title {
    background: linear-gradient(to right, #c084fc, #e879f9, #c084fc);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientText 6s linear infinite;
    letter-spacing: -0.03em;
    filter: drop-shadow(0 0 15px rgba(192, 132, 252, 0.3));
}

h2.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-light);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 0.75rem;
}

/* 4. INPUTS Y SELECTS */
.form-input, .form-select {
    background-color: var(--color-input-bg);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--text-primary);
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    transition: all 0.2s ease;
    width: 100%;
    font-size: 0.95rem;
}

.form-input:hover, .form-select:hover {
    border-color: rgba(167, 139, 250, 0.4);
    background-color: rgba(30, 41, 59, 0.8);
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--color-light);
    background-color: rgba(30, 41, 59, 0.9);
    box-shadow: 0 0 0 4px rgba(126, 34, 206, 0.15);
    transform: translateY(-1px);
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    appearance: none;
    padding-right: 2.5rem;
}

label {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: block;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.form-group:focus-within label {
    color: var(--color-light);
}

/* Validación Visual */
.border-red-500 {
    border-color: var(--color-error) !important;
    box-shadow: 0 0 0 1px var(--color-error) !important;
}
.validation-error-message {
    color: #fca5a5;
    font-size: 0.8rem;
    margin-top: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(239, 68, 68, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    width: fit-content;
}
.validation-error-message::before {
    content: '•';
    font-weight: bold;
}

/* 5. SELECTOR DE IDIOMA — VERTICAL */
.lang-switcher {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 56px;
}

.lang-switcher a {
    padding: 0.45rem 0.8rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.lang-switcher a:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.lang-switcher a.active {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 2px 6px rgba(126, 34, 206, 0.3);
}

/* 6. TARJETAS DE PRODUCTO */
.product-item {
    background: var(--color-card-bg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    padding: 2rem;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 2rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); 
}
.product-item:hover {
    border-color: rgba(139, 92, 246, 0.3);
    background: rgba(30, 41, 59, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

.product-title-text {
    font-size: 1.25rem;
    color: var(--text-primary);
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 1.5rem;
}

.remove-item {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
}
.remove-item:hover {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Contador de Cantidad - DISEÑO COMPACTO (CORREGIDO) */
.qty-selector {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    background: var(--color-input-bg);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0.75rem;
    overflow: hidden;
    height: 50px;
    width: 100%;
}
.qty-selector input {
    flex-grow: 1;
    width: auto !important;
    text-align: center;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    padding: 0;
    margin: 0;
    appearance: textfield;
    -moz-appearance: textfield;
}
.qty-selector input::-webkit-outer-spin-button,
.qty-selector input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.qty-selector-btn {
    width: 50px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.03);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 2;
}
.qty-selector-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-light);
}
.qty-selector-btn:active {
    background: rgba(255, 255, 255, 0.15);
}
.qty-btn-minus { border-right: 1px solid rgba(255, 255, 255, 0.05); }
.qty-btn-plus { border-left: 1px solid rgba(255, 255, 255, 0.05); }

/* 7. FILEPOND */
.filepond--panel-root {
    background-color: var(--color-input-bg) !important;
    border: 2px dashed rgba(148, 163, 184, 0.3) !important;
    border-radius: 0.75rem !important;
}
.filepond--drop-label {
    color: var(--text-secondary) !important;
    font-family: 'Inter', sans-serif;
}
.filepond--label-action {
    text-decoration-color: var(--color-light) !important;
    color: var(--color-light) !important;
    font-weight: 600;
}
.filepond--item-panel {
    background-color: var(--color-primary) !important;
}

.upload-container-styled {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 0.75rem;
    padding: 1.25rem;
    border: 1px solid rgba(255,255,255,0.05);
}

.or-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.or-divider::before, .or-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.or-divider::before { margin-right: 1em; }
.or-divider::after { margin-left: 1em; }

/* 8. BOTONES */
#submitButton {
    background: linear-gradient(135deg, #7c3aed, #d946ef);
    background-size: 200% 200%;
    border: none;
    animation: gradientText 4s ease infinite;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
    transition: all 0.3s ease;
    width: 100%;
    font-size: 1.1rem;
    letter-spacing: 0.025em;
    position: relative;
    overflow: hidden;
}
#submitButton::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}
#submitButton:hover:not(:disabled) {
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.5);
    transform: translateY(-2px);
}
#submitButton:hover::after { opacity: 1; }
#submitButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.8);
    animation: none;
}

#addProductBtn {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(167, 139, 250, 0.3);
    color: var(--color-light);
    transition: all 0.3s ease;
    width: 100%;
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
}
#addProductBtn:hover {
    background: rgba(167, 139, 250, 0.1);
    border-color: var(--color-light);
    color: white;
    transform: translateY(-1px);
}

/* 9. BARRA DE PROGRESO */
.progress-bar-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #a855f7, #ec4899);
    width: 0%;
    border-radius: 9999px;
    transition: width 0.4s ease;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

/* 10. MENSAJES DE ESTADO */
.status-message {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    margin-top: 2rem;
    display: none;
    text-align: center;
    animation: fadeInUp 0.4s ease-out;
    backdrop-filter: blur(10px);
    font-weight: 500;
}
.status-error {
    background: rgba(127, 29, 29, 0.4);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #fca5a5;
}
.status-success {
    background: rgba(6, 78, 59, 0.4);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: #6ee7b7;
}

/* 12. PROMPT DE RESTAURACIÓN */
#restore-prompt {
    background: linear-gradient(to right, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
    border-left: 4px solid var(--color-light);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    animation: fadeInUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#restore-yes {
    background-color: var(--color-primary);
    transition: transform 0.2s;
}
#restore-no {
    background-color: rgba(255,255,255,0.1);
    transition: background-color 0.2s;
}
#restore-yes:hover { transform: scale(1.05); background-color: var(--color-secondary); }
#restore-no:hover { background-color: rgba(255,255,255,0.2); }

.hidden { display: none !important; }

/* Responsive */
@media (min-width: 768px) {
    .container { padding: 3.5rem; }
    .glass-container { padding: 3rem 4rem; }
}