/**
 * STP Order Flow Stacking Heatmap - Frontend Styles
 */

.stp-orderflow-heatmap-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 100%;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stp-heatmap-header h2 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #1a1a1a;
}

.stp-heatmap-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Quarter Tabs */
.stp-quarter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stp-quarter-tab {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: #f5f5f5;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.stp-quarter-tab:hover {
    border-color: #1976D2;
    background: #E3F2FD;
}

.stp-quarter-tab.active {
    background: #1976D2;
    color: #fff;
    border-color: #1976D2;
}

/* Legend */
.stp-heatmap-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #555;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Heatmap Table */
.stp-heatmap-wrapper {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

.stp-heatmap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.stp-heatmap-table th,
.stp-heatmap-table td {
    padding: 8px 6px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.stp-heatmap-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.stp-heatmap-table thead th {
    background: #37474F;
    color: #fff;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.stp-heatmap-table .date-header {
    background: #263238;
    min-width: 80px;
    position: sticky;
    left: 0;
    z-index: 11;
}

.stp-heatmap-table .date-cell {
    background: #ECEFF1;
    font-weight: 600;
    color: #37474F;
    white-space: nowrap;
    position: sticky;
    left: 0;
    z-index: 5;
}

/* Value Cell Colors */
.stp-heatmap-table .value-cell {
    font-weight: 700;
    font-size: 14px;
    cursor: help;
    transition: transform 0.1s ease;
}

.stp-heatmap-table .value-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
    position: relative;
}

/* Strong Bullish: +75 to +100 */
.stp-heatmap-table .strong-bullish {
    background: #2E7D32;
    color: #fff;
}

/* Moderate Bullish: +50 to +74 */
.stp-heatmap-table .moderate-bullish {
    background: #81C784;
    color: #1B5E20;
}

/* Neutral: -49 to +49 */
.stp-heatmap-table .neutral {
    background: #FFF9C4;
    color: #5D4037;
}

/* Moderate Bearish: -50 to -74 */
.stp-heatmap-table .moderate-bearish {
    background: #EF9A9A;
    color: #B71C1C;
}

/* Strong Bearish: -75 to -100 */
.stp-heatmap-table .strong-bearish {
    background: #C62828;
    color: #fff;
}

/* No Data */
.stp-heatmap-table .no-data {
    background: #EEEEEE;
    color: #9E9E9E;
}

/* No Data Message */
.stp-no-data {
    text-align: center;
    padding: 40px;
    background: #f5f5f5;
    border-radius: 8px;
    color: #666;
}

/* Access Denied */
.stp-access-denied {
    text-align: center;
    padding: 40px;
    background: #fff3e0;
    border-radius: 8px;
    color: #e65100;
    font-weight: 500;
}

/* Loading State */
.stp-heatmap-loading {
    text-align: center;
    padding: 40px;
}

.stp-heatmap-loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #ddd;
    border-top-color: #1976D2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .stp-orderflow-heatmap-container {
        padding: 10px;
    }
    
    .stp-heatmap-table {
        font-size: 11px;
    }
    
    .stp-heatmap-table th,
    .stp-heatmap-table td {
        padding: 5px 3px;
    }
    
    .stp-heatmap-table .value-cell {
        font-size: 12px;
    }
    
    .stp-heatmap-legend {
        gap: 10px;
    }
    
    .legend-item {
        font-size: 10px;
    }
}
