/* =============================================================================
   GuideLLM / Benchmark Styles
   Modularized styles for the GuideLLM benchmarking feature
   ============================================================================= */

/* =============================================================================
   GuideLLM Status Indicator (Header)
   ============================================================================= */

/* GuideLLM Status - matches MCP header status style */
.guidellm-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.guidellm-status-indicator.available {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.guidellm-status-indicator.unavailable {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* =============================================================================
   GuideLLM Install Warning (matches MCP style)
   ============================================================================= */

.guidellm-install-warning {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 420px;
    margin: 40px auto;
    padding: 40px 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-align: center;
}

.guidellm-install-warning .warning-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.15);
    border-radius: 50%;
    margin-bottom: 20px;
}

.guidellm-install-warning .warning-icon .icon-guidellm-warning {
    width: 28px;
    height: 28px;
}

.guidellm-install-warning h3 {
    margin: 0 0 8px 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #f59e0b;
}

.guidellm-install-warning p {
    margin: 0 0 20px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.guidellm-install-warning .install-commands {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.guidellm-install-warning code {
    display: block;
    width: 100%;
    background: var(--bg-tertiary);
    padding: 12px 16px;
    border-radius: 8px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.guidellm-install-warning code.primary-cmd {
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.3);
    color: #a5b4fc;
}

.guidellm-install-warning code.alt-cmd {
    font-size: 0.8rem;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    opacity: 0.8;
}

.guidellm-install-warning .cmd-divider {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.guidellm-install-warning .feature-note {
    margin-top: 20px;
    margin-bottom: 0;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Warning icon SVG */
.icon-guidellm-warning {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.icon-guidellm-warning.icon-lg {
    width: 28px;
    height: 28px;
}

/* GuideLLM icon */
.icon-guidellm {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20V10'/%3E%3Cpath d='M18 20V4'/%3E%3Cpath d='M6 20v-4'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* =============================================================================
   GuideLLM Layout
   ============================================================================= */

.guidellm-layout {
    max-width: 1400px;
    margin: 0 auto;
}

.guidellm-panel {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

/* =============================================================================
   Benchmark Server Status Banner
   ============================================================================= */

.benchmark-server-status {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(239, 68, 68, 0.1) 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.benchmark-server-status.connected {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-color: rgba(16, 185, 129, 0.3);
}

.server-status-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.server-status-content .status-icon {
    font-size: 1.3rem;
}

.server-status-content .status-message {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* =============================================================================
   Benchmark Configuration
   ============================================================================= */

.benchmark-config {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    overflow: visible;
}

.config-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.config-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.config-item label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Target Instance Dropdown */
.benchmark-instance-select {
    width: 100%;
    max-width: 420px;
    min-height: 42px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.95rem;
    line-height: 1.35;
    cursor: pointer;
    appearance: auto;
    transition: border-color 0.2s;
}

.benchmark-instance-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.benchmark-instance-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0.35em 0.5rem;
}

.benchmark-instance-select optgroup {
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* =============================================================================
   Metrics Display
   ============================================================================= */

.metrics-display {
    margin-bottom: 20px;
    overflow: visible;
}

.metrics-placeholder {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 2px dashed var(--border-color);
}

.metrics-placeholder p:first-child {
    font-size: 2rem;
    margin-bottom: 10px;
}

.metrics-help {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    overflow: visible;
}

.metric-card {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    opacity: 0;
    transition: opacity 0.3s;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-family: 'Monaco', 'Courier New', monospace;
}

.metric-subtext {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* =============================================================================
   Benchmark Progress
   ============================================================================= */

.benchmark-progress {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: 8px;
    margin-bottom: 20px;
}

.progress-bar {
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--primary-color) 0%,
        var(--success-color) 50%,
        var(--primary-color) 100%
    );
    background-size: 200% 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
    animation: shimmer 2s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    padding-top: 8px;
}

/* Metric Card Animations */
@keyframes metricUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.metric-card.updated {
    animation: metricUpdate 0.5s ease;
}

/* =============================================================================
   Benchmark Table Styling
   ============================================================================= */

.benchmark-table-section {
    background: var(--panel-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: visible;
}

.table-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
    margin-top: 15px;
    overflow: visible;
}

.benchmark-table-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.benchmark-table-group h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
}

.benchmark-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.benchmark-data-table thead {
    background: rgba(16, 185, 129, 0.1);
}

.benchmark-data-table thead th {
    padding: 10px;
    text-align: left;
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.benchmark-data-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.benchmark-data-table tbody tr:hover {
    background: rgba(16, 185, 129, 0.05);
}

.benchmark-data-table tbody tr:last-child {
    border-bottom: none;
}

.benchmark-data-table td {
    padding: 10px;
    color: var(--text-primary);
}

.benchmark-data-table td.label {
    font-weight: 500;
    color: var(--text-secondary);
    width: 50%;
}

.benchmark-data-table td.value {
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', monospace;
}

.benchmark-data-table td.value.success {
    color: #10b981;
}

.benchmark-data-table td.value.error {
    color: #ef4444;
}

/* =============================================================================
   Responsive Benchmark Styles
   ============================================================================= */

@media (max-width: 1400px) {
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .config-row {
        grid-template-columns: 1fr;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .table-container {
        grid-template-columns: 1fr;
    }
}

/* =============================================================================
   Light Mode Overrides
   ============================================================================= */

/* Light mode - matches MCP style */
[data-theme="light"] .guidellm-status-indicator.available {
    background: rgba(16, 185, 129, 0.1);
}

[data-theme="light"] .guidellm-status-indicator.unavailable {
    background: rgba(239, 68, 68, 0.1);
}

[data-theme="light"] .guidellm-install-warning {
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .guidellm-install-warning .warning-icon {
    background: rgba(245, 158, 11, 0.12);
}

[data-theme="light"] .guidellm-install-warning code {
    background: #f8fafc;
}

[data-theme="light"] .guidellm-install-warning code.primary-cmd {
    background: rgba(79, 70, 229, 0.08);
    color: #4f46e5;
}

[data-theme="light"] .benchmark-server-status {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
}

[data-theme="light"] .benchmark-server-status.connected {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
}

[data-theme="light"] .metric-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: var(--card-shadow);
}

[data-theme="light"] .metric-card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .benchmark-table-group {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .benchmark-data-table thead {
    background: rgba(14, 165, 233, 0.08);
}

[data-theme="light"] .benchmark-data-table thead th {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

[data-theme="light"] .benchmark-data-table tbody tr:hover {
    background: rgba(14, 165, 233, 0.05);
}

[data-theme="light"] .icon-guidellm {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20V10'/%3E%3Cpath d='M18 20V4'/%3E%3Cpath d='M6 20v-4'/%3E%3C/svg%3E");
}
