/* ═══════════════════════════════════════════════
   RendaFixa Pro - Design System (Premium Vercel Aesthetic)
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-dark: #020617; /* Slate 950 */
    --bg-surface: #0f172a; /* Slate 900 */
    --card-bg: rgba(15, 23, 42, 0.6);
    --card-border: rgba(255, 255, 255, 0.05);
    --card-border-hover: rgba(6, 182, 212, 0.3);

    --accent: #06b6d4; /* Cyan 500 */
    --accent-light: #22d3ee;
    --accent-dark: #0891b2;
    --accent-glow: rgba(6, 182, 212, 0.15);

    --gold: #f59e0b;
    --gold-light: #fbbf24;

    --blue: #3b82f6;
    --blue-light: #60a5fa;

    --purple: #8b5cf6;
    --purple-light: #a78bfa;

    --red: #ef4444;

    --text-main: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-card: 0 4px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

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

html {
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

/* ═══ Backgrounds Premium ═══ */
.bg-grid {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-size: 40px 40px;
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
                      linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
}
.bg-glow-1 { width: 500px; height: 500px; top: -200px; left: -100px; background: rgba(6, 182, 212, 0.1); }
.bg-glow-2 { width: 600px; height: 600px; bottom: -200px; right: -100px; background: rgba(139, 92, 246, 0.08); }
.bg-glow-3 { width: 400px; height: 400px; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(59, 130, 246, 0.05); }

/* ═══ Layout ═══ */
.app-container {
    width: 100%; max-width: 1400px; padding: 2rem;
    display: flex; flex-direction: column; gap: 2.5rem;
    position: relative; z-index: 1; animation: fadeIn 0.8s ease;
}

/* ═══ Header ═══ */
.header {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 2rem; border-bottom: 1px solid var(--card-border);
}
.logo { display: flex; align-items: center; gap: 1rem; }
.logo-icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 0 16px rgba(6, 182, 212, 0.5));
    animation: float 4s ease-in-out infinite;
}
.logo h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.04em; }
.accent-text {
    background: linear-gradient(135deg, var(--accent-light), var(--accent), var(--purple-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.logo p { font-size: 0.9rem; color: var(--text-muted); font-weight: 400; margin-top: 4px; }

.header-status {
    display: flex; align-items: center; gap: 0.6rem;
    font-size: 0.85rem; color: var(--text-secondary);
    padding: 0.5rem 1rem; background: rgba(255, 255, 255, 0.02);
    border-radius: 99px; border: 1px solid var(--card-border);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }

/* ═══ Grids e Panels ═══ */
.main-content { display: grid; grid-template-columns: 1fr 1.2fr; gap: 2rem; align-items: start; }

.panel {
    background: var(--card-bg); border: 1px solid var(--card-border);
    border-radius: var(--radius-xl); padding: 2rem;
    box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 1.5rem;
    backdrop-filter: blur(24px); transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.panel:hover { border-color: rgba(255, 255, 255, 0.1); transform: translateY(-2px); }

.panel-header { display: flex; align-items: center; gap: 1rem; }
.panel-icon {
    font-size: 1.5rem; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(6, 182, 212, 0.02));
    border-radius: var(--radius-md); border: 1px solid rgba(6, 182, 212, 0.2);
}
.panel-header h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; }
.panel-subtitle { font-size: 0.85rem; color: var(--text-muted); }

/* ═══ Drag Zone ═══ */
.upload-zone {
    border: 2px dashed rgba(255, 255, 255, 0.1); border-radius: var(--radius-lg);
    padding: 3rem 1.5rem; display: flex; flex-direction: column; align-items: center; gap: 1rem;
    cursor: pointer; transition: all 0.3s ease; background: rgba(255, 255, 255, 0.01);
}
.upload-zone:hover { border-color: var(--accent); background: rgba(6, 182, 212, 0.03); }
.upload-icon svg { color: var(--accent); opacity: 0.8; transition: transform 0.3s; }
.upload-zone:hover .upload-icon svg { transform: scale(1.1) translateY(-4px); }
.upload-text { font-size: 1rem; font-weight: 500; }
.upload-hint { font-size: 0.8rem; color: var(--text-muted); }

/* ═══ File Badge ═══ */
.file-info {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem; background: rgba(6, 182, 212, 0.05);
    border: 1px solid rgba(6, 182, 212, 0.2); border-radius: var(--radius-md);
}
.file-badge { display: flex; align-items: center; gap: 0.8rem; }
.file-name { font-size: 0.95rem; font-weight: 500; }
.file-size { font-size: 0.8rem; color: var(--accent-light); }
.btn-icon { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; transition: 0.2s; }
.btn-icon:hover { color: var(--red); transform: scale(1.1); }

/* ═══ Toggle Primario Secundario ═══ */
.market-toggle-container {
    display: flex; align-items: center; justify-content: center; gap: 1rem;
    padding: 1.2rem; background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255,255,255,0.05); border-radius: var(--radius-md);
}
.toggle-label { font-size: 0.9rem; font-weight: 500; color: var(--text-muted); transition: 0.3s; }
.toggle-label.active { color: var(--text-main); font-weight: 600; text-shadow: 0 0 12px rgba(255,255,255,0.2); }
.switch { position: relative; display: inline-block; width: 54px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.08); border-radius: 34px; transition: .4s;
    border: 1px solid rgba(255,255,255,0.1);
}
.slider:before {
    position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px;
    background: var(--text-secondary); border-radius: 50%; transition: .4s; box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
input:checked + .slider { background: rgba(6, 182, 212, 0.2); border-color: var(--accent); }
input:checked + .slider:before { transform: translateX(26px); background: var(--accent-light); box-shadow: 0 0 12px var(--accent-glow); }

/* ═══ Botoes ═══ */
.btn {
    padding: 0.85rem 1.5rem; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem;
    cursor: pointer; border: none; transition: all 0.25s ease;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    font-family: 'Outfit', sans-serif;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary { background: rgba(255, 255, 255, 0.05); color: var(--text-main); border: 1px solid rgba(255,255,255,0.1); }
.btn-secondary:not(:disabled):hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255,255,255,0.2); }

.btn-small { padding: 0.5rem 1rem; font-size: 0.85rem; background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); border-radius: var(--radius-sm); border: 1px solid var(--card-border); cursor: pointer; transition: 0.25s; }
.btn-small:not(:disabled):hover { background: rgba(255, 255, 255, 0.1); color: var(--text-main); border-color: var(--card-border-hover); }

/* ═══ Stats Bar ═══ */
.stats-bar { display: flex; gap: 1rem; padding: 1rem; background: rgba(0, 0, 0, 0.3); border-radius: var(--radius-md); border: 1px solid rgba(255,255,255,0.03); }
.stat { flex: 1; text-align: center; }
.stat-value { display: block; font-size: 1.5rem; font-weight: 700; color: var(--accent-light); letter-spacing: -0.02em; }
.stat-label { display: block; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }

/* ═══ Result Display (Rich UI) ═══ */
.result-actions { display: flex; gap: 0.5rem; margin-left: auto; }
.result-container { flex: 1; display: flex; flex-direction: column; }
.result-display {
    flex: 1; min-height: 450px; padding: 1rem; background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-lg); border: 1px solid rgba(255,255,255,0.03);
    overflow-y: auto; display: flex; flex-direction: column; gap: 1rem;
}

.result-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-main);
    white-space: pre-wrap;
    font-family: Consolas, 'Courier New', monospace;
}

/* Rich Cards */
.rich-category-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); padding-bottom: 0.5rem; border-bottom: 1px solid rgba(255,255,255,0.05); margin-top: 0.5rem; }

.rich-card {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05);
    padding: 0.8rem 1rem; border-radius: var(--radius-sm);
    transition: all 0.3s; animation: slideUp 0.4s ease forwards;
}
.rich-card:hover { background: rgba(6, 182, 212, 0.04); border-color: rgba(6, 182, 212, 0.2); transform: scale(1.01); }

.rich-card-left { display: flex; align-items: center; gap: 1rem; }
.rich-badge {
    padding: 0.25rem 0.6rem; font-size: 0.75rem; font-weight: 700; border-radius: 4px;
    letter-spacing: 0.05em; text-transform: uppercase;
}
/* Cores pros Badges */
.badge-pre { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-pos { background: rgba(6, 182, 212, 0.15); color: #67e8f9; border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-ipca { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-isento { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }

.rich-asset-name { font-size: 0.95rem; font-weight: 500; color: var(--text-main); }
.rich-emissor { font-size: 0.8rem; color: var(--text-muted); }
.rich-rate { font-size: 1.1rem; font-weight: 700; color: var(--accent-light); }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 1rem; opacity: 0.6; }
.empty-icon { font-size: 3.5rem; margin-bottom: 0.5rem; filter: grayscale(1); }

/* ═══ History ═══ */
.history-section { margin-top: 1rem; }
.history-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.history-item {
    padding: 1.25rem; background: rgba(0, 0, 0, 0.3); border-radius: var(--radius-md); border: 1px solid rgba(255,255,255,0.05);
    transition: 0.3s; display: flex; flex-direction: column; gap: 0.8rem;
}
.history-item:hover { border-color: rgba(6, 182, 212, 0.3); background: rgba(6, 182, 212, 0.02); }
.history-date { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.history-content pre { font-size: 0.75rem; color: var(--text-muted); white-space: pre-wrap; font-family: 'Outfit', sans-serif; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.history-action-bar { display: flex; justify-content: space-between; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 0.8rem; margin-top: 0.5rem; }

/* ═══ Toast ═══ */
.toast {
    position: fixed; bottom: 2rem; right: 2rem; background: var(--card-bg); border: 1px solid rgba(6, 182, 212, 0.4); backdrop-filter: blur(10px);
    color: var(--text-main); padding: 1rem 2rem; border-radius: 99px; font-weight: 600; font-size: 0.9rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(6, 182, 212, 0.2); z-index: 100; transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.hidden { opacity: 0; transform: translateY(2rem) scale(0.9); pointer-events: none; }
.hidden { display: none !important; }

/* ═══ Utils & Anims ═══ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(6, 182, 212, 0.5); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

@media (max-width: 900px) {
    .main-content { grid-template-columns: 1fr; }
    .history-list { grid-template-columns: 1fr; }
}
