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

:root {
    --primary-color: #00e5ff;
    --secondary-color: #b388ff;
    --background-color: #050a18;
    --card-background: rgba(10, 20, 40, 0.6);
    --text-color: #e0e8f0;
    --text-secondary-color: #8899aa;
    --shadow-color: rgba(0, 229, 255, 0.3);
}

* { box-sizing: border-box; }

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(180deg, #050a18 0%, #0a1628 40%, #0d1a30 70%, #050a18 100%);
    color: var(--text-color);
    margin: 0;
    padding: 56px 20px 40px;
    min-height: 100vh;
}

.top-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: rgba(5, 10, 24, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 229, 255, 0.1);
    z-index: 100;
}

.nav-left {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary-color);
    letter-spacing: 1px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link {
    font-size: 0.85rem;
    color: var(--text-color);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: rgba(0, 229, 255, 0.1);
    color: var(--primary-color);
}

.nav-user {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
}

.nav-btn {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--text-secondary-color);
    background: transparent;
    color: var(--text-secondary-color);
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn:hover {
    border-color: #ff5555;
    color: #ff5555;
    background: rgba(255, 85, 85, 0.1);
}

.portfolio-container {
    max-width: 900px;
    margin: 0 auto;
}

.portfolio-header h1 {
    font-size: 2rem;
    color: var(--primary-color);
    text-shadow: 0 0 12px var(--shadow-color);
    margin: 0 0 20px;
}

.portfolio-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.summary-card {
    background: var(--card-background);
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.summary-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.summary-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-color);
}

/* Pie Chart */
.chart-section {
    margin-bottom: 40px;
}

.chart-section h2 {
    font-size: 1.1rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.chart-wrapper {
    display: flex;
    align-items: center;
    gap: 40px;
    background: var(--card-background);
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: 14px;
    padding: 30px;
    backdrop-filter: blur(10px);
}

.pie-chart-container {
    position: relative;
    flex-shrink: 0;
}

.pie-chart {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: #1a2332;
    position: relative;
}

.pie-chart::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #0a1628;
}

.pie-center-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    color: var(--text-secondary-color);
    font-weight: 600;
    z-index: 1;
    pointer-events: none;
}

.chart-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-label {
    color: var(--text-color);
    font-weight: 600;
    min-width: 80px;
}

.legend-pct {
    color: var(--primary-color);
    font-weight: 600;
    min-width: 50px;
    text-align: right;
}

.legend-val {
    color: var(--text-secondary-color);
    min-width: 100px;
    text-align: right;
}

/* Cash separate bar */
.chart-cash-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
    padding: 14px 24px;
    background: rgba(74, 85, 104, 0.15);
    border: 1px solid rgba(74, 85, 104, 0.3);
    border-radius: 12px;
}

.cash-icon {
    font-size: 1.3rem;
}

.cash-label {
    font-weight: 700;
    color: var(--text-color);
    font-size: 0.95rem;
}

.cash-amount {
    font-weight: 700;
    color: #facc15;
    font-size: 1.05rem;
    margin-left: auto;
}

.cash-pct {
    color: var(--text-secondary-color);
    font-size: 0.8rem;
    min-width: 100px;
    text-align: right;
}

.holdings-section, .tx-section {
    margin-bottom: 40px;
}

.holdings-section h2, .tx-section h2 {
    font-size: 1.1rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.holdings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.holding-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    align-items: center;
    background: var(--card-background);
    border: 1px solid rgba(0, 229, 255, 0.1);
    border-radius: 12px;
    padding: 16px 20px;
    backdrop-filter: blur(10px);
}

.holding-name {
    font-weight: 600;
    color: var(--text-color);
}

.holding-name small {
    color: var(--text-secondary-color);
    font-weight: 400;
    margin-left: 6px;
}

.holding-amount, .holding-value, .holding-pnl {
    text-align: right;
    font-size: 0.9rem;
}

.holding-pnl.positive { color: #00ff7f; }
.holding-pnl.negative { color: #ff5555; }

.tx-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tx-row {
    display: grid;
    grid-template-columns: 80px 2fr 1fr 1fr;
    align-items: center;
    padding: 12px 16px;
    background: var(--card-background);
    border-radius: 10px;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.tx-type {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 6px;
    text-align: center;
    width: fit-content;
}

.tx-type.buy {
    background: rgba(0, 229, 255, 0.15);
    color: var(--primary-color);
}

.tx-type.sell {
    background: rgba(255, 85, 85, 0.15);
    color: #ff5555;
}

.tx-coin { color: var(--text-color); }
.tx-amount { text-align: right; color: var(--text-secondary-color); }
.tx-date { text-align: right; color: var(--text-secondary-color); font-size: 0.8rem; }

.empty-msg {
    color: var(--text-secondary-color);
    text-align: center;
    padding: 30px;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .portfolio-summary { grid-template-columns: 1fr; }
    .chart-wrapper { flex-direction: column; gap: 20px; }
    .pie-chart { width: 180px; height: 180px; }
    .pie-chart::after { width: 90px; height: 90px; }
    .holding-row { grid-template-columns: 1fr 1fr; gap: 8px; }
    .tx-row { grid-template-columns: 1fr 1fr; gap: 4px; }
}
