/* ═══════════════════════════════════════════════════════════════════════════
   LogísticaEditor — Design System v2.0
   Estilo: Premium Dark Mode / Glassmorphism
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --font-sans: 'Outfit', 'Inter', sans-serif;
    --font-mono: 'Fira Code', 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    background-image: radial-gradient(circle at 2px 2px, #1e293b 1px, transparent 0);
    background-size: 40px 40px;
    -webkit-font-smoothing: antialiased;
}

/* ── Orbs de Fundo ───────────────────────────────────────────────────────── */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: -1;
    opacity: 0.5;
}
.orb-1 { width: 500px; height: 500px; background: rgba(99, 102, 241, 0.15); top: -100px; left: -100px; }
.orb-2 { width: 400px; height: 400px; background: rgba(245, 158, 11, 0.1); bottom: -100px; right: -100px; }
.orb-3 { width: 300px; height: 300px; background: rgba(16, 185, 129, 0.05); top: 40%; left: 30%; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand { display: flex; align-items: center; gap: 1rem; }
.brand-icon { 
    background: var(--primary); 
    padding: 0.5rem; 
    border-radius: 10px; 
    display: flex; 
    color: white; 
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.brand-name { font-size: 1.3rem; font-weight: 600; color: var(--primary); }
.brand-sub { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.header-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.header-badge.loading { color: var(--warning); background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.2); }
.header-badge.error { color: var(--danger); background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.2); }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.app-main {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.card-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.card-icon { color: var(--primary); }
.card-title { font-size: 1.2rem; font-weight: 600; }
.card-desc { font-size: 0.85rem; color: var(--text-muted); }

/* ── Forms & Inputs ─────────────────────────────────────────────────────── */
.input-group { margin-bottom: 1.5rem; }
.input-label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); margin-bottom: 0.5rem; }
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-field {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: white;
    font-family: inherit;
    transition: all 0.2s;
}
.input-field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); }
.input-suffix { position: absolute; right: 1rem; color: var(--text-muted); font-size: 0.8rem; pointer-events: none; }

.search-form { display: flex; gap: 1rem; align-items: flex-end; }

/* ── Botoes ─────────────────────────────────────────────────────────────── */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    justify-content: center;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: white; }

/* ── NF Info Bar ────────────────────────────────────────────────────────── */
.nf-info-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    background: rgba(255,255,255,0.03);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}
.nf-info-item { display: flex; flex-direction: column; gap: 0.25rem; }
.nf-info-label { font-size: 0.7rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.05em; }
.nf-info-value { font-size: 1rem; font-weight: 600; }
.mono { font-family: var(--font-mono); color: var(--primary); }

/* ── Field Rows ─────────────────────────────────────────────────────────── */
.field-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1.5rem;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.field-row:last-of-type { border-bottom: none; }
.field-prev { display: flex; flex-direction: column; gap: 0.25rem; }
.field-prev-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.field-prev-value { font-size: 0.85rem; font-family: var(--font-mono); opacity: 0.7; }

/* ── Overlays ───────────────────────────────────────────────────────────── */
.login-overlay, .confirm-overlay {
    position: fixed; inset: 0;
    background: var(--bg);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000; padding: 1.5rem;
}
.login-card, .confirm-dialog {
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* ── Toasts ─────────────────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 2rem; right: 2rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.75rem; }
.toast {
    padding: 1rem 1.5rem; border-radius: 12px; background: var(--card-bg); backdrop-filter: blur(12px);
    border: 1px solid var(--border); color: white; display: flex; flex-direction: column; gap: 0.25rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3); min-width: 280px;
    animation: slideIn 0.3s ease-out;
}
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-title { font-weight: 700; font-size: 0.9rem; }
.toast-body { font-size: 0.85rem; color: var(--text-muted); }

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

/* ── Responsividade ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .field-row { grid-template-columns: 1fr; gap: 0.5rem; }
    .search-form { flex-direction: column; align-items: stretch; }
    .header-inner { padding: 1rem; }
    .brand-sub { display: none; }
}
