/* ===== CSS Variables & Theme ===== */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: 0.2s ease;

    /* Model colors */
    --gpt4o: #10a37f;
    --claude: #d97706;
    --gemini: #4285f4;
    --llama: #7c3aed;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== Layout ===== */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Header ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 32px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 14px;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    transform: scale(1.05);
}

.icon-moon {
    display: none;
}

[data-theme="dark"] .icon-sun {
    display: none;
}

[data-theme="dark"] .icon-moon {
    display: inline;
}

/* ===== Filters ===== */
.filters {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 20px 0;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 200px;
    transition: var(--transition);
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.stats {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 14px;
}

.divider {
    opacity: 0.5;
}

/* ===== Case Grid ===== */
.case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px 0 40px;
}

.case-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.case-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gpt4o), var(--claude), var(--gemini), var(--llama));
    opacity: 0;
    transition: var(--transition);
}

.case-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

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

.case-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.case-id {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.subspecialty-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
}

.case-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.4;
}

.case-models {
    display: flex;
    gap: 6px;
}

.model-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.model-dot.gpt4o {
    background: var(--gpt4o);
}

.model-dot.claude {
    background: var(--claude);
}

.model-dot.gemini {
    background: var(--gemini);
}

.model-dot.llama {
    background: var(--llama);
}

/* Restricted Overlay */
.model-comparison-container {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 400px;
    /* Ensure overlay text doesn't get cut off when content is empty */
}

.restricted-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

[data-theme="dark"] .restricted-overlay {
    background: rgba(15, 23, 42, 0.92);
}

.restricted-content {
    max-width: 400px;
    padding: 30px;
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

.restricted-content svg {
    color: var(--accent);
    margin-bottom: 20px;
}

.restricted-content h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.restricted-content p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.restricted-hint {
    font-size: 0.85rem !important;
    font-style: italic;
    opacity: 0.8;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ===== Footer ===== */
.case-detail {
    padding: 20px 0 40px;
}

.case-detail.hidden {
    display: none;
}

.btn-back {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 16px;
    transition: var(--transition);
}

.btn-back:hover {
    color: var(--accent-hover);
}

.case-header {
    margin-bottom: 24px;
}

.case-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.citation {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent);
}

/* ===== Question Tabs ===== */
.question-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    background: var(--bg-tertiary);
}

.tab-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ===== Model Comparison ===== */
.model-comparison {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

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

@media (max-width: 768px) {
    .model-comparison {
        grid-template-columns: 1fr;
    }
}

.model-column {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.model-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.model-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
    color: white;
}

.model-badge.gpt4o {
    background: var(--gpt4o);
}

.model-badge.claude {
    background: var(--claude);
}

.model-badge.gemini {
    background: var(--gemini);
}

.model-badge.llama {
    background: var(--llama);
}

.model-content {
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
    max-height: 500px;
    overflow-y: auto;
}

.model-content strong {
    color: var(--accent);
}

.model-content .random-answer {
    display: inline-block;
    margin-top: 12px;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
}

/* ===== Footer ===== */
.footer {
    padding: 24px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    text-decoration: underline;
}

/* ===== Utilities ===== */
.hidden {
    display: none !important;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ===== Loading Animation ===== */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s infinite;
    color: var(--text-muted);
    font-style: italic;
}

/* ===== Locked Tabs ===== */
.tab-btn.locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-tertiary);
}

.tab-btn.locked:hover {
    background: var(--bg-tertiary);
    transform: none;
}

/* ===== Evaluation Preview ===== */
.evaluation-preview {
    margin-top: 16px;
    padding: 12px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
    font-size: 13px;
    color: var(--text-secondary);
}

.evaluation-preview strong {
    color: var(--accent);
}

/* ===== Request Dataset Link ===== */
#request-dataset-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition);
}

#request-dataset-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}