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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
}

.header {
    background: #1a1a1a;
    padding: 15px 20px;
    border-bottom: 1px solid #333;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #fff;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.news-button {
    background-color: #007bff;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.news-button:hover {
    background-color: #0056b3;
}

.stats {
    font-size: 14px;
    color: #888;
}

.session-info {
    color: #fff;
    font-weight: 500;
}

.filters {
    background: #1a1a1a;
    padding: 15px 20px;
    border-bottom: 1px solid #333;
    position: fixed;
    top: 65px;
    left: 0;
    right: 0;
    z-index: 999;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-group label {
    font-size: 13px;
    color: #aaa;
}

.filter-group input,
.filter-group select {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 13px;
}

.reset-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.reset-btn:hover {
    background: #c82333;
}

.volume-legend {
    margin-left: auto;
    font-size: 12px;
    color: #888;
    display: flex;
    gap: 15px;
}

.volume-legend span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Hot Tickers Section - Updated */
.hot-tickers-section {
    margin-top: 130px;
    padding: 20px;
    border-bottom: 2px solid #ffae42;
    background: #0f0f0f;
}

.hot-tickers-section h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #ffae42;
}

#hot-grid-container {
    max-width: 100%;
}

#hot-grid-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Hot Ticker Card */
.hot-ticker-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
}

.hot-ticker-card.highlight-green {
    background-color: rgba(0, 208, 132, 0.15);
    border-color: rgba(0, 208, 132, 0.5);
}

.hot-ticker-card:hover {
    border-color: #ffae42;
    box-shadow: 0 2px 8px rgba(255, 174, 66, 0.2);
}

/* Hot Ticker Header */
.hot-ticker-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
}

.hot-ticker-symbol {
    font-size: 24px;
    font-weight: bold;
    color: #ffae42;
}

.hot-ticker-prices {
    display: flex;
    gap: 20px;
    align-items: center;
}

.hot-ticker-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hot-ticker-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
}

.hot-ticker-value {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.hot-ticker-value.positive {
    color: #00d084;
}

.hot-ticker-value.negative {
    color: #ff4757;
}

.hot-ticker-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* News Section within Hot Ticker */
.hot-ticker-news {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #333;
}

.news-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 123, 255, 0.2);
    color: #007bff;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    margin-bottom: 10px;
}

.news-content {
    background: rgba(0, 123, 255, 0.05);
    border-left: 3px solid #007bff;
    padding: 12px;
    border-radius: 4px;
}

.news-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 8px;
    font-size: 12px;
}

.news-sentiment {
    font-weight: bold;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 12px;
}

.news-sentiment.positive {
    background: rgba(16, 185, 129, 0.2);
    color: #10B981;
}

.news-sentiment.negative {
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
}

.news-sentiment.neutral {
    background: rgba(107, 114, 128, 0.2);
    color: #9CA3AF;
}

.news-impact {
    color: #ffd700;
}

.news-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
}

.news-summary {
    font-size: 13px;
    color: #e0e0e0;
    line-height: 1.4;
    margin-bottom: 8px;
}

.news-link {
    display: inline-block;
    font-size: 12px;
    color: #007bff;
    text-decoration: none;
    transition: opacity 0.2s;
}

.news-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Main Grid */
.grid-container {
    font-size: 13px;
    width: 100%;
    margin-top: 20px;
}

/* Grid wrapper for horizontal scroll */
.grid-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.grid-header,
.grid-row {
    display: grid;
    grid-template-columns: 120px 80px 80px 70px 70px 80px 100px 80px 80px 80px 80px;
    align-items: center;
    border-bottom: 1px solid #1a1a1a;
    min-width: 960px;
}

.grid-header {
    background: #1a1a1a;
    position: sticky;
    top: 130px;
    z-index: 100;
    border-bottom: 2px solid #333;
    font-weight: 500;
}

.grid-row:hover {
    background: #1a1a1a;
}

.grid-cell {
    padding: 12px 8px;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-cell {
    color: #aaa;
    cursor: pointer;
    user-select: none;
}

.header-cell:hover {
    background: #222;
}

.grid-cell:first-child {
    text-align: left;
    padding-left: 20px;
    font-weight: 600;
    color: #fff;
    position: sticky;
    left: 0;
    background: #0a0a0a;
    z-index: 50;
}

.grid-row:hover .grid-cell:first-child {
    background: #1a1a1a;
}

/* Hide certain columns on mobile by default */
.grid-cell:nth-child(6),  /* Last Trade */
.grid-cell:nth-child(10), /* Spread % */
.header-cell:nth-child(6),
.header-cell:nth-child(10) {
    display: none;
}

.positive { color: #00d084; }
.negative { color: #ff4757; }
.neutral { color: #888; }

@keyframes flash {
    0% { background-color: rgba(0, 208, 132, 0.15); }
    100% { background-color: transparent; }
}
.updated { animation: flash 0.7s ease-out; }

.status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 20px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 5px;
    font-size: 12px;
}
.status.connected { border-color: #00d084; color: #00d084; }
.status.disconnected { border-color: #ff4757; color: #ff4757; }

.loading-container {
    text-align: center;
    padding: 50px;
    color: #666;
}
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-top-color: #00d084;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* News Indicator in main grid */
.news-indicator {
    margin-left: 5px;
    font-size: 12px;
    color: #007bff;
}

/* Empty state for hot tickers */
.no-hot-tickers {
    text-align: center;
    padding: 40px;
    color: #666;
    background: #1a1a1a;
    border-radius: 8px;
    border: 1px dashed #333;
}

/* Buy button styles */
.buy-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s;
    font-weight: 600;
}

.buy-btn:hover:not(:disabled) {
    background: #218838;
    transform: scale(1.05);
}

/* TABLET RESPONSIVE STYLES */
@media (max-width: 1024px) {
    .grid-header,
    .grid-row {
        font-size: 12px;
        min-width: 800px;
    }
    
    .grid-cell {
        padding: 10px 6px;
    }
    
    .hot-ticker-prices {
        gap: 15px;
    }
    
    .hot-ticker-stat {
        min-width: 60px;
    }
}

/* MOBILE RESPONSIVE STYLES */
@media (max-width: 768px) {
    /* Header adjustments */
    .header {
        padding: 10px 15px;
        flex-direction: column;
        gap: 10px;
        height: auto;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }
    
    .news-button {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .stats {
        font-size: 11px;
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    /* Filters adjustments */
    .filters {
        top: 85px;
        padding: 10px 15px;
        gap: 10px;
        justify-content: space-between;
    }
    
    .reset-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .volume-legend {
        font-size: 11px;
    }
    
    /* Hot tickers adjustments */
    .hot-tickers-section {
        margin-top: 140px;
        padding: 15px;
    }
    
    .hot-tickers-section h2 {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .hot-ticker-card {
        padding: 12px;
    }
    
    .hot-ticker-header {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .hot-ticker-symbol {
        font-size: 20px;
    }
    
    .hot-ticker-prices {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: space-between;
    }
    
    .hot-ticker-stat {
        min-width: 70px;
        flex: 1;
    }
    
    .hot-ticker-label {
        font-size: 10px;
    }
    
    .hot-ticker-value {
        font-size: 14px;
    }
    
    .hot-ticker-actions {
        justify-content: center;
        width: 100%;
    }
    
    .buy-btn.hot-buy {
        width: 100%;
        padding: 10px;
        font-size: 14px;
    }
    
    /* Main grid adjustments - FIXED */
    .grid-container {
        font-size: 11px;
        margin-top: 10px;
        padding: 0 10px;
    }
    
    .grid-wrapper {
        margin: 0 -10px;
        padding: 0 10px;
    }
    
    .grid-header {
        position: sticky;
        top: 140px;
        background: #1a1a1a;
        z-index: 100;
    }
    
    .grid-header,
    .grid-row {
        display: grid;
        grid-template-columns: 80px 50px 50px 60px 50px;
        min-width: auto;
        width: 100%;
    }
    
    /* Hide non-essential columns on mobile */
    .grid-cell:nth-child(2),  /* Prev Close */
    .grid-cell:nth-child(4),  /* Bid */
    .grid-cell:nth-child(5),  /* Ask */
    .grid-cell:nth-child(6),  /* Last Trade */
    .grid-cell:nth-child(8),  /* $ Change */
    .grid-cell:nth-child(10), /* Spread % */
    .grid-cell:nth-child(11), /* Update */
    .header-cell:nth-child(2),
    .header-cell:nth-child(4),
    .header-cell:nth-child(5),
    .header-cell:nth-child(6),
    .header-cell:nth-child(8),
    .header-cell:nth-child(10),
    .header-cell:nth-child(11) {
        display: none;
    }
    
    .grid-cell {
        padding: 10px 5px;
        font-size: 12px;
    }
    
    .grid-cell:first-child {
        padding-left: 5px;
        background: transparent;
        position: static;
    }
    
    .grid-row .grid-cell:first-child {
        background: transparent;
    }
    
    /* Adjust header text for mobile */
    .header-cell[data-sort="current_price"]::after {
        content: "Price";
    }
    .header-cell[data-sort="current_price"] {
        font-size: 0;
    }
    .header-cell[data-sort="current_price"]::after {
        font-size: 11px;
    }
    
    .header-cell[data-sort="cumulative_volume"]::after {
        content: "Total Vol";
    }
    .header-cell[data-sort="cumulative_volume"] {
        font-size: 0;
    }
    .header-cell[data-sort="cumulative_volume"]::after {
        font-size: 11px;
    }
    
    .header-cell[data-sort="change_pct"]::after {
        content: "% Ch";
    }
    .header-cell[data-sort="change_pct"] {
        font-size: 0;
    }
    .header-cell[data-sort="change_pct"]::after {
        font-size: 11px;
    }
    
    .buy-btn {
        padding: 6px 8px;
        font-size: 10px;
        margin-left: 5px;
        margin-top: 3px;
        width: calc(100% - 10px);
    }
    
    /* News adjustments */
    .news-meta {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 11px;
    }
    
    .news-title {
        font-size: 13px;
    }
    
    .news-summary {
        font-size: 12px;
    }
    
    /* Status adjustments */
    .status {
        bottom: 10px;
        right: 10px;
        padding: 8px 15px;
        font-size: 11px;
    }
    
    /* Remove scroll indicator */
    .grid-wrapper::after {
        display: none;
    }
}

/* Extra small mobile adjustments */
@media (max-width: 480px) {
    .header h1 {
        font-size: 16px;
    }
    
    .stats {
        font-size: 10px;
    }
    
    .hot-ticker-stat {
        min-width: 60px;
    }
    
    .grid-header,
    .grid-row {
        grid-template-columns: 70px 50px 60px 70px 60px;
        min-width: 310px;
    }
    
    /* Hide more columns on very small screens */
    .grid-cell:nth-child(8),  /* $ Change */
    .grid-cell:nth-child(11), /* Update */
    .header-cell:nth-child(8),
    .header-cell:nth-child(11) {
        display: none;
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    .buy-btn {
        min-height: 32px;
        min-width: 60px;
    }
    
    .header-cell {
        padding: 15px 8px;
    }
    
    .filter-group input,
    .filter-group select,
    .reset-btn {
        min-height: 40px;
    }
}