/**
 * Advanced Stock Benchmark Comparison Styles
 *
 * @version 1.0.0
 */

/* --- General Container --- */
.sta-benchmark-comparison.sta-advanced-comparison {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    color: #374151;
    line-height: 1.6;
}

/* --- Header Section --- */
.sta-benchmark-header {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.sta-benchmark-header h2 {
    font-size: 1.5em;
    font-weight: 600;
    color: #111827;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
}

.sta-accent-bar {
    display: inline-block;
    width: 5px;
    height: 24px;
    background-color: #3b82f6;
    margin-right: 10px;
    border-radius: 2px;
}

.sta-core-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.sta-security-info-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sta-security-row {
    display: flex;
    gap: 15px;
}

.sta-security-cell {
    flex: 1;
}

.sta-security-cell label {
    display: block;
    font-size: 0.875em;
    color: #6b7280;
    margin-bottom: 4px;
}

.sta-security-name {
    font-weight: 600;
    font-size: 1.1em;
}

.sta-security-code {
    font-weight: 400;
    color: #6b7280;
    font-size: 0.9em;
    margin-left: 5px;
}

.sta-security-meta {
    font-size: 0.875em;
    color: #4b5563;
    background-color: #f9fafb;
    padding: 8px 12px;
    border-radius: 6px;
}

.sta-security-meta-label {
    font-weight: 600;
    margin-right: 8px;
}

.sta-summary-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sta-summary-metrics {
    display: flex;
    gap: 15px;
}

.sta-metric-card {
    flex: 1;
    background-color: #f9fafb;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.sta-metric-card-label {
    font-size: 0.9em;
    color: #6b7280;
    margin-bottom: 8px;
}

.sta-metric-card-label .icon {
    margin-right: 5px;
}

.sta-metric-card-values .sta-metric-value {
    display: block;
    font-size: 1.5em;
    font-weight: 700;
}

.sta-metric-card-values .sta-metric-benchmark {
    font-size: 0.85em;
    color: #6b7280;
}

/* --- Summary Section --- */
.sta-comparison-summary {
    display: flex;
    gap: 20px;
    background-color: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.sta-performance-rating-container {
    flex-basis: 25%;
    text-align: center;
    border-right: 1px solid #e5e7eb;
    padding-right: 20px;
}

.sta-performance-rating-label {
    font-size: 0.9em;
    color: #6b7280;
}

.sta-performance-rating-value {
    font-size: 2em;
    font-weight: 700;
}

.sta-key-insights {
    flex-basis: 75%;
}

.sta-key-insights h4 {
    margin: 0 0 10px 0;
    font-size: 1.1em;
}

.sta-key-insights ul {
    margin: 0;
    padding-left: 20px;
    font-size: 0.95em;
}

.sta-key-insights li {
    margin-bottom: 5px;
}

/* --- Potential Analysis Section --- */
.sta-potential-analysis-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.sta-potential-analysis-section h3 {
    text-align: center;
    font-size: 1.4em;
    color: #111827;
    margin-bottom: 20px;
}

.sta-potential-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 30px;
    align-items: start;
}

.sta-potential-gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sta-gauge {
    width: 200px;
    height: 100px;
    position: relative;
}

.sta-gauge-body {
    width: 200px;
    height: 100px;
    border-radius: 100px 100px 0 0;
    background: #e0e0e0;
    overflow: hidden;
    position: relative;
}

.sta-gauge-fill {
    position: absolute;
    top: 100%;
    left: 0;
    width: inherit;
    height: 100%;
    background: linear-gradient(to right, #dc2626, #f97c36, #16a34a);
    transform-origin: center top;
    transform: rotate(0.25turn);
}

.sta-gauge-cover {
    width: 160px;
    height: 80px;
    background: #ffffff;
    border-radius: 80px 80px 0 0;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.sta-gauge-needle-container {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 100px;
    transform-origin: bottom center;
}

.sta-gauge-needle {
    width: 4px;
    height: 90px;
    background: #374151;
    border-radius: 2px;
    position: absolute;
    bottom: 0;
    left: -2px;
    transform-origin: bottom center;
    transition: transform 0.5s ease-in-out;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

.sta-gauge-labels {
    width: 220px;
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #6b7280;
    margin-top: -10px;
    height: 1.2em;
    line-height: 1.2em;
    position: relative; /* 建立新的堆叠上下文，确保标签在仪表盘上层 */
}

.sta-potential-factors h4 {
    font-size: 1.1em;
    margin-top: 0;
    margin-bottom: 10px;
    color: #1f2937;
}

.sta-potential-factors .icon {
    margin-right: 8px;
}

.sta-potential-factors ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.sta-potential-factors li {
    font-size: 0.9em;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
}

.sta-potential-factors li:last-child {
    border-bottom: none;
}

.sta-potential-factors strong {
    color: #374151;
}

.sta-bullish-factors {
    margin-bottom: 20px;
}

.sta-key-insights li {
    margin-bottom: 5px;
}

/* --- Chart Section --- */
.sta-chart-tabs {
    display: flex;
    border-bottom: 1px solid #d1d5db;
    margin-bottom: 10px;
}

.sta-chart-tab {
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}

.sta-chart-tab.sta-active {
    color: #1f2937;
    border-bottom-color: #3b82f6;
}

.sta-chart-tab:hover {
    background-color: #f3f4f6;
}

/* --- Metrics Section --- */
.sta-metrics-section {
    margin-top: 20px;
}

.sta-metrics-group {
    margin-bottom: 20px;
}

.sta-metrics-group h4 {
    font-size: 1.2em;
    margin: 0 0 10px 0;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 5px;
}

.sta-metrics-table {
    font-size: 0.95em;
}

.sta-metrics-header, .sta-metrics-row {
    display: grid;
    padding: 8px 5px;
    border-bottom: 1px solid #f3f4f6;
}

.sta-metrics-header {
    font-weight: 600;
    background-color: #f9fafb;
}

.sta-metrics-row:nth-child(even) {
    background-color: #f9fafb;
}

.sta-metrics-header-4col, .sta-metrics-row-4col { grid-template-columns: 2fr 1fr 1fr 1fr; }
.sta-metrics-header-3col, .sta-metrics-row-3col { grid-template-columns: 1.5fr 1fr 2.5fr; }

.sta-text-right { text-align: right; }
.sta-text-bold { font-weight: 600; }

.sta-value-positive { color: #dc2626; } /* Red for positive in A-shares */
.sta-value-negative { color: #16a34a; } /* Green for negative in A-shares */
.sta-value-neutral { color: #4b5563; }

.sta-explanation {
    color: #6b7280;
    font-size: 0.9em;
}

/* --- Tooltip --- */
.sta-tooltip {
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    background-color: #d1d5db;
    color: #ffffff;
    font-size: 0.8em;
    cursor: help;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .sta-core-info-grid, .sta-comparison-summary {
        grid-template-columns: 1fr;
        flex-direction: column;
    }
    .sta-potential-grid {
        grid-template-columns: 1fr;
        flex-direction: column;
    }
    .sta-comparison-summary {
        border-right: none;
        padding-right: 0;
    }
    .sta-metrics-header-4col, .sta-metrics-row-4col { grid-template-columns: 1.5fr repeat(3, 1fr); }
    .sta-metrics-header-3col, .sta-metrics-row-3col { grid-template-columns: 1.5fr 1fr 2fr; }
    .sta-explanation { display: none; } /* Hide explanation on small screens */
}
