/* ============================================================
   DivisorPDF — Interface profissional
   Paleta neutra (slate) com um único acento azul corporativo.
   ============================================================ */

:root {
    /* Superfícies */
    --bg: #eef1f6;
    --surface: #ffffff;
    --surface-alt: #f7f9fc;
    --surface-hover: #f1f5fb;

    /* Bordas */
    --border: #e3e8ef;
    --border-strong: #d4dbe5;

    /* Acento (azul corporativo) */
    --brand: #2563eb;
    --brand-hover: #1d4ed8;
    --brand-active: #1e40af;
    --brand-soft: #eef4ff;
    --brand-soft-border: #d6e4ff;
    --brand-text: #1d4ed8;

    /* Estados semânticos */
    --success: #16a34a;
    --success-hover: #15803d;
    --success-soft: #ecfdf3;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-soft: #fef2f2;
    --warn-text: #92400e;
    --warn-soft: #fffaeb;
    --warn-border: #fde7b5;

    /* Texto */
    --text: #0f172a;
    --text-2: #475569;
    --text-3: #64748b;

    /* Raios */
    --r-lg: 16px;
    --r-md: 12px;
    --r-sm: 9px;
    --r-xs: 6px;

    /* Sombras (suaves, em camadas) */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 6px 16px -6px rgba(15, 23, 42, 0.12), 0 2px 6px -2px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 18px 40px -12px rgba(15, 23, 42, 0.20);

    /* Espaçamento */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    --transition-fast: 120ms ease;
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);

    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ring: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

*, *::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 {
    font-family: var(--font-body);
    background: var(--bg);
    background-image:
        radial-gradient(1200px 480px at 50% -10%, rgba(37, 99, 235, 0.07), transparent 70%);
    background-repeat: no-repeat;
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
}

.app-container {
    width: min(100%, 720px);
    margin: 0 auto;
    padding: var(--space-xl) var(--space-md) var(--space-lg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- Cabeçalho ---------- */

.header {
    padding: var(--space-lg) 0 var(--space-xl);
    text-align: center;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.product-eyebrow {
    display: inline-flex;
    align-items: center;
    margin-bottom: var(--space-md);
    padding: 0.3rem 0.75rem;
    color: var(--brand-text);
    background: var(--brand-soft);
    border: 1px solid var(--brand-soft-border);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: var(--space-md);
}

.logo-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.9rem;
    line-height: 1;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.logo-accent {
    color: var(--brand);
}

.header-subtitle {
    max-width: 480px;
    color: var(--text-2);
    font-size: 1rem;
    line-height: 1.6;
}

/* ---------- Cartões ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--r-sm);
    background: var(--brand-soft);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-icon-processing { background: var(--brand-soft); color: var(--brand); }
.card-icon-success { background: var(--success-soft); color: var(--success); }
.card-icon-error { background: var(--danger-soft); color: var(--danger); }

.card-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* ---------- Drop zone ---------- */

.drop-zone {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--r-md);
    padding: var(--space-2xl) var(--space-xl);
    background: var(--surface-alt);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-base), background var(--transition-base);
    outline: none;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.drag-over {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.drop-zone-icon {
    color: var(--brand);
    margin-bottom: var(--space-md);
    opacity: 0.9;
}

.drop-zone-text {
    color: var(--text);
    font-size: 1rem;
    margin-bottom: var(--space-sm);
}

.drop-zone-text strong {
    display: block;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.drop-zone-text span,
.drop-zone-hint {
    color: var(--text-3);
    font-size: 0.875rem;
}

.file-input-hidden {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

/* ---------- Lista de arquivos ---------- */

.file-list,
.compress-control,
.action-switch-control,
.size-control {
    margin-top: var(--space-xl);
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.file-list-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--r-xs);
    font-family: var(--font-body);
    transition: background var(--transition-fast);
}

.btn-text:hover {
    background: var(--danger-soft);
}

.file-items {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 240px;
    overflow-y: auto;
    padding-right: var(--space-xs);
}

.file-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 0.7rem var(--space-md);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    transition: border-color var(--transition-fast);
}

.file-item:hover {
    border-color: var(--border-strong);
}

.file-item-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--r-xs);
    background: var(--brand-soft);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.file-item-info {
    flex: 1;
    min-width: 0;
}

.file-item-name {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-size {
    color: var(--text-3);
    font-size: 0.8rem;
}

.file-item-remove {
    border: none;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--r-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.file-item-remove:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.file-list-summary {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
    color: var(--text-2);
    font-size: 0.875rem;
    font-weight: 600;
}

/* ---------- Rótulos ---------- */

.size-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
}

.size-label svg {
    color: var(--brand);
}

/* ---------- Opções de compressão ---------- */

.compress-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
}

.compress-opt-card {
    display: block;
    position: relative;
    cursor: pointer;
    padding: var(--space-md);
    min-height: 128px;
    background: var(--surface-alt);
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    transition: border-color var(--transition-base), background var(--transition-base), box-shadow var(--transition-base);
}

.compress-opt-card:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
}

.compress-opt-card.active {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: var(--ring);
}

.compress-radio-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.compress-opt-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.compress-opt-title {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
}

.compress-opt-desc {
    color: var(--text-2);
    font-size: 0.78rem;
    line-height: 1.35;
    flex: 1;
}

.compress-opt-est {
    color: var(--brand-text);
    font-size: 0.78rem;
    font-weight: 700;
}

/* ---------- Switch ---------- */

.action-switch-control {
    padding: var(--space-md) var(--space-lg);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}

.switch-container {
    width: 100%;
    display: inline-flex;
    align-items: center;
    gap: var(--space-md);
    cursor: pointer;
    user-select: none;
}

.switch-container input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-slider {
    width: 44px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 999px;
    position: relative;
    transition: background var(--transition-base);
    flex-shrink: 0;
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    left: 3px;
    top: 3px;
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition-base);
}

.switch-container input:checked + .switch-slider {
    background: var(--brand);
}

.switch-container input:focus-visible + .switch-slider {
    box-shadow: var(--ring);
}

.switch-container input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.switch-label-text {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
}

/* ---------- Controle de tamanho ---------- */

.size-input-group {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.size-slider {
    flex: 1;
    appearance: none;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 999px;
    background: var(--border-strong);
    outline: none;
    cursor: pointer;
}

.size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--brand);
    border: 3px solid #ffffff;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.size-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--brand);
    border: 3px solid #ffffff;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.size-number-group {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    min-width: 120px;
    padding: 0.4rem var(--space-sm);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-xs);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.size-number-group:focus-within {
    border-color: var(--brand);
    box-shadow: var(--ring);
}

.size-number-input {
    width: 70px;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    text-align: right;
    outline: none;
}

.size-unit {
    color: var(--text-3);
    font-size: 0.9rem;
    font-weight: 600;
}

.size-hint {
    margin-top: var(--space-sm);
    color: var(--text-3);
    font-size: 0.84rem;
}

.size-hint strong {
    color: var(--text);
}

/* ---------- Previsão de tempo ---------- */

.time-estimate {
    margin: var(--space-lg) 0;
    padding: var(--space-md) var(--space-lg);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}

.time-estimate-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.time-estimate-label {
    color: var(--text-3);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.time-estimate-total {
    color: var(--text);
    font-size: 1rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* ---------- Botões ---------- */

.btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.85rem var(--space-xl);
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    font-family: var(--font-body);
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base),
        color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-fast);
    text-decoration: none;
    position: relative;
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-primary {
    margin-top: var(--space-lg);
    background: var(--brand);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-hover);
    box-shadow: 0 6px 16px -6px rgba(37, 99, 235, 0.5);
}

.btn-primary:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-download {
    margin-bottom: var(--space-md);
    background: var(--success);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(22, 163, 74, 0.25);
}

.btn-download:hover {
    background: var(--success-hover);
    box-shadow: 0 6px 16px -6px rgba(22, 163, 74, 0.5);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: var(--surface-alt);
    border-color: #b8c4d6;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.btn.loading {
    pointer-events: none;
    opacity: 0.85;
}

.btn.loading span {
    visibility: hidden;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ---------- Progresso ---------- */

.progress-container {
    margin-top: var(--space-md);
}

.progress-label {
    display: block;
    margin-bottom: var(--space-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e8edf3;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: var(--brand);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.upload-fill {
    background: var(--success) !important;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
    margin-top: var(--space-sm);
    color: var(--text-2);
    font-size: 0.85rem;
}

#progress-percent,
#upload-progress-percent {
    color: var(--text);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.workflow-eta {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    color: var(--text-2);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: 0.92rem;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ---------- Resultado ---------- */

.result-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat {
    padding: var(--space-lg);
    text-align: center;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}

.stat-value {
    display: block;
    margin-bottom: var(--space-xs);
    color: var(--brand);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    color: var(--text-3);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-warnings,
.result-warning {
    padding: var(--space-md);
    color: var(--warn-text);
    background: var(--warn-soft);
    border: 1px solid var(--warn-border);
    border-radius: var(--r-md);
}

.result-warnings {
    margin-bottom: var(--space-lg);
}

.result-warnings-title,
.result-warning {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 700;
}

.result-warnings-title {
    margin-bottom: var(--space-sm);
}

.result-warnings-list {
    margin: 0;
    padding-left: var(--space-lg);
    color: #78350f;
    font-size: 0.9rem;
    line-height: 1.5;
}

.result-warnings-list li + li {
    margin-top: var(--space-xs);
}

.result-warning {
    margin-top: var(--space-lg);
    font-size: 0.84rem;
    font-weight: 600;
}

.error-message {
    margin-bottom: var(--space-xl);
    padding: var(--space-md);
    color: #991b1b;
    background: var(--danger-soft);
    border: 1px solid #fecaca;
    border-radius: var(--r-md);
    font-size: 0.95rem;
}

/* ---------- Toasts ---------- */

.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    max-width: 380px;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    font-weight: 600;
    animation: toast-in 0.2s ease-out;
}

.toast.toast-error {
    border-left: 3px solid var(--danger);
    color: var(--danger);
}

.toast.toast-success {
    border-left: 3px solid var(--success);
    color: var(--success);
}

.toast.toast-out {
    animation: toast-out 0.2s ease-in forwards;
}

/* ---------- Rodapé ---------- */

.footer {
    margin-top: auto;
    padding: var(--space-xl) 0 var(--space-md);
    text-align: center;
}

.footer p {
    color: var(--text-3);
    font-size: 0.8rem;
}

/* ---------- Animações ---------- */

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

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-8px); }
}

@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsivo ---------- */

@media (max-width: 720px) {
    .app-container {
        padding: var(--space-lg) var(--space-sm);
    }

    .card {
        padding: var(--space-lg);
    }

    .compress-options {
        grid-template-columns: 1fr 1fr;
    }

    .compress-opt-card {
        min-height: auto;
    }

    .size-input-group {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-md);
    }

    .size-number-group {
        align-self: flex-start;
    }

    .result-stats {
        grid-template-columns: 1fr;
    }

    .progress-info,
    .time-estimate-header,
    .file-list-header {
        align-items: flex-start;
        flex-direction: column;
        gap: var(--space-xs);
    }

    .toast-container {
        left: var(--space-sm);
        right: var(--space-sm);
        top: var(--space-sm);
    }

    .toast {
        max-width: none;
    }
}

@media (max-width: 440px) {
    .compress-options {
        grid-template-columns: 1fr;
    }
}
