/* =========================================================================
   Painel de PDFs — estilos
   Tema claro, minimalista, baseado em cartões.
   ========================================================================= */

:root {
    --bg:            #f6f7f9;
    --surface:       #ffffff;
    --border:        #e6e8eb;
    --border-strong: #d6d9dd;
    --text:          #1a1d21;
    --text-soft:     #6b7280;
    --primary:       #151F49;
    --primary-hover: #20305f;
    --primary-soft:  #ebedf5;
    --success:       #16a34a;
    --success-soft:  #ecfdf3;
    --danger:        #dc2626;
    --danger-soft:   #fef2f2;
    --radius:        14px;
    --radius-sm:     10px;
    --shadow:        0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
    --shadow-sm:     0 1px 2px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Botões ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font: inherit;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s, transform .05s;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: transparent;
}
.btn-secondary:hover { background: #dfe2ef; }

.btn-ghost {
    background: transparent;
    color: var(--text-soft);
    border-color: var(--border);
}
.btn-ghost:hover { background: #f1f3f5; color: var(--text); }

.btn-danger-ghost {
    background: transparent;
    color: var(--danger);
    border-color: var(--border);
}
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: #f5c2c2; }

.btn-sm  { padding: 7px 12px; font-size: 13px; }
.btn-lg  { padding: 14px 24px; font-size: 16px; }
.btn-block { width: 100%; }

/* ---------- Topbar ---------- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 880px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; }
.brand-logo { height: 40px; width: auto; display: block; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-name { color: var(--text-soft); font-size: 14px; }

/* ---------- Container ---------- */
.container {
    max-width: 880px;
    margin: 0 auto;
    padding: 28px 20px 64px;
}
.page-title {
    font-size: 26px;
    font-weight: 700;
    margin: 8px 0 20px;
}

/* ---------- Cartão de upload ---------- */
.upload-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    text-align: center;
    margin-bottom: 28px;
}
.upload-hint {
    color: var(--text-soft);
    font-size: 13px;
    margin: 18px 0 0;
}

.selected-area {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}
.selected-file { display: flex; align-items: center; gap: 10px; min-width: 0; }
.selected-icon { font-size: 20px; }
.selected-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 360px;
}
.selected-actions { display: flex; gap: 8px; }

/* Barra de progresso */
.progress-wrap {
    margin-top: 18px;
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    width: 0;
    background: var(--primary);
    transition: width .15s ease;
}

/* Área de sucesso */
.success-area {
    margin-top: 18px;
    text-align: left;
    background: var(--success-soft);
    border: 1px solid #c4f0d4;
    border-radius: var(--radius-sm);
    padding: 16px;
}
.success-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #157347;
    margin-bottom: 12px;
}
.success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--success);
    color: #fff;
    font-size: 13px;
}
.success-link-row { display: flex; gap: 8px; flex-wrap: wrap; }
.link-input {
    flex: 1;
    min-width: 220px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 13px;
    color: var(--text);
}

/* ---------- Lista de arquivos ---------- */
.files-grid { display: grid; gap: 12px; }

.file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px 18px;
    transition: box-shadow .15s, border-color .15s;
}
.file-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }

.file-icon {
    font-size: 26px;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    border-radius: var(--radius-sm);
}
.file-info { flex: 1; min-width: 0; }
.file-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-date { color: var(--text-soft); font-size: 13px; margin-top: 2px; }
.file-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Estado vazio */
.empty-state {
    text-align: center;
    color: var(--text-soft);
    padding: 48px 20px;
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}
.empty-icon { font-size: 40px; margin-bottom: 8px; }

/* ---------- Alertas ---------- */
.alert {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: left;
}
.alert-error   { background: var(--danger-soft);  color: #b42318; border: 1px solid #f5c2c2; }
.alert-success { background: var(--success-soft); color: #157347; border: 1px solid #c4f0d4; }

/* ---------- Login / Setup ---------- */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    text-align: center;
}
.auth-logo { font-size: 36px; margin-bottom: 6px; }
.auth-logo-img { width: 190px; max-width: 70%; height: auto; margin: 0 auto 16px; display: block; }
.auth-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.auth-subtitle { color: var(--text-soft); margin: 0 0 22px; font-size: 14px; }

.auth-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.field input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1a1d21;
    color: #fff;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 50;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- Responsivo ---------- */
@media (max-width: 600px) {
    .file-card { flex-wrap: wrap; }
    .file-actions { width: 100%; justify-content: flex-end; }
    .selected-name { max-width: 200px; }
    .page-title { font-size: 22px; }
}

/* ---------- Envio em lote + miniaturas ---------- */
.selected-area-col { margin-top: 18px; text-align: left; }
.selected-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.selected-row {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 10px 12px;
}
.sr-icon { font-size: 18px; flex-shrink: 0; }
.sr-name {
    flex: 1; min-width: 0; font-size: 14px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sr-status { font-size: 13px; color: var(--text-soft); flex-shrink: 0; white-space: nowrap; }
.sr-status.done  { color: var(--success); font-weight: 600; }
.sr-status.error {
    color: var(--danger); font-weight: 600;
    max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.selected-actions { display: flex; gap: 8px; justify-content: flex-end; }
.success-actions { margin-top: 10px; }
.link-area {
    width: 100%; display: block; resize: vertical;
    font-family: inherit; line-height: 1.5;
}
.file-thumb {
    width: 44px; height: 44px; flex-shrink: 0; display: block;
    border-radius: var(--radius-sm); object-fit: cover;
    background: var(--primary-soft);
}
