/* Four Reserves - Precious Metals Dashboard */
/* Font: DM Sans | Primary Color: #DF9D0E */

:root {
    --primary: #DF9D0E;
    --primary-dark: #B87D0A;
    --primary-light: #F5B82E;
    --primary-glow: rgba(223, 157, 14, 0.3);
    
    --bg-dark: #0A0A0B;
    --bg-card: #111113;
    --bg-elevated: #1A1A1D;
    --bg-hover: #222225;
    
    --text-primary: #FAFAFA;
    --text-secondary: #A0A0A5;
    --text-muted: #606065;
    
    --positive: #22C55E;
    --negative: #EF4444;
    --positive-bg: rgba(34, 197, 94, 0.1);
    --negative-bg: rgba(239, 68, 68, 0.1);
    
    --border: #2A2A2D;
    --border-light: #3A3A3D;
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 4px 12px rgba(223, 157, 14, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, var(--primary-glow), transparent),
        radial-gradient(circle at 20% 80%, rgba(223, 157, 14, 0.05), transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(223, 157, 14, 0.05), transparent 40%);
    pointer-events: none;
    z-index: -1;
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(17, 17, 19, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-text {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.logo-text sub {
    font-size: 1.2rem;
    vertical-align: baseline;
    position: relative;
    bottom: -0.2em;
    color: var(--text-primary);
}

.logo-text.small {
    font-size: 1.5rem;
}

.logo-text.small sub {
    font-size: 0.9rem;
}

nav {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.nav-title {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(223, 157, 14, 0.1);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.twitter-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--primary);
    background: rgba(223, 157, 14, 0.1);
    border: 1px solid rgba(223, 157, 14, 0.3);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    text-decoration: none;
}

.twitter-link:hover {
    color: var(--bg-dark);
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.twitter-link svg {
    width: 20px;
    height: 20px;
}

/* Main Content */
main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

/* Contract Address Section */
.contract-address-section {
    margin-bottom: 2rem;
}

.contract-address-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.2s ease;
}

.contract-address-box:hover {
    border-color: var(--border-light);
}

.contract-label {
    flex-shrink: 0;
}

.contract-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.contract-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.contract-input {
    flex: 1;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-family: 'DM Sans', monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
}

.contract-input:focus {
    outline: none;
    border-color: var(--primary);
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--primary);
    color: var(--bg-dark);
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.copy-btn:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-btn svg {
    width: 16px;
    height: 16px;
}

.copy-btn.copied {
    background: var(--positive);
    color: var(--bg-dark);
}

.copy-btn.copied .copy-text::after {
    content: '✓';
    margin-left: 0.25rem;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.stat-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.stat-badge {
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    background: var(--primary);
    color: var(--bg-dark);
    border-radius: var(--radius-sm);
    letter-spacing: 0.05em;
}

.hl-badge {
    background: linear-gradient(135deg, #00D4AA, #00A388);
}

.sol-badge {
    background: linear-gradient(135deg, #9945FF, #14F195);
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-value.positive {
    color: var(--positive);
}

.stat-value.negative {
    color: var(--negative);
}

/* P&L Breakdown */
.stat-breakdown {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}

.metal-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    image-rendering: pixelated;
}

.breakdown-label {
    font-size: 0.85rem;
    color: var(--text-primary);
    flex: 1;
    font-weight: 500;
}

.breakdown-value {
    font-size: 0.9rem;
    font-weight: 600;
}

.breakdown-value.positive {
    color: var(--positive);
}

.breakdown-value.negative {
    color: var(--negative);
}

/* Wallet Details */
.wallet-details,
.fees-details {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
}

.wallet-row,
.fees-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 0.625rem 0.75rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}

.wallet-row span:first-child,
.fees-row span:first-child {
    color: var(--text-secondary);
}

.wallet-row span:last-child,
.fees-row span:last-child {
    font-weight: 600;
}

/* Positions Section */
.positions-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.positions-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.positions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.position-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.position-item:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.position-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.position-coin-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.position-coin {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.position-side {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.position-side.long {
    background: var(--positive-bg);
    color: var(--positive);
}

.position-side.short {
    background: var(--negative-bg);
    color: var(--negative);
}

.position-pnl-main {
    text-align: right;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.position-pnl-percent {
    font-size: 0.75rem;
    opacity: 0.8;
    font-weight: 500;
}

.position-details {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.position-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
}

.position-row span:first-child {
    color: var(--text-secondary);
}

.position-row span:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

.no-positions {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 1rem;
    font-style: italic;
}

/* Wallet Input */
.wallet-input-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.wallet-input-group input {
    flex: 1;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.wallet-input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.wallet-input-group input::placeholder {
    color: var(--text-muted);
}

.wallet-input-group button {
    padding: 0.75rem 1.25rem;
    background: var(--primary);
    color: var(--bg-dark);
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wallet-input-group button:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.wallet-input-group button:active {
    transform: translateY(0);
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s ease;
}

.chart-container:hover {
    border-color: var(--border-light);
}

.chart-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.chart-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
}

.chart-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
    color: var(--text-primary);
}

.chart-header h3 .symbol {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.price-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.current-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.price-change {
    font-size: 0.75rem;
    font-weight: 600;
}

.price-change.positive {
    color: var(--positive);
}

.price-change.negative {
    color: var(--negative);
}

.tradingview-widget {
    height: 350px;
    min-height: 350px;
    background: var(--bg-dark);
}

.tradingview-widget iframe {
    width: 100% !important;
    height: 100% !important;
}

.tradingview-widget-container {
    height: 100% !important;
    width: 100% !important;
}

.tradingview-widget-container__widget {
    height: 100% !important;
    width: 100% !important;
}

.tradingview-widget-copyright {
    display: none !important;
}

.tradingview-widget-container {
    height: 100%;
}

/* Loading Shimmer */
.loading-shimmer {
    background: linear-gradient(90deg, 
        var(--bg-elevated) 25%, 
        var(--bg-hover) 50%, 
        var(--bg-elevated) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Footer */
footer {
    margin-top: 3rem;
    padding: 2rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.footer-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    header {
        padding: 1rem;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .nav-title {
        display: none;
    }
    
    main {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-breakdown {
        grid-template-columns: 1fr;
    }
    
    .chart-header {
        flex-wrap: wrap;
    }
    
    .price-display {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        margin-top: 0.5rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Selection */
::selection {
    background: var(--primary);
    color: var(--bg-dark);
}

