/* =================================================================
== ESTILOS ESSENCIAIS PARA O PORTAL DATASYNC
================================================================= */

/* Cards Padrão */
.card {
    background-color: #ffffff;
    border-radius: 1.25rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.dark .card {
    background-color: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

/* Componentes de Botão */
.btn {
    height: 44px;
    padding: 0 18px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    line-height: 1;
}

.btn-sm {
    height: 38px;
    padding: 0 14px;
    font-size: 12px;
}

/* Botão Primário (Executar Importação) */
.btn-primary {
    background-color: #f59e0b;
    color: #0f172a;
    border: 1px solid #f59e0b;
    font-weight: 800;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.28);
}

.btn-primary:hover {
    background-color: #fbbf24;
    border-color: #fbbf24;
    color: #020617;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.38);
}

/* Botão Secundário (Dados de Terceiros, Importar Cardápio) */
.btn-secondary {
    background-color: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover {
    background-color: #f8fafc;
    border-color: #f59e0b;
    color: #d97706;
}

.dark .btn-secondary {
    background-color: rgba(255, 255, 255, 0.06);
    color: #f1f5f9;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: none;
}

.dark .btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: #f59e0b;
    color: #fbbf24;
}

/* Botão de Perigo */
.btn-danger {
    background-color: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.btn-danger:hover {
    background-color: #fff1f2;
    color: #e11d48;
    border-color: #fecdd3;
}

.dark .btn-danger {
    background-color: rgba(30, 41, 59, 0.6);
    color: #94a3b8;
    border-color: rgba(255, 255, 255, 0.1);
}

.dark .btn-danger:hover {
    background-color: rgba(225, 29, 72, 0.15);
    color: #fb7185;
    border-color: rgba(225, 29, 72, 0.3);
}

/* Inputs e Seletores */
.field {
    display: block;
    width: 100%;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 12px 16px;
    font-size: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.dark .field {
    border-color: rgba(255, 255, 255, 0.12);
    background-color: rgba(15, 23, 42, 0.5);
    color: #f8fafc;
}

.dark .field:focus {
    border-color: #f59e0b;
    background-color: #0f172a;
}
/* Estrutura do fluxo de importação de terceiros */
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: #ffffff;
    color: #0f172a;
}

.workflow-shell {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
}

.workflow-header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    position: relative;
    z-index: 20;
}

.workflow-shell > main {
    background: #ffffff;
}

.workflow-stage {
    width: 100%;
}

:root {
    --import-card-height: clamp(640px, calc(100vh - 170px), 820px);
    --import-stage-files-height: clamp(500px, calc(100vh - 260px), 620px);
}

#stage-files {
    height: auto !important;
    min-height: 100% !important;
    overflow: visible !important;
}

#stage-files > div {
    height: auto !important;
    min-height: 0 !important;
}

#stage-files > div > .surface {
    height: var(--import-stage-files-height) !important;
    min-height: var(--import-stage-files-height) !important;
    flex: 0 0 auto !important;
}

.surface {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 18px 45px -28px rgba(15, 23, 42, 0.28);
}

.secondary {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.dropzone.is-dragging {
    border-color: #f59e0b !important;
    background: #fffbeb !important;
    box-shadow: inset 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.progress-fill {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.35);
    transition: width .45s ease;
}

.progress-fill.is-running {
    background-size: 200% 100%;
    animation: import-progress-pulse 1.4s linear infinite;
}

@keyframes import-progress-pulse {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

.dark body,
.dark .workflow-shell,
.dark .workflow-shell > main {
    background: rgb(39, 41, 48);
    color: #f8fafc;
}

.dark .workflow-header,
.dark .surface {
    background: rgba(48, 51, 60, 0.96);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark .secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
}

@media (max-width: 900px) {
    body { overflow: auto; }
    .workflow-shell { min-height: 100vh; height: auto; overflow: visible; }
    .workflow-shell > main { overflow: visible; }
    #stage-files { height: auto; overflow: visible; }
    #stage-files .surface { overflow: visible; }
}
/* Animações e estabilidade dos estados da importação */
#import-loading-panel,
#queue-panel,
#error-panel {
    height: auto !important;
    min-height: var(--import-card-height) !important;
    max-height: none;
    flex: 1 1 auto !important;
    overflow: visible;
}

#success-panel {
    height: auto !important;
    min-height: auto !important;
    max-height: none;
    flex: 0 0 auto !important;
    overflow: visible;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(15, 23, 42, .22);
    border-top-color: currentColor;
    border-radius: 999px;
    animation: import-spin .8s linear infinite;
}

.import-loading-glow {
    position: absolute;
    width: 460px;
    height: 460px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(245, 158, 11, .18), rgba(245, 158, 11, 0) 68%);
    animation: import-glow 2.4s ease-in-out infinite;
    pointer-events: none;
}

.ai-loader {
    width: 7rem !important;
    height: 7rem !important;
}

@media (min-width: 640px) {
    .ai-loader {
        width: 8rem !important;
        height: 8rem !important;
    }
}

.ai-loader-ring,
.ai-loader-orbit {
    position: absolute;
    inset: 0;
    border-radius: 999px;
}

.ai-loader-ring {
    border: 4px solid rgba(245, 158, 11, .16);
    border-top-color: #f59e0b;
    border-right-color: #fbbf24;
    animation: import-spin 1.15s linear infinite;
    box-shadow: 0 0 28px rgba(245, 158, 11, .18);
}

.ai-loader-orbit {
    inset: 13px;
    border: 1px dashed rgba(245, 158, 11, .45);
    animation: import-spin 2.8s linear infinite reverse;
}

.ai-loader-orbit::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #f59e0b;
    box-shadow: 0 0 14px rgba(245, 158, 11, .75);
}

.success-confetti {
    position: absolute;
    inset: 0;
    z-index: 5;
    overflow: hidden;
}

#success-panel > :not(.success-confetti) {
    position: relative;
    z-index: 10;
}

.success-confetti i {
    position: absolute;
    top: -12%;
    width: 9px;
    height: 16px;
    border-radius: 2px;
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0deg);
}

.success-confetti.is-active i {
    animation: confetti-fall var(--duration, 4s) linear var(--delay, 0s) infinite;
}

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

@keyframes import-glow {
    0%, 100% { opacity: .45; transform: scale(.88); }
    50% { opacity: 1; transform: scale(1.08); }
}

@keyframes confetti-fall {
    0% { top: -12%; opacity: 0; transform: translateX(0) rotate(0deg); }
    10% { opacity: 1; }
    100% { top: 112%; opacity: .95; transform: translateX(var(--drift, 0)) rotate(var(--rotation, 720deg)); }
}

@media (prefers-reduced-motion: reduce) {
    .spinner,
    .import-loading-glow,
    .ai-loader-ring,
    .ai-loader-orbit,
    .progress-fill.is-running,
    .success-confetti i {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* =================================================================
== Ajustes Etapa 3: elementos internos acompanham o card maior
================================================================= */
#import-loading-panel #progress-description {
    font-size: clamp(1.75rem, 3vw, 2.5rem) !important;
    line-height: 1.2 !important;
}

#import-loading-panel > p {
    font-size: 1rem !important;
    line-height: 1.6 !important;
}

#import-loading-panel > div.w-full.max-w-2xl {
    height: 1.1rem !important;
    max-width: 42rem !important;
}

#import-loading-panel #progress-percent {
    font-size: clamp(1.75rem, 2.5vw, 2.25rem) !important;
}

#import-loading-panel > div:last-child {
    max-width: 48rem !important;
    padding: 1.4rem !important;
}

#import-loading-panel .phase-icon {
    height: 4.5rem !important;
    width: 4.5rem !important;
    font-size: 1.9rem !important;
}

#import-loading-panel .phase-icon > span {
    height: 1.35rem !important;
    width: 1.35rem !important;
    font-size: 0.68rem !important;
}

#import-loading-panel .phase-icon svg {
    height: 2rem !important;
    width: 2rem !important;
}

#import-loading-panel [data-phase] h4 {
    font-size: 0.95rem !important;
}

#import-loading-panel [data-phase] p {
    font-size: 0.8rem !important;
    line-height: 1.45 !important;
}
