/* ====================================================
   INVESTIMENTOS RAFAEL — Premium Dark Theme v3.0
   ==================================================== */

/* ---------- RESET & BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-deep: #070b15;
    --bg-primary: #0c1425;
    --bg-secondary: #111b2e;
    --bg-card: #162033;
    --bg-card-hover: #1c2a42;
    --bg-elevated: #1e2d48;
    --border: #1e3050;
    --border-light: #2a4068;
    --text-primary: #e8edf5;
    --text-secondary: #8899bb;
    --text-muted: #5a6f94;
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.12);
    --green-border: rgba(34, 197, 94, 0.3);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.12);
    --red-border: rgba(239, 68, 68, 0.3);
    --blue: #3b82f6;
    --blue-bg: rgba(59, 130, 246, 0.12);
    --blue-border: rgba(59, 130, 246, 0.3);
    --gold: #f59e0b;
    --gold-bg: rgba(245, 158, 11, 0.12);
    --gold-border: rgba(245, 158, 11, 0.3);
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-bg: rgba(139, 92, 246, 0.15);
    --accent-border: rgba(139, 92, 246, 0.3);
    --accent-glow: rgba(139, 92, 246, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
}

html { font-size: 16px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent-light); text-decoration: none; transition: color 0.2s; }
a:hover { color: #c4b5fd; }

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ---------- NAVBAR ---------- */
.navbar {
    background: rgba(12, 20, 37, 0.9);
    backdrop-filter: blur(16px) saturate(1.2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary) !important;
    font-weight: 800;
    font-size: 1.1rem;
}
.logo-icon { font-size: 1.3rem; }
.logo-highlight { 
    background: linear-gradient(135deg, var(--accent), #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links { display: flex; gap: 4px; }
.nav-link {
    color: var(--text-secondary);
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-link:hover { color: var(--text-primary); background: var(--accent-bg); }
.nav-link.active { color: var(--accent-light); background: var(--accent-bg); }

.nav-user-section {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}
.nav-user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.nav-user-badge .avatar {
    width: 22px; height: 22px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #c084fc);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.65rem; font-weight: 700; color: white;
}
.nav-btn-login {
    padding: 7px 16px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white !important;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 10px var(--accent-glow);
    transition: all 0.2s;
}
.nav-btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

/* ---------- DASHBOARD BANNER ---------- */
.dash-banner {
    background: linear-gradient(135deg, #1a0547 0%, #2d1b69 30%, #1e0a3c 70%, #0c1425 100%);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.dash-banner::before {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.08), transparent);
    border-radius: 50%;
}
.dash-banner .banner-left { position: relative; z-index: 1; }
.dash-banner .banner-greeting {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}
.dash-banner .banner-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 4px 0;
}
.dash-banner .banner-title span {
    background: linear-gradient(135deg, var(--accent-light), #c084fc, #e879f9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.dash-banner .banner-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.dash-banner .banner-right {
    text-align: right;
    position: relative; z-index: 1;
}
.dash-banner .banner-big-number {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -1px;
}
.dash-banner .banner-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---------- SUMMARY CARDS ---------- */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.summary-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.25s;
}
.summary-card:hover { transform: translateY(-2px); }

/* Card colored left borders */
.summary-card:nth-child(1) { border-left: 3px solid var(--blue); }  /* Patrimonio */
.summary-card:nth-child(2) { border-left: 3px solid var(--green); } /* Lucro */
.summary-card:nth-child(3) { border-left: 3px solid var(--gold); } /* Proventos */
.summary-card:nth-child(4) { border-left: 3px solid var(--accent); } /* Rentabilidade */

.summary-card .sc-icon { font-size: 1.6rem; margin-bottom: 8px; }
.summary-card .sc-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    margin-bottom: 6px;
}
.summary-card .sc-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}
.summary-card .sc-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.positive { color: var(--green); }
.negative { color: var(--red); }

/* ---------- SECTION HEADER ---------- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.section-title {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}
.section-link {
    font-size: 0.8rem;
    color: var(--accent-light);
    font-weight: 500;
}

/* ---------- PATRIMONY SECTION ---------- */
.patrimony-section {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
    margin-bottom: 28px;
}
.ps-left, .ps-right {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

/* ---------- ALLOCATION BAR ---------- */
.alloc-bar-container {
    width: 100%; height: 10px;
    background: var(--bg-primary);
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    margin: 12px 0;
}
.alloc-bar-segment { height: 100%; transition: all 0.3s; }
.alloc-bar-segment:first-child { border-radius: 5px 0 0 5px; }
.alloc-bar-segment:last-child { border-radius: 0 5px 5px 0; }
.alloc-bar-segment:hover { opacity: 0.8; transform: scaleY(1.4); }

/* ---------- TABLE ---------- */
.table-container {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table { width: 100%; border-collapse: collapse; }
thead {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(59, 130, 246, 0.05));
}
thead th {
    text-align: left;
    padding: 13px 16px;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
tbody td {
    padding: 11px 16px;
    font-size: 0.84rem;
    border-bottom: 1px solid rgba(30, 48, 80, 0.3);
    vertical-align: middle;
}
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(139, 92, 246, 0.04); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- ASSET TYPE BADGES ---------- */
.asset-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.asset-badge.acao { background: var(--blue-bg); color: var(--blue); }
.asset-badge.fii { background: var(--green-bg); color: var(--green); }
.asset-badge.bdr { background: var(--gold-bg); color: var(--gold); }
.asset-badge.etf { background: var(--accent-bg); color: var(--accent-light); }

/* ---------- TRANSACTION BADGES ---------- */
.badge-compra {
    display: inline-block;
    background: var(--green-bg);
    color: var(--green);
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid var(--green-border);
}
.badge-venda {
    display: inline-block;
    background: var(--red-bg);
    color: var(--red);
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid var(--red-border);
}

/* ---------- VALUE COLORS ---------- */
.value-positive { color: var(--green); }
.value-negative { color: var(--red); }
.change-positive { color: var(--green); font-weight: 600; }
.change-negative { color: var(--red); font-weight: 600; }

/* ---------- BUTTONS ---------- */
.btn-primary {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: 20px;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 2px 10px var(--accent-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}
.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 9px 20px;
    border-radius: 20px;
    font-size: 0.83rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}
.btn-secondary:hover { border-color: var(--border-light); color: var(--text-primary); }
.btn-icon {
    background: transparent; border: none; cursor: pointer;
    font-size: 1rem; padding: 5px 8px; border-radius: 6px;
    transition: all 0.2s; opacity: 0.5;
}
.btn-icon:hover { opacity: 1; background: var(--accent-bg); }

/* ---------- AUTH PAGES ---------- */
.auth-wrapper {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-deep);
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #c084fc, var(--accent));
}
.auth-card h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: 4px; text-align: center; }
.auth-card h1 .highlight {
    background: linear-gradient(135deg, var(--accent), #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-card .subtitle {
    color: var(--text-muted); font-size: 0.85rem;
    text-align: center; margin-bottom: 28px;
}
.auth-card .form-group { margin-bottom: 16px; }
.auth-card .form-group label {
    font-size: 0.8rem; color: var(--text-secondary);
    font-weight: 500; margin-bottom: 5px; display: block;
}
.auth-card .form-group input {
    width: 100%; background: var(--bg-primary);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 11px 14px; color: var(--text-primary);
    font-size: 0.88rem; outline: none; transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}
.auth-card .form-group input:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg);
}
.auth-card .btn-primary { width: 100%; padding: 12px; font-size: 0.9rem; margin-top: 6px; }
.auth-card .auth-link {
    text-align: center; margin-top: 18px;
    font-size: 0.83rem; color: var(--text-muted);
}
.auth-card .auth-link a { color: var(--accent-light); font-weight: 600; }
.auth-card .error-msg {
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    color: var(--red); padding: 10px 14px;
    border-radius: var(--radius-sm); font-size: 0.8rem;
    margin-bottom: 14px; text-align: center;
}

/* ---------- MODAL ---------- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.65);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.25s ease;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-body { padding: 20px 24px; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ---------- FORMS ---------- */
.form-row {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 14px; margin-bottom: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
    font-size: 0.8rem; color: var(--text-secondary); font-weight: 500;
}
.form-group input, .form-group select {
    background: var(--bg-primary);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 10px 14px; color: var(--text-primary);
    font-size: 0.85rem; outline: none; transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg);
}

.type-selector { display: flex; gap: 8px; }
.type-btn {
    flex: 1; padding: 10px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: transparent; color: var(--text-secondary);
    cursor: pointer; font-size: 0.82rem; font-weight: 500;
    transition: all 0.25s; font-family: 'Inter', sans-serif;
}
.type-btn.active[data-value="buy"] {
    background: var(--green-bg); color: var(--green);
    border-color: var(--green-border);
    box-shadow: 0 0 12px var(--green-glow);
}
.type-btn.active[data-value="sell"] {
    background: var(--red-bg); color: var(--red);
    border-color: var(--red-border);
    box-shadow: 0 0 12px var(--red-glow);
}

/* ---------- CARTEIRA SUB-NAV ---------- */
.carteira-subnav {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 24px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
}
.carteira-subnav a {
    flex: 1;
    padding: 11px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.83rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.25s;
    white-space: nowrap;
    text-decoration: none;
}
.carteira-subnav a:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.carteira-subnav a.active {
    background: linear-gradient(135deg, var(--accent-bg), rgba(139,92,246,0.05));
    color: var(--accent-light);
    font-weight: 600;
    box-shadow: 0 1px 8px var(--accent-glow);
}
.carteira-subnav a .tab-icon { margin-right: 6px; }

/* ---------- PROGRESS BAR ---------- */
.progress-bar-bg {
    width: 60px; height: 5px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ---------- FOOTER ---------- */
.footer {
    margin-top: 64px; padding: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.footer-content {
    max-width: 1280px; margin: 0 auto;
    font-size: 0.8rem; color: var(--text-muted);
}
.footer-disclaimer {
    margin-top: 6px; font-size: 0.7rem; opacity: 0.6;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .nav-container { padding: 0 12px; }
    .nav-links { display: none; }
    .summary-cards { grid-template-columns: 1fr 1fr; }
    .patrimony-section { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .dash-banner { flex-direction: column; text-align: center; gap: 12px; }
    .dash-banner .banner-right { text-align: center; }
}

/* ---------- MISC ---------- */
.empty-state {
    text-align: center; padding: 64px 24px; color: var(--text-muted);
}
.empty-state .big-icon { font-size: 3rem; margin-bottom: 16px; display: block; }

.loading { text-align: center; padding: 32px; color: var(--text-muted); }
@keyframes pulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }
.loading::after { content: "Carregando..."; animation: pulse 1.5s ease-in-out infinite; }
