:root {
    /* Premium Color Palette */
    --bg-dark: #000000;
    --bg-surface: #121212;
    --bg-card: #1C1C1E;
    --bg-card-elevated: #2C2C2E;
    
    --text-primary: #FFFFFF;
    --text-secondary: #8E8E93;
    --text-muted: #636366;
    
    --gold-primary: #FFB347;
    --gold-secondary: #FF8A00;
    --gold-gradient: linear-gradient(135deg, #FFB347 0%, #FFCC80 100%);
    
    --blue-primary: #0A84FF;
    --green-positive: #30D158;
    --red-negative: #FF453A;
    
    --border-color: rgba(255, 255, 255, 0.1);
    
    /* Spacing & Borders */
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --border-radius-sm: 8px;
    
    /* Layout */
    --safe-area-top: env(safe-area-inset-top, 44px);
    --safe-area-bottom: env(safe-area-inset-bottom, 34px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden; /* Prevent body scroll, handle in main */
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 500px; /* For desktop viewing */
    margin: 0 auto;
    background-color: var(--bg-dark);
    position: relative;
}

/* Header & balance Card */
.header {
    padding: calc(var(--safe-area-top) + 20px) 20px 20px;
    background: var(--bg-dark);
    z-index: 10;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.user-greeting h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 4px;
}

.profile-pic {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card-elevated);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Premium Gold Card */
.total-balance-card {
    position: relative;
    padding: 24px;
    border-radius: var(--border-radius-lg);
    background: var(--gold-primary);
    color: #FFF;
    box-shadow: 0 10px 30px rgba(255, 138, 0, 0.4);
    overflow: hidden;
}

.balance-label {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.8;
    margin-bottom: 8px;
}

.balance-amount {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.balance-amount .currency {
    font-size: 24px;
    vertical-align: top;
    line-height: 40px;
    margin-right: 4px;
}

.balance-change {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.balance-change.positive {
    background: rgba(48, 209, 88, 0.9);
    color: #FFF;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(48, 209, 88, 0.3);
}

.balance-change.negative {
    background: rgba(255, 69, 58, 0.9);
    color: #FFF;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(255, 69, 58, 0.3);
}

.glow-effect {
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    transform: rotate(45deg);
    pointer-events: none;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px calc(var(--safe-area-bottom) + 20px);
    -webkit-overflow-scrolling: touch;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    justify-content: space-between;
}

.action-btn {
    flex: 1;
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.action-btn:active {
    transform: scale(0.95);
}

.icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
}

.gold-circle {
    background: rgba(255, 215, 0, 0.15);
    color: var(--gold-primary);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.blue-circle {
    background: rgba(10, 132, 255, 0.15);
    color: var(--blue-primary);
    border: 1px solid rgba(10, 132, 255, 0.3);
}

.gray-circle {
    background: var(--bg-card-elevated);
    color: var(--text-primary);
}

/* Market Watch */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background-color: var(--green-positive);
    border-radius: 50%;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.market-status-text {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}
.market-status-text.stale {
    color: var(--red-negative);
}
.market-status-text.live {
    color: var(--green-positive);
}

.market-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    margin: 0 -20px; /* Bleed to edge */
    padding: 0 20px 8px 20px;
}

.market-scroll::-webkit-scrollbar {
    display: none;
}

.market-card {
    min-width: 140px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.3s;
}

.market-card.flash-up {
    background: rgba(48, 209, 88, 0.15);
}

.market-card.flash-down {
    background: rgba(255, 69, 58, 0.15);
}

.market-name {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.market-price {
    font-size: 16px;
    font-weight: 600;
}

.market-change {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.market-change.up { color: var(--green-positive); }
.market-change.down { color: var(--red-negative); }

/* Assets List */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.filter-btn {
    background: var(--bg-card);
    border: none;
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.asset-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-md);
    padding: 16px;
    padding-right: 56px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, background 0.2s ease;
    position: relative;
    overflow: hidden;
}

.asset-card:active {
    transform: scale(0.98);
    background: var(--bg-card-elevated);
}

.asset-content-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

.asset-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.asset-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
}

.gold-icon {
    background: rgba(255, 215, 0, 0.15);
    color: var(--gold-primary);
}

.deposit-icon {
    background: rgba(10, 132, 255, 0.15);
    color: var(--blue-primary);
}

.asset-details h4 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-details p {
    font-size: 13px;
    color: var(--text-secondary);
}

.asset-value {
    text-align: right;
    margin-right: 12px;
}

.asset-value .value {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.asset-value .profit {
    font-size: 13px;
    color: var(--green-positive);
}

.asset-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

@media (hover: none) {
    .asset-actions {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (hover: hover) {
    .asset-card:hover .asset-actions {
        opacity: 1;
        pointer-events: auto;
    }
    
    .asset-actions {
        transform: translateY(-50%) translateX(10px);
    }
    .asset-card:hover .asset-actions {
        transform: translateY(-50%) translateX(0);
    }
}

.edit-asset-btn {
    background: rgba(10, 132, 255, 0.1);
    color: var(--blue-primary);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.edit-asset-btn:active {
    background: rgba(10, 132, 255, 0.25);
}

.delete-asset-btn {
    background: rgba(255, 69, 58, 0.1);
    color: var(--red-negative);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.delete-asset-btn:active {
    background: rgba(255, 69, 58, 0.25);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 40px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Modals */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-surface);
    width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 24px;
    padding-bottom: calc(var(--safe-area-bottom) + 24px);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-top: 1px solid var(--border-color);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: var(--bg-card-elevated);
    border: none;
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.form-group input, .form-group select {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 16px;
    border-radius: var(--border-radius-md);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--gold-primary);
}

.primary-btn {
    width: 100%;
    padding: 16px;
    border-radius: var(--border-radius-md);
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s;
}

.primary-btn:active {
    opacity: 0.8;
}

.gold-btn {
    background: var(--gold-gradient);
    color: #000;
}

.blue-btn {
    background: var(--blue-primary);
    color: #FFF;
}

/* Analytics Chart Styles */
.analytics-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.chart-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.donut-chart {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(var(--bg-card-elevated) 0deg, var(--bg-card-elevated) 360deg);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 1s ease-out;
}

.chart-center {
    width: 156px;
    height: 156px;
    background: var(--bg-surface);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: absolute;
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.5);
}

.chart-center .chart-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.chart-center .chart-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.analytics-legend {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.legend-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-name {
    font-size: 14px;
    font-weight: 500;
}

.legend-percent {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}
