/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    touch-action: manipulation;
}

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

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1A1A1A;
    color: #F1F1F1;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    line-height: 1.6;
}

.terminal {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #1A1A1A;
}

/* Portfolio Dashboard */
.portfolio-dashboard {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #2D2D2D;
    border-bottom: 1px solid rgba(241, 241, 241, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(241, 241, 241, 0.1);
}

.terminal-title {
    font-size: clamp(18px, 4vw, 24px);
    font-weight: 600;
    color: #F1F1F1;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rank-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.3);
    border-radius: 20px;
    font-weight: 500;
    font-size: clamp(12px, 3vw, 14px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #2196F3;
}

.rank-badge.BANKRUPT {
    background: rgba(244, 67, 54, 0.1);
    border-color: rgba(244, 67, 54, 0.3);
    color: #F44336;
}

.rank-badge.TRADER {
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.3);
    color: #4CAF50;
}

.rank-badge.MARKET_MAKER {
    background: rgba(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.3);
    color: #FFC107;
}

.rank-badge.BRUCE_WAYNE {
    background: rgba(156, 39, 176, 0.1);
    border-color: rgba(156, 39, 176, 0.3);
    color: #9C27B0;
    box-shadow: 0 0 20px rgba(156, 39, 176, 0.3);
}

.portfolio-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    padding: 20px 24px;
}

.stat-item {
    text-align: center;
    padding: 16px;
    background: rgba(241, 241, 241, 0.05);
    border: 1px solid rgba(241, 241, 241, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.stat-label {
    display: block;
    font-size: clamp(11px, 2.5vw, 12px);
    color: rgba(241, 241, 241, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-value {
    display: block;
    font-size: clamp(18px, 4vw, 22px);
    font-weight: 600;
    color: #F1F1F1;
}

/* Market News Ticker */
.news-ticker {
    background: rgba(33, 150, 243, 0.1);
    border-bottom: 1px solid rgba(33, 150, 243, 0.2);
    overflow: hidden;
    position: relative;
    height: 36px;
}

.news-content {
    display: flex;
    align-items: center;
    height: 100%;
    animation: newsScroll 20s linear infinite;
    white-space: nowrap;
}

.news-item {
    padding: 0 50px;
    font-size: clamp(12px, 3vw, 13px);
    color: #2196F3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

@keyframes newsScroll {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* Trading Floor */
.trading-floor {
    flex: 1;
    padding: 24px;
    background: #1A1A1A;
}

.stocks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Stock Cards */
.stock-card {
    background: #2D2D2D;
    border: 1px solid rgba(241, 241, 241, 0.1);
    border-radius: 12px;
    padding: 24px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.stock-card:hover {
    border-color: rgba(241, 241, 241, 0.2);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(-4px);
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.stock-name {
    font-size: clamp(16px, 3.5vw, 18px);
    font-weight: 600;
    color: #F1F1F1;
    flex: 1;
    line-height: 1.3;
}

.stock-symbol {
    font-size: clamp(12px, 3vw, 13px);
    color: rgba(241, 241, 241, 0.7);
    background: rgba(241, 241, 241, 0.1);
    padding: 6px 12px;
    border-radius: 16px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stock-price-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(241, 241, 241, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(241, 241, 241, 0.1);
}

.current-price {
    font-size: clamp(24px, 4.5vw, 28px);
    font-weight: 700;
    color: #F1F1F1;
}

.price-change {
    font-size: clamp(13px, 3vw, 14px);
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
}

.price-change.positive {
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.price-change.negative {
    color: #F44336;
    background: rgba(244, 67, 54, 0.1);
}

/* Sparklines */
.sparkline-container {
    margin-bottom: 20px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(241, 241, 241, 0.02);
    border: 1px solid rgba(241, 241, 241, 0.1);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.sparkline {
    max-width: 100%;
    height: auto;
    cursor: crosshair;
}

.sparkline:hover {
    filter: brightness(1.2);
}

/* Stock Stats */
.stock-stats {
    margin-bottom: 20px;
}

.holding-info {
    display: flex;
    justify-content: space-between;
    font-size: clamp(12px, 2.8vw, 14px);
    color: rgba(241, 241, 241, 0.7);
}

.shares-owned, .holding-value {
    padding: 12px 16px;
    background: rgba(241, 241, 241, 0.05);
    border: 1px solid rgba(241, 241, 241, 0.1);
    border-radius: 8px;
    font-weight: 500;
}

/* Trading Controls */
.trading-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-buy, .btn-sell {
    padding: 14px 20px;
    border: none;
    font-family: inherit;
    font-size: clamp(13px, 3vw, 14px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
    min-width: 48px;
    position: relative;
    overflow: hidden;
}

.btn-buy {
    background: #4CAF50;
    color: #FFFFFF;
}

.btn-buy:hover, .btn-buy:active {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.3);
}

.btn-sell {
    background: #F44336;
    color: #FFFFFF;
}

.btn-sell:hover, .btn-sell:active {
    background: #da190b;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(244, 67, 54, 0.3);
}

.btn-buy:disabled, .btn-sell:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-buy:disabled:hover, .btn-sell:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Footer */
.terminal-footer {
    background: #2D2D2D;
    border-top: 1px solid rgba(241, 241, 241, 0.1);
    padding: 20px 24px;
    margin-top: auto;
}

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

.developer-credit {
    font-size: clamp(12px, 3vw, 13px);
    color: rgba(241, 241, 241, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.btn-reset {
    padding: 10px 20px;
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #F44336;
    font-family: inherit;
    font-size: clamp(12px, 3vw, 13px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
    min-width: 44px;
}

.btn-reset:hover, .btn-reset:active {
    background: #F44336;
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(244, 67, 54, 0.3);
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .portfolio-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stocks-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 16px;
    }
    
    .stock-card {
        padding: 20px;
    }
    
    .trading-controls {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .trading-floor {
        padding: 16px;
    }
    
    .stock-card {
        padding: 16px;
    }
    
    .stock-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .stock-name {
        text-align: center;
    }
    
    .stock-symbol {
        align-self: center;
    }
}

/* Prevent text selection and zoom but allow scrolling */
body, .terminal {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Allow scrolling on trading floor */
.trading-floor {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
}

/* Modern scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(241, 241, 241, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(241, 241, 241, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(241, 241, 241, 0.3);
}
