:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --success: #22c55e;
    --error: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: blur(80px);
}

.blob {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    opacity: 0.4;
    animation: move 20s infinite alternate;
}

.blob-1 {
    background: #4f46e5;
    top: -100px;
    left: -100px;
}

.blob-2 {
    background: #7c3aed;
    bottom: -100px;
    right: -100px;
    width: 500px;
    height: 500px;
    animation-duration: 25s;
}

.blob-3 {
    background: #2563eb;
    top: 40%;
    left: 30%;
    width: 300px;
    height: 300px;
    animation-duration: 30s;
}

@keyframes move {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(50px, 100px) scale(1.1);
    }
}

.container {
    width: 90%;
    max-width: 1000px;
    padding: 2rem 0;
    z-index: 1;
}

header {
    margin-bottom: 2.5rem;
    text-align: center;
}

header h1 {
    font-size: 3rem;
    font-weight: 600;
    background: linear-gradient(to right, #818cf8, #c084fc);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-dim);
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
}

main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* Summary Banner */
.summary-banner {
    display: flex;
    justify-content: space-evenly;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
}

.summary-banner .summary-item .label {
    font-size: 1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 500;
}

.summary-banner .summary-item .value {
    font-size: 2.5rem;
    background: linear-gradient(to right, #f8fafc, #818cf8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(129, 140, 248, 0.2));
}

#dayChange.value {
    -webkit-text-fill-color: initial;
    background: none;
    background-clip: initial;
    -webkit-background-clip: initial;
}

/* Controls */
.controls {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: fit-content;
}

/* Gold Prices Display */
.gold-prices-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.05));
    border-radius: 12px;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Crypto Prices Display */
.crypto-prices-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(124, 58, 237, 0.05));
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.price-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.price-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.price-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f59e0b;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

input,
select {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: white;
    outline: none;
    transition: all 0.3s ease;
    width: 100%;
    color-scheme: dark;
    /* Styles default date picker and scrollbars for dark mode */
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

select option {
    background-color: var(--bg-dark);
    color: white;
}

button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.portfolio-list {
    max-height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.5rem;
}

.portfolio-list::-webkit-scrollbar {
    width: 6px;
}

.portfolio-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.asset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.asset-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.asset-ticker {
    font-weight: 600;
}

.asset-amount {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.asset-roi {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--success);
}

.roi-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-right: 4px;
}

.remove-btn {
    background: transparent;
    color: var(--text-dim);
    padding: 0.4rem;
    border-radius: 8px;
    cursor: pointer;
}

.remove-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    transform: none;
}

/* Chart */
.chart-container {
    padding: 1.5rem;
    position: relative;
    min-height: 450px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.timeframes {
    display: flex;
    gap: 0.5rem;
}

.timeframes button {
    background: transparent;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border: 1px solid var(--glass-border);
}

.timeframes button.active {
    background: var(--primary);
    border-color: var(--primary);
}

.canvas-wrapper {
    width: 100%;
}

.canvas-wrapper.main-chart {
    height: 350px;
}

.canvas-wrapper.side-chart {
    height: 400px;
}

/* Legend Styles */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-info {
    display: flex;
    flex-direction: column;
}

.legend-label {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.legend-value {
    font-size: 1rem;
    font-weight: 600;
}

.distribution-container {
    margin-top: 0;
    padding: 1.5rem;
    width: 100%;
}

/* Loader */
.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--glass-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    z-index: 10;
}

.hidden {
    display: none !important;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Footer */
.glass-footer {
    padding: 2rem;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.summary-item {
    text-align: center;
}

.summary-item .label {
    display: block;
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.summary-item .value {
    font-size: 1.5rem;
    font-weight: 600;
}

#dayChange.pos {
    color: var(--success);
}

#dayChange.neg {
    color: var(--error);
}

.breakdown-container {
    padding: 1.5rem;
}

@media (max-width: 900px) {
    .summary-banner {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }

    .summary-banner .summary-item .value {
        font-size: 2rem;
    }
}

/* Asset Filter Buttons */
.asset-filter {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}

.filter-btn:hover {
    transform: translateY(0);
    background: rgba(99, 102, 241, 0.2);
}

.expense.gold-prices-display,
.crypto-prices-display {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Expense Breakdown */
.expense-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin: 0.5rem 0;
}

.expense-label {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

/* Edit Button */
.edit-btn {
    background: transparent;
    color: var(--text-dim);
    padding: 0.4rem;
    border-radius: 8px;
    cursor: pointer;
    margin-right: 0.25rem;
}

.edit-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    transform: none;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    background: transparent;
    color: var(--text-dim);
    padding: 0.5rem;
    font-size: 1.5rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--error);
    transform: none;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
    justify-content: flex-end;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-primary {
    background: var(--primary);
}

/* Performance Indicator */
.asset-performance {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.asset-performance.positive {
    color: var(--success);
}

.asset-performance.negative {
    color: var(--error);
}

.asset-performance.neutral {
    color: var(--text-dim);
}

/* Asset Details Expanded */
.asset-details {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
    color: var(--text-dim);
}

.asset-details-row {
    display: flex;
    justify-content: space-between;
    margin: 0.25rem 0;
}


/* Tabs Navigation */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateY(-2px);
}

.tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Input Panels */
.input-panel {
    display: none;
    animation: slideDown 0.4s ease;
}

.input-panel.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Market Tickers */
.market-ticker-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.ticker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.ticker-item.gold {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.05));
    border-color: rgba(245, 158, 11, 0.2);
}

.ticker-item.crypto {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(124, 58, 237, 0.05));
    border-color: rgba(99, 102, 241, 0.2);
}

.ticker-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.ticker-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.ticker-item.gold .ticker-value {
    color: #f59e0b;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.ticker-item.crypto .ticker-value {
    background: linear-gradient(to right, #818cf8, #c084fc);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 5px rgba(129, 140, 248, 0.2));
}