/* Dropzone */
.dropzone {
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
    box-sizing: border-box;
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--emerald-500);
    background: rgba(16,185,129,0.05);
}
.dropzone-filename {
    color: var(--emerald-400);
    font-weight: 600;
    font-size: 13px;
    word-break: break-all;
    overflow-wrap: anywhere;
    max-width: 100%;
    line-height: 1.4;
    padding: 4px 8px;
}

/* Spinner Moderno de Carga y Vista de Progreso en Vivo */
.upload-processing-view {
    padding: 10px 0;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.quantum-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(16, 185, 129, 0.15);
    border-top: 3px solid var(--emerald-400);
    border-right: 3px solid #059669;
    animation: quantumSpin 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.35);
    position: relative;
    flex-shrink: 0;
}
.quantum-spinner::after {
    content: '';
    position: absolute;
    top: 5px; left: 5px; right: 5px; bottom: 5px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-bottom: 2px solid var(--emerald-300);
    animation: quantumSpinReverse 0.6s linear infinite;
}
@keyframes quantumSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes quantumSpinReverse {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}

/* Barra de Progreso Global con Gradiente Animado */
.upload-progress-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.upload-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}
.upload-progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}
.upload-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #059669, var(--emerald-400), #10b8c7);
    background-size: 200% 100%;
    border-radius: 999px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: gradientShimmer 2s linear infinite;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
}
@keyframes gradientShimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Micro-Pills de Etapas del Pipeline */
.pipeline-stages-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.pipeline-stage-pill {
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 10.5px;
    text-align: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}
.pipeline-stage-pill.active {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--emerald-400);
    color: var(--emerald-300);
    font-weight: 700;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}
.pipeline-stage-pill.done {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--emerald-400);
}

/* Feed / Historial de Archivos en Lote */
.upload-batch-feed {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}
.upload-batch-feed::-webkit-scrollbar {
    width: 4px;
}
.upload-batch-feed::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}
.batch-feed-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    transition: all 0.2s ease;
}
.batch-feed-item.active {
    border-color: var(--emerald-500);
    background: rgba(16, 185, 129, 0.06);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.12);
}
.batch-feed-item.completed {
    border-color: rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.03);
}
.batch-feed-file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.batch-feed-filename {
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 240px;
}
.batch-feed-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.batch-feed-badge.pending {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
}
.batch-feed-badge.processing {
    background: rgba(16, 185, 129, 0.18);
    color: var(--emerald-300);
    border: 1px solid var(--emerald-500);
    animation: pulseGlow 1.2s infinite;
}
.batch-feed-badge.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--emerald-400);
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.batch-feed-badge.error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}
@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.75; transform: scale(0.98); }
}

/* Widget Flotante Minimizado (Dock Flotante Glassmorphic Estilo Aceternity / Linear) */
.upload-floating-dock {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 6500;
    background: rgba(13, 20, 36, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(16, 185, 129, 0.2);
    border-radius: 16px;
    padding: 12px 16px;
    display: none;
    align-items: center;
    gap: 14px;
    min-width: 320px;
    max-width: 400px;
    animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    user-select: none;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.upload-floating-dock:hover {
    transform: translateY(-2px);
    border-color: var(--emerald-400);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.8), 0 0 40px rgba(16, 185, 129, 0.3);
}
.dock-mini-spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2.5px solid rgba(16, 185, 129, 0.2);
    border-top: 2.5px solid var(--emerald-400);
    animation: quantumSpin 0.8s linear infinite;
    flex-shrink: 0;
}
.dock-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.dock-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}
.dock-title {
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.dock-percent {
    font-weight: 700;
    color: var(--emerald-400);
    font-family: var(--font-mono);
    font-size: 11.5px;
}
.dock-track {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}
.dock-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #059669, var(--emerald-400));
    border-radius: 999px;
    transition: width 0.3s ease;
}
.dock-filename {
    font-size: 10.5px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}
.dock-btn-maximize {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--emerald-300);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.dock-btn-maximize:hover {
    background: var(--emerald-500);
    color: #000;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.4);
}

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

/* Botón de Minimizar en la Cabecera del Modal */
.btn-modal-icon-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
}
.btn-modal-icon-action:hover {
    background: rgba(16, 185, 129, 0.15);
    color: var(--emerald-300);
    border-color: var(--emerald-500);
}

/* Tarjeta de Éxito */
.upload-success-view {
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeInScale 0.3s ease-out;
}
.success-header-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
}
.success-icon-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--emerald-500);
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 16px var(--emerald-glow);
    flex-shrink: 0;
}
.success-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.stat-label {
    font-size: 10.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.stat-val {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

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

/* ==========================================================================
   ESTILOS ESPECÍFICOS MODO CLARO RETRO-TECH (DROPZONE & DOCK FLOTANTE)
   ========================================================================== */
[data-theme="light"] .upload-floating-dock {
    background: #FFFFFF !important;
    border: 1.5px solid #FFB39F !important;
    box-shadow: 0 16px 40px rgba(22, 34, 56, 0.12), 0 0 24px rgba(255, 107, 74, 0.15) !important;
}
[data-theme="light"] .upload-floating-dock:hover {
    border-color: #FF6B4A !important;
    box-shadow: 0 20px 48px rgba(22, 34, 56, 0.18), 0 0 32px rgba(255, 107, 74, 0.25) !important;
}
[data-theme="light"] .dock-title {
    color: #162238 !important;
}
[data-theme="light"] .dock-percent {
    color: #EA580C !important;
}
[data-theme="light"] .dock-track {
    background: rgba(22, 34, 56, 0.08) !important;
}
[data-theme="light"] .dock-fill {
    background: linear-gradient(90deg, #FF6B4A, #EA580C) !important;
}
[data-theme="light"] .dock-filename {
    color: #64748B !important;
}
[data-theme="light"] .dock-btn-maximize {
    background: #FFEAE3 !important;
    border: 1px solid #FFB39F !important;
    color: #EA580C !important;
}
[data-theme="light"] .dock-btn-maximize:hover {
    background: #FF6B4A !important;
    color: #FFFFFF !important;
    box-shadow: 0 0 14px rgba(255, 107, 74, 0.35) !important;
}
[data-theme="light"] .btn-modal-icon-action {
    background: #FAF7F2 !important;
    border-color: rgba(22, 34, 56, 0.12) !important;
    color: #162238 !important;
}
[data-theme="light"] .btn-modal-icon-action:hover {
    background: #FFEAE3 !important;
    border-color: #FF6B4A !important;
    color: #EA580C !important;
}
[data-theme="light"] .dropzone {
    background: #FAF7F2 !important;
    border-color: rgba(22, 34, 56, 0.15) !important;
}
[data-theme="light"] .dropzone.dragover {
    background: #FFEAE3 !important;
    border-color: #FF6B4A !important;
}
[data-theme="light"] .success-header-badge {
    background: #E8F8F2 !important;
    border-color: #A7F3D0 !important;
}
[data-theme="light"] .success-header-badge div > div:first-child {
    color: #059669 !important;
}
[data-theme="light"] .success-header-badge div > div:last-child {
    color: #475569 !important;
}
[data-theme="light"] .success-stats-grid .stat-box {
    background: #FAF7F2 !important;
    border-color: rgba(22, 34, 56, 0.09) !important;
}
[data-theme="light"] .success-stats-grid .stat-label {
    color: #64748B !important;
}
[data-theme="light"] .success-stats-grid .stat-val {
    color: #162238 !important;
}
