/* Enhanced Analytics Panel Styles */
.analytics-panel {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    color: white;
}

.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.analytics-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(45deg, #00d4ff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.analytics-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.analytics-controls select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.analytics-controls button {
    background: linear-gradient(45deg, #007bff, #0056b3);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.analytics-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Metrics Dashboard */
.metrics-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.metric-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #007bff, #00d4ff);
    border-radius: 12px 12px 0 0;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.metric-card.positive::before {
    background: linear-gradient(90deg, #28a745, #20c997);
}

.metric-card.negative::before {
    background: linear-gradient(90deg, #dc3545, #fd7e14);
}

.metric-card.excellent::before {
    background: linear-gradient(90deg, #28a745, #20c997);
}

.metric-card.good::before {
    background: linear-gradient(90deg, #ffc107, #fd7e14);
}

.metric-card.poor::before {
    background: linear-gradient(90deg, #dc3545, #e83e8c);
}

.metric-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.metric-content {
    flex: 1;
}

.metric-label {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: #00d4ff;
}

.metric-subtitle {
    font-size: 0.8rem;
    opacity: 0.6;
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.analytics-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 25px;
    transition: all 0.3s ease;
}

.analytics-section:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.section-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    color: #00d4ff;
}

/* Heatmap Styles */
.heatmap-section {
    grid-column: 1 / -1;
}

.heatmap-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 20px;
    min-height: 300px;
    overflow-x: auto;
}

.time-grid {
    min-width: 860px;
}

@media (max-width: 900px) {
    .analytics-panel {
        padding: 16px;
    }

    .analytics-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .analytics-controls {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .analytics-controls select,
    .analytics-controls button {
        width: 100%;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .metric-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .setup-metrics {
        grid-template-columns: 1fr;
    }

    .symbol-matrix {
        grid-template-columns: repeat(2, 1fr);
    }
}

.time-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.time-header {
    display: grid;
    grid-template-columns: 60px repeat(24, 1fr);
    gap: 2px;
    margin-bottom: 5px;
}

.time-label, .hour-label {
    text-align: center;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    padding: 5px;
}

.day-row {
    display: grid;
    grid-template-columns: 60px repeat(24, 1fr);
    gap: 2px;
}

.day-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.time-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.time-cell:hover {
    transform: scale(1.1);
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.cell-content {
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.heatmap-legend {
    display: flex;
    gap: 15px;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
}

.legend-item::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-item.negative::before {
    background: rgba(239, 68, 68, 0.8);
}

.legend-item.neutral::before {
    background: rgba(100, 100, 100, 0.5);
}

.legend-item.positive::before {
    background: rgba(34, 197, 94, 0.8);
}

/* Setup Analysis */
.setup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.setup-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.setup-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.setup-card.profitable {
    border-left: 4px solid #28a745;
}

.setup-card.unprofitable {
    border-left: 4px solid #dc3545;
}

.setup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.setup-tag {
    font-weight: 600;
    font-size: 1.1rem;
    color: #00d4ff;
}

.setup-pnl {
    font-weight: 700;
    font-size: 1.2rem;
}

.setup-pnl.positive {
    color: #28a745;
}

.setup-pnl.negative {
    color: #dc3545;
}

.setup-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.setup-metric {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.setup-metric .metric-label {
    opacity: 0.7;
}

.setup-metric .metric-value {
    font-weight: 600;
}

.setup-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    transition: width 0.3s ease;
}

/* Symbol Matrix */
.symbol-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.symbol-cell {
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.symbol-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.symbol-name {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 5px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.symbol-value {
    font-size: 0.8rem;
    opacity: 0.9;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Risk Dashboard */
.risk-dashboard {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 20px;
}

.risk-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.risk-metric {
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.risk-metric label {
    display: block;
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.risk-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #00d4ff;
}

.risk-value.positive {
    color: #28a745;
}

.risk-value.negative {
    color: #dc3545;
}

/* Chart Section */
.chart-section {
    grid-column: 1 / -1;
}

.chart-controls {
    display: flex;
    gap: 10px;
}

.chart-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.chart-btn:hover,
.chart-btn.active {
    background: linear-gradient(45deg, #007bff, #0056b3);
    border-color: #007bff;
}

.chart-container {
    margin-top: 20px;
    height: 400px;
    position: relative;
}

.distribution-container {
    height: 300px;
    position: relative;
}

.distribution-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.dist-stat {
    text-align: center;
}

.dist-stat label {
    display: block;
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 5px;
}

.dist-stat div {
    font-weight: 600;
    font-size: 1rem;
    color: #00d4ff;
}

/* Loading and Error States */
.loading-state,
.no-data,
.heatmap-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .analytics-panel {
        padding: 15px;
    }

    .analytics-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .metrics-dashboard {
        grid-template-columns: 1fr;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .time-header,
    .day-row {
        grid-template-columns: 40px repeat(24, 1fr);
    }

    .setup-grid {
        grid-template-columns: 1fr;
    }

    .symbol-matrix {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .risk-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}