:root {
    --bg-dark: #0a0a0c;
    --card-bg: rgba(20, 22, 28, 0.7);
    --gold: #D4AF37;
    --gold-dim: #AA8C2C;
    --emerald: #2ecc71;
    --ruby: #e74c3c;
    --green: var(--emerald);
    --red: var(--ruby);
    --accent: #00f3ff;
    --text-main: #f0f0f5;
    --text-dim: #95a5a6;
    --glass-border: rgba(255, 255, 255, 0.08);
}

body {
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 0% 0%, rgba(212, 175, 55, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(46, 204, 113, 0.05) 0%, transparent 40%);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    margin: 0;
    overflow-x: hidden;
    min-height: 100vh;
}

/* TICKER */
.ticker-wrap {
    width: 100%;
    background: #000;
    height: 30px;
    overflow: hidden;
    white-space: nowrap;
    border-bottom: 1px solid var(--gold-dim);
}

.ticker {
    display: inline-block;
    padding-left: 100%;
    animation: ticker 30s linear infinite;
}

.ticker-item {
    display: inline-block;
    padding: 0 2rem;
    font-size: 0.9rem;
    color: var(--text-main);
}

@keyframes ticker {
    0% {
        transform: translate3d(0, 0, 0);
    }

    100% {
        transform: translate3d(-100%, 0, 0);
    }
}

/* CONTAINER & LAYOUT */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    padding-bottom: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-area i {
    font-size: 2rem;
    color: var(--gold);
}

h1 {
    font-weight: 300;
    font-size: 1.8rem;
    margin: 0;
}

.gold {
    color: var(--gold);
    font-weight: 700;
}

/* NAV TABS */
.main-nav {
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px;
    border-radius: 30px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.nav-tab {
    background: none;
    border: none;
    color: var(--text-dim);
    padding: 8px 20px;
    cursor: pointer;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.3s;
}

.nav-tab.active {
    background: var(--gold);
    color: #000;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

/* BENCHMARK HEADER (NEW) */
.benchmark-row {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
    color: var(--text-dim);
}

.bench-item span {
    color: var(--gold);
    font-weight: 700;
    margin-left: 5px;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 30px;
}

.stat-box {
    text-align: right;
}

.stat-box .label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

.stat-box .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}


.btn-sync,
.btn-privacy,
.btn-pdf,
.btn-config {
    background: none;
    border: 1px solid var(--green);
    color: var(--green);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-privacy {
    border-color: var(--gold);
    color: var(--gold);
}

.btn-pdf {
    border-color: #e74c3c;
    color: #e74c3c;
}

.btn-config {
    border-color: var(--text-dim);
    color: var(--text-dim);
}

.btn-sync.spinning i {
    animation: fa-spin 1s linear infinite;
}

@keyframes fa-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.btn-sync:hover {
    background: rgba(46, 204, 113, 0.15);
    border-color: var(--green);
    color: var(--green);
    transform: scale(1.1);
}

.btn-privacy:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--gold);
    color: var(--gold);
    transform: scale(1.1);
}

.btn-pdf:hover {
    background: rgba(231, 76, 60, 0.15);
    border-color: var(--red);
    color: var(--red);
    transform: scale(1.1);
}

.btn-config:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--gold);
    color: var(--gold);
    transform: scale(1.1);
}

/* TAB CONTENT */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* FILTERS */
.filters-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    padding: 6px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.3s;
}

.filter-btn.active {
    background: var(--gold);
    color: #000;
    border-color: var(--gold);
}

.filter-btn:hover:not(.active) {
    border-color: var(--gold);
    color: var(--text-main);
}

/* ASSET GRID & CARDS */
.assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.asset-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
}

.asset-card.has-signal {
    border: 1px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(212, 175, 55, 0.1);
}

.signal-badge {
    display: inline-block;
    background: var(--gold);
    color: #000;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
    animation: pulse-gold 2s infinite;
    z-index: 20;
    pointer-events: none;
    margin-top: 5px;
}

.signal-badge.negative {
    background: #e74c3c;
    color: #fff;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.4);
    animation: none;
}

.signal-badge.positive {
    background: #2ecc71;
    color: #fff;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.4);
}

.fallback-badge {
    font-size: 0.6rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes pulse-gold {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.asset-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    border-color: var(--gold-dim);
}

.asset-card.positive {
    border-left: 4px solid var(--green);
}

.asset-card.negative {
    border-left: 4px solid var(--red);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.card-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.card-header .price {
    font-size: 1.1rem;
    font-weight: 300;
}

.sparkline-container {
    height: 40px;
    margin: 10px 0;
    position: relative;
}

.sparkline-container canvas {
    width: 100%;
    height: 100%;
}

.variation {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.positive .variation {
    color: var(--green);
}

.negative .variation {
    color: var(--red);
}

.my-position {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.pos-row {
    display: flex;
    justify-content: space-between;
    color: var(--text-dim);
    margin-bottom: 5px;
}

.pos-result {
    text-align: right;
    font-weight: 700;
}

.profit-gain {
    color: var(--emerald);
}

.profit-loss {
    color: var(--ruby);
}

/* JARVIS PULSE */
.pulse {
    animation: jarvisPulse 2.0s infinite ease-in-out;
}

@keyframes jarvisPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
        filter: drop-shadow(0 0 10px var(--accent));
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.card-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 15px;
    padding-top: 10px;
    text-align: right;
}

.card-footer button {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1rem;
}

/* DIVIDEND CHART */
.dividend-chart-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid rgba(212, 175, 55, 0.1);
    height: 250px;
}

/* DIVIDENDS SECTION */
.div-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.div-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.div-stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.1);
    text-align: center;
}

/* CHART MODAL EXPANDED (NEW v5.0) */
.chart-modal-content {
    max-width: 900px !important;
    width: 95% !important;
}

.expanded-chart-container {
    width: 100%;
    height: 400px;
    margin: 20px 0;
    position: relative;
}

.asset-card {
    cursor: pointer;
}

.asset-card button {
    cursor: default;
    /* Revert cursor for footer buttons */
}

/* ALLOCATION SECTION (NEW v4.0) */
.allocation-container {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    animation: fadeIn 0.5s ease;
}

.allocation-chart {
    width: 180px;
    height: 180px;
}

.allocation-info {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
}

.legend-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.legend-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.legend-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

/* PRIVACY MODE (NEW v4.0) */
.privacy-active .value,
.privacy-active .price,
.privacy-active .pos-result,
.privacy-active .legend-value,
.privacy-active .legend-sub,
.privacy-active .total-row span:last-child {
    filter: blur(8px);
    transition: filter 0.3s;
    user-select: none;
}

.privacy-active .btn-privacy {
    background: var(--gold) !important;
    color: #000 !important;
}

.privacy-active .expanded-chart-container {
    filter: blur(15px);
    pointer-events: none;
}

/* PDF EXPORT STYLES (Print) */
@media print {

    .btn-sync,
    .btn-privacy,
    .btn-pdf,
    .btn-config,
    .filters-bar,
    .card-footer {
        display: none !important;
    }

    .main-container {
        padding: 0 !important;
        margin: 0 !important;
    }

    .asset-card {
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}

.div-stat-card .label {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.div-stat-card .value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gold);
    margin-top: 5px;
}

.div-list-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow-x: auto;
}

.div-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.div-table th {
    text-align: left;
    padding: 15px;
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.div-table td {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-delete {
    background: none;
    border: none;
    color: var(--red);
    cursor: pointer;
    opacity: 0.6;
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #1a1c21;
    padding: 30px;
    border: 1px solid var(--gold);
    border-radius: 12px;
    width: 320px;
    text-align: center;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.2);
}

.backup-section h3 {
    font-size: 0.9rem;
    color: var(--gold);
    margin-bottom: 10px;
    text-transform: uppercase;
}

.modal-content input,
.modal-content select {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    margin: 10px 0;
    background: #0f1115;
    border: 1px solid #333;
    color: white;
    border-radius: 5px;
    font-family: inherit;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    gap: 10px;
}

.modal-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.btn-primary {
    background: var(--gold);
    color: #000;
}

.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    font-size: 1.2rem;
    color: var(--gold);
}

.error {
    grid-column: 1 / -1;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid var(--red);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}