/* ==========================================================================
   UniRV - Prática de Engenharia de Software (N2 - Etapa 1)
   Design System & Estilos da Interface de Extração de Notas Fiscais
   ========================================================================== */

:root {
    /* Cores Principais */
    --primary-color: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #ccfbf1;
    --primary-gradient: linear-gradient(135deg, #0f766e 0%, #0d9488 50%, #14b8a6 100%);
    
    --secondary-color: #1e293b;
    --secondary-light: #334155;
    
    --accent-emerald: #10b981;
    --accent-blue: #3b82f6;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    
    /* Superfícies e Fundos */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-muted: #f1f5f9;
    --bg-code: #0f172a;
    
    /* Bordas e Divisórias */
    --border-color: #e2e8f0;
    --border-focus: #0d9488;
    
    /* Tipografia */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-inverse: #ffffff;
    
    /* Fontes */
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', Consolas, Monaco, monospace;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.08);

    /* Raios de Borda */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;
    
    /* Transições */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset Global */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Header Institucional
   ========================================================================== */
.app-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-badge {
    background: #0f766e;
    color: #ffffff;
    font-weight: 800;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(15, 118, 110, 0.25);
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}

.brand-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-mobile-access {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    color: #065f46;
    cursor: pointer;
    transition: var(--transition);
}

.btn-mobile-access:hover {
    background: #d1fae5;
    color: #047857;
    border-color: #6ee7b7;
}

.btn-api-config {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-api-config:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-amber);
    display: inline-block;
    transition: var(--transition);
}

.status-indicator.active {
    background-color: var(--accent-emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* ==========================================================================
   Conteúdo e Container
   ========================================================================== */
.main-content {
    flex: 1;
    padding: 36px 16px 64px;
}

.page-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Hero Section (Figuras 1 e 2) */
.hero-section {
    text-align: center;
    margin-bottom: 8px;
}

.page-title {
    font-size: 28px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.page-subtitle {
    font-size: 15px;
    color: var(--text-muted);
}

/* ==========================================================================
   Cards Genéricos
   ========================================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--primary-color);
}

.card-body {
    padding: 24px;
}

/* ==========================================================================
   Área de Upload e Dropzone
   ========================================================================== */
.input-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    background: #f8fafc;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary-color);
    background: #f0fdfa;
}

.file-input-hidden {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.drop-zone-prompt {
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.drop-icon {
    font-size: 42px;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.drop-text {
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-browse {
    pointer-events: auto;
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.btn-browse:hover {
    background: var(--bg-muted);
    border-color: #94a3b8;
}

.drop-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* Card do Arquivo Selecionado (Conforme Figura 2) */
.selected-file-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-top: 14px;
    animation: fadeIn 0.3s ease;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.file-icon-wrapper {
    font-size: 24px;
    color: #ef4444;
}

.file-meta {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 500px;
}

.file-size {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.btn-remove-file {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-remove-file:hover {
    color: var(--accent-rose);
    background: #fee2e2;
}

/* Atalhos de Exemplo */
.sample-actions {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sample-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.btn-sample {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-sample:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #cbd5e1;
}

/* Botão Extrair Dados (Conforme Figuras 1 e 2) */
.btn-extract {
    width: 100%;
    margin-top: 20px;
    background: #334155;
    color: #ffffff;
    border: none;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.btn-extract:not(:disabled):hover {
    background: #1e293b;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-extract:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #94a3b8;
}

/* ==========================================================================
   Seção de Resultados (Figura 2)
   ========================================================================== */
.results-header {
    background: #ffffff;
}

.source-badge {
    font-size: 12px;
    font-weight: 600;
    background: #e0f2fe;
    color: #0369a1;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Abas de Navegação (Conforme Figura 2) */
.tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    gap: 8px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary-dark);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
    animation: fadeIn 0.25s ease;
}

.tab-content.active {
    display: block;
}

/* Banner de Destaque da Classificação */
.classification-banner {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.banner-icon {
    font-size: 28px;
    color: #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-body {
    flex: 1;
}

.banner-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #15803d;
}

.banner-category {
    font-size: 20px;
    font-weight: 800;
    color: #14532d;
    margin: 4px 0 10px;
}

.detected-tags-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tags-label {
    font-size: 12px;
    font-weight: 600;
    color: #166534;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-badge {
    background: #ffffff;
    border: 1px solid #86efac;
    color: #15803d;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Grid de Informações Formatadas */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.info-card {
    background: #fafafa;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.info-card.full-width {
    grid-column: 1 / -1;
}

.info-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.info-card-header i {
    color: var(--primary-color);
    font-size: 14px;
}

.info-card-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.info-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.field-item {
    display: flex;
    flex-direction: column;
    font-size: 13px;
}

.field-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.field-value {
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

.field-value.highlight {
    font-weight: 600;
    color: #0f172a;
}

.field-value.bold {
    font-weight: 700;
    font-size: 14px;
}

.field-value.mono {
    font-family: var(--font-mono);
    font-size: 12px;
}

.field-value.valor-total {
    font-size: 18px;
    font-weight: 800;
    color: #0f766e;
}

.products-description {
    font-size: 13px;
    line-height: 1.6;
    color: #334155;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 12px;
}

/* ==========================================================================
   Aba JSON (Conforme Figura 2)
   ========================================================================== */
.json-tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.json-tab-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.json-actions {
    display: flex;
    gap: 8px;
}

.btn-copy-json, .btn-download-json {
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.btn-copy-json:hover, .btn-download-json:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
    border-color: #cbd5e1;
}

.code-container {
    background: var(--bg-code);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow-x: auto;
    max-height: 480px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.json-code {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Destaque de Sintaxe JSON */
.json-key {
    color: #38bdf8;
    font-weight: 600;
}
.json-string {
    color: #4ade80;
}
.json-number {
    color: #fb923c;
}
.json-boolean {
    color: #c084fc;
}
.json-null {
    color: #94a3b8;
}

.json-footer-note {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* ==========================================================================
   Modal da API
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}

.modal-container {
    background: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: scaleUp 0.25s ease;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.btn-close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.form-control {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font-mono);
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.btn-toggle-visibility {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.form-hint a {
    color: var(--primary-color);
    text-decoration: underline;
}

.api-notice {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12px;
    color: #0369a1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-modal-cancel {
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
}

.btn-modal-save {
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-modal-save:hover {
    background: var(--primary-dark);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.toast {
    background: #1e293b;
    color: #ffffff;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.25s ease;
}

.toast.success {
    border-left: 4px solid var(--accent-emerald);
}

.toast.error {
    border-left: 4px solid var(--accent-rose);
}

.toast.info {
    border-left: 4px solid var(--accent-blue);
}

/* ==========================================================================
   Classes Utilitárias e Animações
   ========================================================================== */
.hidden {
    display: none !important;
}

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

@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

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

/* Modal de Acesso Mobile (QR Code) */
.mobile-modal-box {
    max-width: 440px;
}

.text-center {
    text-align: center;
}

.qr-code-wrapper {
    background: #ffffff;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin: 8px auto 14px;
}

#qrcode {
    display: flex;
    justify-content: center;
    align-items: center;
}

#qrcode img,
#qrcode canvas {
    max-width: 170px !important;
    max-height: 170px !important;
    display: block;
    margin: 0 auto;
}

.mobile-url-box {
    margin: 12px 0 16px;
    text-align: left;
}

.mobile-url-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 6px;
}

.mobile-url-input-group {
    display: flex;
    gap: 8px;
}

.mobile-url-input {
    background: var(--bg-muted);
    font-size: 13px;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.btn-copy-url {
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-copy-url:hover {
    background: var(--primary-dark);
}

/* ==========================================================================
   Responsividade Completa para Mobile e Tablet
   ========================================================================== */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
        padding: 12px 16px;
    }

    .brand-group {
        justify-content: flex-start;
    }

    .header-actions {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .btn-mobile-access,
    .btn-api-config {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
        font-size: 12px;
    }

    .main-content {
        padding: 20px 12px 48px;
    }

    .page-container {
        gap: 16px;
    }

    .hero-section {
        margin-bottom: 4px;
    }

    .page-title {
        font-size: 22px;
        line-height: 1.25;
    }

    .page-subtitle {
        font-size: 13px;
    }

    .card-header {
        padding: 12px 16px;
    }

    .card-body {
        padding: 16px;
    }

    .drop-zone {
        padding: 24px 14px;
    }

    .drop-icon {
        font-size: 36px;
    }

    .drop-title {
        font-size: 13px;
    }

    .btn-browse {
        padding: 6px 12px;
        font-size: 12px;
    }

    .selected-file-card {
        padding: 10px 12px;
    }

    .file-name {
        max-width: 200px;
        font-size: 13px;
    }

    .sample-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .sample-label {
        margin-bottom: 2px;
    }

    .btn-sample {
        width: 100%;
        justify-content: flex-start;
        padding: 8px 12px;
        font-size: 12px;
    }

    .btn-extract {
        padding: 13px 18px;
        font-size: 14px;
    }

    .tabs-nav {
        gap: 4px;
        margin-bottom: 16px;
    }

    .tab-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 6px;
        font-size: 13px;
        text-align: center;
    }

    .classification-banner {
        flex-direction: column;
        padding: 14px;
        gap: 10px;
    }

    .banner-category {
        font-size: 17px;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .info-card {
        padding: 12px 14px;
    }

    .json-tab-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .json-actions {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .btn-copy-json,
    .btn-download-json {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
        font-size: 12px;
    }

    .code-container {
        padding: 12px;
        max-height: 380px;
        -webkit-overflow-scrolling: touch;
    }

    .json-code {
        font-size: 12px;
    }

    .modal-container {
        margin: 12px;
        width: calc(100% - 24px);
        max-height: 92vh;
        overflow-y: auto;
    }

    .modal-body {
        padding: 16px;
    }

    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .toast {
        width: 100%;
        justify-content: center;
    }

    /* Prevenir auto-zoom do Safari no iOS */
    .form-control {
        font-size: 16px;
    }
}

@media (max-width: 420px) {
    .brand-title {
        font-size: 13px;
    }

    .brand-subtitle {
        font-size: 11px;
    }

    .brand-badge {
        font-size: 12px;
        padding: 4px 8px;
    }

    .page-title {
        font-size: 20px;
    }

    .file-name {
        max-width: 150px;
    }

    .tab-btn {
        font-size: 12px;
        padding: 8px 4px;
        gap: 4px;
    }
}

/* ==========================================================================
   Estilos da Página de Login & Autenticação
   ========================================================================== */
.login-wrapper {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    background: radial-gradient(circle at 50% 20%, #f0fdf4 0%, #f8fafc 70%);
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: scaleUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-header {
    background: #f8fafc;
    padding: 28px 24px 20px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.login-icon-badge {
    width: 52px;
    height: 52px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
    box-shadow: 0 4px 10px rgba(15, 118, 110, 0.15);
}

.login-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
}

.login-body {
    padding: 24px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-btn {
    width: 100%;
    margin-top: 4px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.input-leading-icon {
    position: absolute;
    right: 14px;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.demo-credentials-box {
    background: #f0fdf4;
    border: 1px dashed #86efac;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 12px;
    color: #166534;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.demo-credentials-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.auth-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 6px 12px;
    border-radius: var(--radius-full);
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    color: #be123c;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background: #ffe4e6;
    color: #9f1239;
    border-color: #fda4af;
}

.auth-switch-link {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.auth-switch-link a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.auth-switch-link a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ==========================================================================
   Botão de Alternância de Tema (Modo Noturno / Claro)
   ========================================================================== */
.btn-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-theme-toggle:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: rotate(15deg);
}

/* ==========================================================================
   Design System - Modo Noturno ([data-theme="dark"])
   ========================================================================== */
[data-theme="dark"] {
    --primary-color: #14b8a6;
    --primary-dark: #0d9488;
    --primary-light: rgba(20, 184, 166, 0.18);
    --primary-gradient: linear-gradient(135deg, #0f766e 0%, #14b8a6 50%, #2dd4bf 100%);

    --secondary-color: #f8fafc;
    --secondary-light: #cbd5e1;

    /* Superfícies e Fundos Noturnos */
    --bg-main: #0b0f19;
    --bg-card: #131b2e;
    --bg-muted: #1c263f;
    --bg-code: #070a12;

    /* Bordas e Divisórias Noturnas */
    --border-color: #24314c;
    --border-focus: #14b8a6;

    /* Tipografia Noturna */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-inverse: #0b0f19;

    /* Sombras Noturnas */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.6);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.7);
}

[data-theme="dark"] .app-header {
    background: #111827;
    border-bottom-color: #24314c;
}

[data-theme="dark"] .card {
    background: #131b2e;
    border-color: #24314c;
}

[data-theme="dark"] .card-header {
    background: #182239;
    border-bottom-color: #24314c;
}

[data-theme="dark"] .drop-zone {
    background: #151f35;
    border-color: #2d3d5e;
}

[data-theme="dark"] .drop-zone:hover,
[data-theme="dark"] .drop-zone.dragover {
    background: #112833;
    border-color: var(--primary-color);
}

[data-theme="dark"] .btn-browse {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

[data-theme="dark"] .btn-browse:hover {
    background: #334155;
}

[data-theme="dark"] .selected-file-card {
    background: #182239;
    border-color: #2d3d5e;
}

[data-theme="dark"] .btn-sample {
    background: #182239;
    border-color: #2d3d5e;
    color: #cbd5e1;
}

[data-theme="dark"] .btn-sample:hover {
    background: #24314c;
    color: #ffffff;
}

[data-theme="dark"] .classification-banner {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.4) 0%, rgba(6, 95, 70, 0.3) 100%);
    border-color: #065f46;
}

[data-theme="dark"] .banner-category {
    color: #6ee7b7;
}

[data-theme="dark"] .banner-label {
    color: #34d399;
}

[data-theme="dark"] .info-card {
    background: #182239;
    border-color: #24314c;
}

[data-theme="dark"] .info-card-header {
    border-bottom-color: #24314c;
}

[data-theme="dark"] .field-value.highlight {
    color: #f8fafc;
}

[data-theme="dark"] .field-value.valor-total {
    color: #2dd4bf;
}

[data-theme="dark"] .products-description {
    background: #0f172a;
    border-color: #24314c;
    color: #cbd5e1;
}

[data-theme="dark"] .btn-copy-json,
[data-theme="dark"] .btn-download-json {
    background: #182239;
    border-color: #24314c;
    color: #cbd5e1;
}

[data-theme="dark"] .btn-copy-json:hover,
[data-theme="dark"] .btn-download-json:hover {
    background: #24314c;
    color: #ffffff;
}

[data-theme="dark"] .tag-badge {
    background: #064e3b;
    border-color: #059669;
    color: #6ee7b7;
}

[data-theme="dark"] .login-wrapper {
    background: radial-gradient(circle at 50% 20%, #112433 0%, #0b0f19 75%);
}

[data-theme="dark"] .login-card {
    background: #131b2e;
    border-color: #24314c;
}

[data-theme="dark"] .login-header {
    background: #182239;
    border-bottom-color: #24314c;
}

[data-theme="dark"] .form-control {
    background: #182239;
    border-color: #2d3d5e;
    color: #f8fafc;
}

[data-theme="dark"] .form-control:focus {
    background: #1a253e;
    border-color: var(--primary-color);
}

[data-theme="dark"] .demo-credentials-box {
    background: rgba(6, 78, 59, 0.25);
    border-color: #059669;
    color: #a7f3d0;
}

[data-theme="dark"] .modal-container {
    background: #131b2e;
    border-color: #24314c;
}

[data-theme="dark"] .modal-header {
    background: #182239;
    border-bottom-color: #24314c;
}

[data-theme="dark"] .modal-footer {
    background: #182239;
    border-top-color: #24314c;
}

[data-theme="dark"] .btn-modal-cancel {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .btn-mobile-access {
    background: rgba(6, 78, 59, 0.25);
    border-color: #065f46;
    color: #6ee7b7;
}

[data-theme="dark"] .btn-api-config {
    background: #182239;
    border-color: #24314c;
    color: #cbd5e1;
}

[data-theme="dark"] .qr-code-wrapper {
    background: #ffffff; /* Garante fundo branco para contraste da câmera ao ler QR Code */
}


