/* =============================================================================
   DASHBOARD_VIEW.CSS - Evaluation Results Dashboard Styles (Template.js Match)
   ============================================================================= */

/* Base gradient background matching template.js */
.dashboard-container {
    display: none;
    position: relative;
    z-index: 100;
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(to bottom, #ffffff, #f9fafb);
}

.dashboard-container.visible {
    display: block !important;
}

/* Loading spinner animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Pulse animation for live indicator */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.animate-pulse {
    animation: pulse 1.8s ease-in-out infinite;
}

/* Utility classes matching template.js Tailwind structure */
.px-2-5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1-5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }

/* Dashboard container padding adjustments to reduce top spacing */
.dashboard-container .py-6 { padding-top: 1rem; padding-bottom: 1.5rem; }
.dashboard-container .md\:py-8 { padding-top: 1.25rem; padding-bottom: 2rem; }

/* More aggressive top padding reduction for dashboard */
.dashboard-container .min-h-screen > .mx-auto {
    padding-top: 0.75rem !important;
}

@media (min-width: 768px) {
    .dashboard-container .min-h-screen > .mx-auto {
        padding-top: 1rem !important;
    }
}

.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }

.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-0-5 { margin-top: 0.125rem; }
.mb-2 { margin-bottom: 0.5rem; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Reduce gap for dashboard sections to minimize empty space */
.dashboard-container .gap-6 { gap: 1rem; }

/* Further reduce spacing after header filters */
.dashboard-container .flex-col > div:first-child + div {
    margin-top: 0.25rem !important; /* 进一步减少到header后面的间距 */
}

/* 专门减少header filters和live status bar之间的间距 */
.dashboard-container .flex-col > div:first-child {
    margin-bottom: -0.25rem !important;
}

/* Reduce spacing in header filters section specifically */
.dashboard-container .gap-3 { gap: 0.5rem; }
.dashboard-container .md\:gap-3 { gap: 0.75rem; }

/* 专门减少下拉菜单和按钮区域的底部间距 */
.dashboard-container .flex.flex-wrap.items-end.gap-2 {
    margin-bottom: -0.5rem !important;
}

/* 更精确地定位按钮区域 */
.dashboard-container .md\:flex-row .flex.flex-wrap.items-end {
    margin-bottom: -0.5rem !important;
}

/* Minimize bottom margin of subtitle text */
.dashboard-container .text-\[11px\].text-gray-500 {
    margin-bottom: -0.25rem;
}

/* Remove spacing between title and subtitle */
.dashboard-container .text-base.font-semibold.text-gray-900 {
    margin-bottom: 0.125rem; /* 保留一点间距 */
    line-height: 1.3;
}

.dashboard-container .text-\[11px\].text-gray-500 {
    margin-top: 0;
    margin-bottom: -0.125rem; /* 轻微减少底部间距 */
    line-height: 1.2;
}

/* Width and height utilities */
.w-full { width: 100%; }
.w-76 { width: 4.75rem; }
.w-44 { width: 11rem; }
.w-20 { width: 5rem; }
.flex-1 { flex: 1 1 0%; }
.min-w-0 { min-width: 0; }
.min-w-200 { min-width: 12.5rem; }
.min-w-220 { min-width: 13.75rem; }
.min-w-90 { min-width: 5.625rem; }

/* 添加 shrink-0 等约束修复对齐漂移问题 */
.shrink-0 { flex-shrink: 0; }
.flex-shrink-0 { flex-shrink: 0; }

.h-2-5 { height: 0.625rem; }
.w-2-5 { width: 0.625rem; }
.h-1\.5 { height: 0.375rem; }
.w-1\.5 { width: 0.375rem; }
.h-2 { height: 0.5rem; }
.w-2 { width: 0.5rem; }
.h-3 { height: 0.75rem; }
.w-3 { width: 0.75rem; }
.h-3\.5 { height: 0.875rem; }
.w-3\.5 { width: 0.875rem; }
.h-4 { height: 1rem; }
.w-4 { width: 1rem; }
.h-5 { height: 1.25rem; }
.w-5 { width: 1.25rem; }
.h-6 { height: 1.5rem; }
.w-6 { width: 1.5rem; }
.h-10 { height: 2.5rem; }
.w-11 { width: 2.75rem; }

.max-h-40 { max-height: 10rem; }

/* Layout utilities */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }

/* Smooth collapse animation for test details */
.collapsible {
  overflow: hidden;
  height: 0;            /* closed */
  opacity: 0;
  transition: height 260ms cubic-bezier(.22,.61,.36,1),
              opacity 200ms linear;
  will-change: height, opacity;
  border-top: 1px solid #f3f4f6;
}
.collapsible.open {
  opacity: 1;           /* height 在 JS 里设为 auto/数值 */
}

/* Smooth icon rotation for test expand icons */
.test-expand-icon {
  transition: transform 260ms cubic-bezier(.22,.61,.36,1);
}

/* Smooth hover effects for test row buttons */
.test-row-btn {
  transition: background-color 150ms ease-in-out;
}

.test-row-btn:hover {
  background-color: #f9fafb;
}

/* 无动画偏好 */
@media (prefers-reduced-motion: reduce) {
  .collapsible { transition: none; }
  .test-expand-icon { transition: none; }
}

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }

.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }

.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-1\.5 > * + * { margin-top: 0.375rem; }

/* Grid layouts - 添加更多响应式栅格选项 */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

@media (min-width: 640px) {
    .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sm\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
    .md\:col-span-2 { grid-column: span 2 / span 2; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .md\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .md\:flex-row { flex-direction: row; }
    .md\:items-end { align-items: flex-end; }
    .md\:justify-between { justify-content: space-between; }
    .md\:py-8 { padding-top: 2rem; padding-bottom: 2rem; }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .lg\:grid-cols-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
    .xl\:grid-cols-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }

/* Additional template.js specific text sizes for exact pixel sizes */
.text-10px { font-size: 10px; line-height: 1.2; }
.text-11px { font-size: 11px; line-height: 1.2; }
.text-12px { font-size: 12px; line-height: 1.2; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-left { text-align: left; }
.text-right { text-align: right; }
.text-center { text-align: center; }

.uppercase { text-transform: uppercase; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-pre-wrap { white-space: pre-wrap; }

.tracking-wide { letter-spacing: 0.025em; }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* Colors */
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }
.text-white { color: #ffffff; }
.text-green-700 { color: #15803d; }
.text-red-700 { color: #b91c1c; }
.text-amber-700 { color: #b45309; }

/* Background colors */
.bg-white { background-color: #ffffff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-gray-300 { background-color: #d1d5db; }
.bg-gray-400 { background-color: #9ca3af; }
.bg-gray-900 { background-color: #111827; }

.bg-green-50 { background-color: #f0fdf4; }
.bg-green-400 { background-color: #4ade80; }
.bg-green-500 { background-color: #22c55e; }

.bg-red-50 { background-color: #fef2f2; }
.bg-red-500 { background-color: #ef4444; }

.bg-amber-50 { background-color: #fffbeb; }
.bg-amber-400 { background-color: #fbbf24; }
.bg-amber-500 { background-color: #f59e0b; }

.bg-orange-500 { background-color: #f97316; }

/* Border utilities */
.border { border-width: 1px; }
.border-t { border-top-width: 1px; }
.border-b { border-bottom-width: 1px; }

.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }
.border-green-200 { border-color: #bbf7d0; }
.border-red-200 { border-color: #fecaca; }
.border-amber-200 { border-color: #fde68a; }

.divide-y > * + * { border-top-width: 1px; }
.divide-gray-100 > * + * { border-color: #f3f4f6; }

/* Border radius */
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }
.rounded-b-2xl { border-bottom-left-radius: 1rem; border-bottom-right-radius: 1rem; }

/* Shadow utilities */
.shadow { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }

/* Transform utilities */
.transform { transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); }
.translate-x-1 { --tw-translate-x: 0.25rem; transform: translateX(0.25rem); }
.translate-x-6 { --tw-translate-x: 1.5rem; transform: translateX(1.5rem); }

/* Transition utilities */
.transition { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-colors { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-transform { transition-property: transform; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }

/* Overflow utilities */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Interactive elements */
.hover\\:bg-gray-50:hover { background-color: #f9fafb; }

/* Focus utilities */
.focus\\:outline-none:focus { outline: 2px solid transparent; outline-offset: 2px; }

/* Responsive container */
.max-w-6xl { max-width: 72rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Custom dashboard styles */
.test-row-btn {
    transition: all 0.2s ease;
    cursor: pointer;
}

.test-row-btn:hover {
    background-color: #f9fafb !important;
}

.test-expand-icon {
    transition: transform 0.2s ease;
}

.rerun-btn {
    transition: all 0.2s ease;
}

.rerun-btn:hover {
    background-color: #374151;
}

.ab-filter-btn {
    transition: all 0.2s ease;
    cursor: pointer;
}

.ab-filter-btn:hover {
    opacity: 0.8;
}

/* Table styles */
.min-w-full { min-width: 100%; }

/* Inline block */
.inline-block { display: inline-block; }

/* Min height */
.min-h-screen { min-height: 100vh; }

/* Background gradient */
.bg-gradient-to-b {
    background-image: linear-gradient(to bottom, var(--tw-gradient-stops));
}

.from-white {
    --tw-gradient-from: #ffffff;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(255, 255, 255, 0));
}

.to-gray-50 {
    --tw-gradient-to: #f9fafb;
}

/* Ensure proper stacking */
.dashboard-container * {
    position: relative;
}

/* Debug mode - ensure visibility */
.dashboard-container.visible {
    background: linear-gradient(to bottom, #ffffff, #f9fafb) !important;
}

.dashboard-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Risk severity indicators */
.risk-critical {
    border-left: 4px solid #dc2626;
}

.risk-high {
    border-left: 4px solid #ea580c;
}

.risk-medium {
    border-left: 4px solid #d97706;
}

.risk-low {
    border-left: 4px solid #65a30d;
}

/* Status indicators */
.status-pass {
    background-color: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.status-fail {
    background-color: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

/* Background colors */
.bg-white { background-color: #ffffff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-gray-300 { background-color: #d1d5db; }
.bg-gray-900 { background-color: #111827; }
.bg-green-50 { background-color: #f0fdf4; }
.bg-green-400 { background-color: #4ade80; }
.bg-green-500 { background-color: #22c55e; }
.bg-red-50 { background-color: #fef2f2; }
.bg-red-500 { background-color: #ef4444; }
.bg-amber-50 { background-color: #fffbeb; }
.bg-amber-400 { background-color: #fbbf24; }
.bg-orange-500 { background-color: #f97316; }

/* Text colors */
.text-white { color: #ffffff; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }
.text-green-700 { color: #15803d; }
.text-red-700 { color: #b91c1c; }
.text-amber-700 { color: #b45309; }

/* Border colors */
.border { border-width: 1px; }
.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }
.border-green-200 { border-color: #bbf7d0; }
.border-red-200 { border-color: #fecaca; }
.border-amber-200 { border-color: #fde68a; }
.border-t { border-top-width: 1px; }
.border-b { border-bottom-width: 1px; }

/* Rounded corners */
.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }
.rounded-b-xl { border-bottom-left-radius: 0.75rem; border-bottom-right-radius: 0.75rem; }

/* Shadow */
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }

/* Transform */
.transform { transform: var(--tw-transform); }
.transition { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; }
.transition-colors { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; }
.transition-transform { transition-property: transform; }

.translate-x-1 { transform: translateX(0.25rem); }
.translate-x-5 { transform: translateX(1.25rem); }
.translate-x-6 { transform: translateX(1.5rem); }
.rotate-0 { transform: rotate(0deg); }
.rotate-180 { transform: rotate(180deg); }

/* Whitespace */
.whitespace-pre-wrap { white-space: pre-wrap; }

/* Leading/Line Height */
.leading-tight { line-height: 1.25; }
.leading-snug { line-height: 1.375; }

/* Tracking/Letter Spacing */
.tracking-wide { letter-spacing: 0.025em; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.inset-y-0 { top: 0; bottom: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Opacity */
.opacity-0 { opacity: 0; }
.opacity-1 { opacity: 1; }

/* Smooth transitions for show/hide */
.dashboard-container {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.dashboard-container.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

/* Ensure dashboard takes full space when visible */
.dashboard-container:not(.hidden) {
    display: block;
    width: 100%;
}

/* Hide dashboard by default */
.dashboard-container {
    display: none;
}

.dashboard-container.visible {
    display: block;
}

/* =============================================================================
   通用按钮重置和微调样式
   ============================================================================= */

/* 通用按钮重置 */
.dashboard_view_button { 
    font: inherit; 
    background: transparent; 
    border: 0; 
    outline: none;
}

button:focus { 
    outline: none; 
}

/* 列表主行按钮 */
.test-row-btn { 
    border: 0; 
    background: transparent; 
    cursor: pointer; 
    transition: background-color 0.2s ease;
}

.test-row-btn:hover { 
    background-color: #f9fafb !important; 
}

/* Export JSON 视觉：用外层卡片边框，按钮本身无边框 */
#exportBtn { 
    border: 0; 
    background: transparent; 
    padding: 0; 
    cursor: pointer;
}

#exportBtn:hover {
    opacity: 0.8;
}

/* Debug Toggle 按钮重置 */
#debugToggle {
    border: 0;
    outline: none;
}

#debugToggle:focus {
    outline: none;
}

/* A/B Testing 筛选按钮 */
.ab-filter-btn {
    border: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ab-filter-btn:hover {
    opacity: 0.8;
}

/* Rerun 按钮 */
.rerun-btn {
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rerun-btn:hover {
    background-color: #f9fafb !important;
    border-color: #d1d5db;
}

/* =============================================================================
   个别微调（对齐/不换行/视觉）
   ============================================================================= */

/* 右侧操作区固定，不被挤换行 */
.shrink-0 { 
    flex-shrink: 0; 
}

.flex-shrink-0 { 
    flex-shrink: 0; 
}

/* RisksPanel 圆点基线对齐 */
.mt-0-5 { 
    margin-top: 0.125rem; 
}

/* 数字等宽，避免跳动 */
.tabular-nums { 
    font-variant-numeric: tabular-nums; 
}

/* 确保所有按钮都有正确的cursor */
button, .test-row-btn, .ab-filter-btn, .rerun-btn, #exportBtn, #debugToggle {
    cursor: pointer;
}

/* 移除所有按钮的默认outline */
button:focus, .test-row-btn:focus, .ab-filter-btn:focus, .rerun-btn:focus, #exportBtn:focus, #debugToggle:focus {
    outline: none;
}

/* 移除 Set A/B/C 按钮的黑色边框 */
.segment-btn {
    border: none;
    /* 确保所有状态下的按钮尺寸一致 */
    box-sizing: border-box;
    min-height: 28px; /* 固定最小高度 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 修改选中的 Set 按钮颜色为深灰色而不是纯黑色 */
.segment-btn.bg-gray-900 {
    background-color: #4b5563 !important; /* 深灰色而不是纯黑 */
    /* 确保选中状态下尺寸不变 */
    padding: 0.25rem 0.5rem !important; /* 与 px-2 py-1 相同 */
}

/* 确保未选中状态的按钮也有相同的尺寸 */
.segment-btn.bg-gray-100 {
    padding: 0.25rem 0.5rem !important; /* 与选中状态相同 */
}

/* 让test主标题颜色更黑 */
.test-row-btn .text-gray-900 {
    color: #000000 !important; /* 纯黑色让标题更清晰 */
}
