/* ============================================
   EU HTA PICOS FINDER - Module 4 Styles
   ============================================ */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --success-color: #059669;
    --warning-color: #d97706;
    --error-color: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
}

/* ============ Navigation ============ */

.navbar {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.nav-brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.nav-logo {
    height: 40px;
    width: auto;
    display: block;
}

.nav-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e3a8a;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-email {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* ============ Main Content ============ */

.main-content {
    min-height: calc(100vh - 140px);
    padding: 2rem;
}

/* ============ Flash Messages ============ */

.flash-messages {
    max-width: 600px;
    margin: 0 auto 2rem;
}

.flash {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
}

.flash-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.flash-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.flash-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ============ Buttons ============ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-100);
}

.btn-full {
    width: 100%;
}

/* ============ Auth Pages ============ */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 140px);
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--gray-500);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--gray-500);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ============ Search Page ============ */

.search-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
}

.search-hero {
    text-align: center;
    margin-bottom: 3rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--gray-500);
    margin-bottom: 2.5rem;
}

.search-form {
    margin-bottom: 2rem;
}

.search-input-wrapper {
    display: flex;
    gap: 0.5rem;
    background: white;
    padding: 0.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.search-input {
    flex: 1;
    padding: 1rem 1.25rem;
    border: none;
    font-size: 1rem;
    background: transparent;
    outline: none;
}

.search-input::placeholder {
    color: var(--gray-400);
}

.search-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-button:hover {
    background: var(--primary-dark);
}

.search-examples {
    text-align: center;
    color: var(--gray-500);
}

.search-examples p {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.search-examples ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.example-link {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background: white;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.example-link:hover {
    background: var(--primary-color);
    color: white;
}

.available-countries {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
}

.available-countries h3 {
    font-size: 1rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.country-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.country-badge {
    padding: 0.375rem 0.75rem;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 20px;
    font-size: 0.875rem;
}

/* ============ Results Page ============ */

.results-container {
    max-width: 1200px;
    margin: 0 auto;
}

.results-header {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.back-link {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.back-link:hover {
    text-decoration: underline;
}

.results-header h1 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.query-display {
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.query-display .label {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.query-display .query-text {
    color: var(--gray-800);
    font-weight: 500;
}

.extracted-components {
    margin-top: 1.5rem;
}

.extracted-components h3 {
    font-size: 1rem;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
}

.component-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.component-tag {
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.component-tag.disease { background: #dbeafe; color: #1e40af; }
.component-tag.setting { background: #dcfce7; color: #166534; }
.component-tag.line { background: #fef3c7; color: #92400e; }
.component-tag.biomarker { background: #fce7f3; color: #9d174d; }
.component-tag.drug { background: #e0e7ff; color: #3730a3; }
.component-tag.prior-therapy { background: #f3e8ff; color: #7c3aed; }

/* ============ Country Cards ============ */

.results-grid {
    display: grid;
    gap: 1.5rem;
}

.country-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.country-card.found {
    border-left: 4px solid var(--success-color);
}

.country-card.not-found {
    border-left: 4px solid var(--warning-color);
}

.country-card.no-data {
    border-left: 4px solid var(--gray-400);
}

.country-header {
    padding: 1.25rem 1.5rem;
    background: var(--gray-50);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
}

.country-name {
    font-size: 1.25rem;
    font-weight: 600;
}

.status-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-found { background: #d1fae5; color: #065f46; }
.status-not_found { background: #fef3c7; color: #92400e; }
.status-no_data { background: var(--gray-200); color: var(--gray-600); }
.status-error { background: #fee2e2; color: #991b1b; }

.country-content {
    padding: 1.5rem;
}

.match-info {
    margin-bottom: 1.5rem;
}

.match-reason {
    color: var(--gray-600);
    margin-bottom: 0.75rem;
}

.match-details {
    display: flex;
    gap: 0.5rem;
}

.match-detail {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.match-detail.matched { background: #d1fae5; color: #065f46; }
.match-detail.unmatched { background: #fee2e2; color: #991b1b; }

.indication-section,
.populations-section,
.outcomes-section {
    margin-bottom: 1.5rem;
}

.indication-section h3,
.populations-section h3,
.outcomes-section h3 {
    font-size: 1rem;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.ema-indication {
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
    font-style: italic;
}

.meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.meta-info strong {
    color: var(--gray-700);
}

/* ============ Population Cards ============ */

.population-count {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--gray-500);
}

.population-card {
    background: #e0f2fe;
    padding: 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    border-left: 4px solid #0284c7;
    box-shadow: var(--shadow-sm);
}

.population-card:nth-child(even) {
    background: #dbeafe;
    border-left-color: #2563eb;
}

.population-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.population-number {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #0284c7;
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.population-card:nth-child(even) .population-number {
    background: #2563eb;
}

.assessment-date {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.7);
    color: var(--gray-700);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.population-text {
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--gray-800);
}

/* Source dropdown styling */
.source-details {
    margin-bottom: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.5);
}

.source-details summary {
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-600);
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.source-details summary:hover {
    color: var(--primary-color);
}

.source-details summary::-webkit-details-marker {
    display: none;
}

.source-details summary::before {
    content: '▶';
    display: inline-block;
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.source-details[open] summary::before {
    transform: rotate(90deg);
}

.source-info {
    padding: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: white;
}

.source-info p {
    margin: 0.5rem 0;
    font-size: 0.85rem;
    color: var(--gray-700);
    line-height: 1.5;
}

.source-info p:first-child {
    margin-top: 0;
}

.source-info p:last-child {
    margin-bottom: 0;
}

.source-info strong {
    color: var(--gray-600);
    font-weight: 600;
}

.comparators h5 {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin: 1rem 0 0.5rem;
}

.comparator-list {
    list-style: none;
    padding-left: 0;
}

.comparator-list li {
    padding: 0.375rem 0;
    padding-left: 1.25rem;
    position: relative;
}

.comparator-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.comparator-list.appropriate li::before { background: var(--success-color); }
.comparator-list.inappropriate li::before { background: var(--error-color); }

.justification {
    margin-top: 1rem;
    padding: 0.75rem;
    background: white;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    color: var(--gray-600);
}

.justification p {
    white-space: pre-wrap;
    line-height: 1.6;
    margin: 0;
}

.justification h5 {
    margin-bottom: 0.5rem;
}

/* Assumption badge for added interventions */
.assumption-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.2rem 0.6rem;
    background: #fef3c7;
    color: #92400e;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border: 1px solid #fcd34d;
}

/* Assessment context styling */
.assessment-context {
    padding: 1rem;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    color: var(--gray-700);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Indication section spacing */
.indication-section {
    margin-top: 1rem;
}

/* Query invalid alert */
.query-invalid-alert {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: var(--border-radius);
    border: 2px solid #f59e0b;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--shadow-md);
}

.query-invalid-alert .alert-icon {
    font-size: 2rem;
    color: #d97706;
    line-height: 1;
}

.query-invalid-alert .alert-content h3 {
    color: #92400e;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.query-invalid-alert .alert-issue {
    color: #78350f;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.query-invalid-alert .alert-suggestion {
    color: #92400e;
    margin-bottom: 1rem;
}

.query-invalid-alert .example-queries {
    background: rgba(255, 255, 255, 0.6);
    padding: 1rem;
    border-radius: var(--border-radius);
}

.query-invalid-alert .example-queries p {
    color: #78350f;
    margin-bottom: 0.5rem;
}

.query-invalid-alert .example-queries ul {
    margin-left: 1.5rem;
    color: #92400e;
}

.query-invalid-alert .example-queries li {
    margin-bottom: 0.25rem;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
}

/* Status badge for refine search */
.status-refine_search {
    background: #fef3c7;
    color: #92400e;
}

/* Population filter note */
.population-filter-note {
    margin: 1rem 0;
    padding: 0.875rem 1rem;
    background: #fef3c7;
    border-radius: var(--border-radius);
    border-left: 4px solid #f59e0b;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem;
}

.filter-icon {
    color: #d97706;
    font-size: 1.1rem;
}

.filter-text {
    color: #92400e;
    font-weight: 500;
    flex: 1;
}

.excluded-details {
    width: 100%;
    margin-top: 0.5rem;
}

.excluded-details summary {
    cursor: pointer;
    color: #d97706;
    font-size: 0.875rem;
    font-weight: 500;
}

.excluded-details summary:hover {
    text-decoration: underline;
}

.excluded-list {
    margin-top: 0.5rem;
    padding-left: 1.25rem;
    font-size: 0.875rem;
}

.excluded-list li {
    margin-bottom: 0.75rem;
    color: var(--gray-700);
}

.excluded-list li em {
    color: var(--gray-500);
    font-size: 0.8125rem;
}

/* Comparators section titles */
.comparators-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--success-color);
}

.comparators-title.inappropriate-title {
    border-bottom-color: var(--error-color);
    margin-top: 1.25rem;
}

/* Comparator list container */
.comparator-list-container {
    margin-bottom: 1rem;
}

/* Justification section */
.justification {
    margin-top: 1.25rem;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.justification-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.justification-content {
    font-size: 0.9rem;
    line-height: 1.7;
}

.hta-justification {
    margin-bottom: 1rem;
}

.justification-text {
    color: var(--gray-700);
    margin: 0;
}

.assumption-explanation {
    margin-top: 1rem;
    padding: 0.875rem;
    background: #fef3c7;
    border-radius: var(--border-radius);
    border-left: 3px solid #f59e0b;
}

.assumption-note {
    margin: 0;
    color: var(--gray-700);
    font-size: 0.875rem;
}

.assumption-note em {
    color: var(--primary-dark);
}

/* ============ Outcomes ============ */

.outcomes-grid {
    display: grid;
    gap: 0.75rem;
}

.outcome-card {
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--gray-300);
}

.outcome-card.outcome-relevant { border-left-color: var(--success-color); }
.outcome-card.outcome-non-relevant { border-left-color: var(--warning-color); }

.outcome-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.endpoint {
    font-weight: 500;
}

.relevance-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.relevance-badge.relevant { background: #d1fae5; color: #065f46; }
.relevance-badge.non-relevant { background: #fef3c7; color: #92400e; }

.outcome-justification {
    font-size: 0.8125rem;
    color: var(--gray-600);
    margin: 0;
}

/* Outcome Categories */
.outcome-category {
    margin-bottom: 1.25rem;
}

.outcome-category:last-child {
    margin-bottom: 0;
}

.category-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    display: inline-block;
}

.category-title.mortality-morbidity {
    background: #fef2f2;
    color: #991b1b;
    border-left: 3px solid #dc2626;
}

.category-title.quality-of-life {
    background: #f5f3ff;
    color: #5b21b6;
    border-left: 3px solid #7c3aed;
}

.category-title.safety {
    background: #fffbeb;
    color: #92400e;
    border-left: 3px solid #f59e0b;
}

.hta-recommendation {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.recommendation-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.decision {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.875rem;
}

.decision-recommended { background: #d1fae5; color: #065f46; }
.decision-not-recommended { background: #fee2e2; color: #991b1b; }

.benefit-level,
.confidence {
    padding: 0.25rem 0.5rem;
    background: var(--gray-200);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--gray-600);
}

.rationale {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.5;
}

/* ============ Outcomes ============ */

.outcomes-grid {
    display: grid;
    gap: 0.75rem;
}

.outcome-card {
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--gray-300);
}

.outcome-card.outcome-relevant { border-left-color: var(--success-color); }
.outcome-card.outcome-non-relevant { border-left-color: var(--warning-color); }

.outcome-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.endpoint {
    font-weight: 500;
}

.relevance-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.relevance-badge.relevant { background: #d1fae5; color: #065f46; }
.relevance-badge.non-relevant { background: #fef3c7; color: #92400e; }

.outcome-card .justification {
    margin-top: 0;
    padding: 0;
    background: transparent;
    font-size: 0.8125rem;
}

/* ============ Not Found / No Data ============ */

.not-found-message,
.no-data-message {
    color: var(--gray-500);
    font-style: italic;
}

/* ============ Footer ============ */

.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--gray-400);
    font-size: 0.875rem;
}

/* ============ EU-27 Consolidation ============ */

.consolidation-section {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.consolidate-btn {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    border: none;
    padding: 1.25rem 2.5rem;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.consolidate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgb(0 0 0 / 0.2);
}

.consolidate-btn .btn-icon {
    font-size: 1.5rem;
}

.consolidate-btn .btn-description {
    font-size: 0.85rem;
    font-weight: 400;
    opacity: 0.9;
}

.consolidation-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.consolidated-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    margin: 2rem 0;
    overflow: hidden;
}

.consolidated-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.consolidated-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close-consolidated {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-consolidated:hover {
    background: rgba(255, 255, 255, 0.3);
}

#consolidatedContent {
    padding: 2rem;
}

.consolidation-summary {
    background: var(--gray-50);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.consolidation-summary h3 {
    margin-bottom: 1rem;
    color: var(--gray-700);
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat {
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.stat.reduction {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat.reduction .stat-value {
    color: white;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.stat.reduction .stat-label {
    color: rgba(255, 255, 255, 0.9);
}

.countries-included {
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius);
    color: var(--gray-600);
}

.consolidated-populations h3 {
    margin-bottom: 1.5rem;
    color: var(--gray-700);
}

.consolidated-pop-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s;
}

.consolidated-pop-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.consolidated-pop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-100);
}

.pop-number {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.contributing-countries {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.country-badge {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.pop-description {
    margin-bottom: 1.5rem;
}

.pop-description h4 {
    font-size: 0.9rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pop-description p {
    color: var(--gray-700);
    line-height: 1.6;
}

.consolidated-comparators {
    margin-bottom: 1.5rem;
}

.consolidated-comparators h4 {
    font-size: 0.95rem;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
}

.country-details {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--gray-100);
}

.country-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-color);
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.country-details summary::-webkit-details-marker {
    display: none;
}

.country-details summary::before {
    content: '\25B6';
    display: inline-block;
    transition: transform 0.2s;
}

.country-details[open] summary::before {
    transform: rotate(90deg);
}

.by-country-scroll-container {
    overflow-x: auto;
    margin-top: 1rem;
    padding-bottom: 0.5rem;
}

.by-country-grid {
    display: flex;
    gap: 1rem;
    min-width: min-content;
}

.country-detail-card {
    background: var(--gray-50);
    border-radius: var(--border-radius);
    padding: 1rem;
    min-width: 350px;
    max-width: 350px;
    flex-shrink: 0;
}

.country-detail-card h5 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.country-pop-desc {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.country-comparators,
.country-recommendation,
.country-justification {
    margin-bottom: 1rem;
}

.country-comparators strong,
.country-recommendation strong,
.country-justification strong {
    display: block;
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.country-justification p {
    font-size: 0.875rem;
    color: var(--gray-700);
    line-height: 1.6;
    margin: 0.5rem 0;
    white-space: pre-wrap;
}

.country-comparators ul {
    list-style: none;
    padding-left: 0;
}

.country-comparators li {
    padding: 0.25rem 0;
    color: var(--gray-700);
    font-size: 0.875rem;
}

.country-comparators li::before {
    content: '✓ ';
    color: var(--success-color);
    font-weight: bold;
    margin-right: 0.25rem;
}

.country-recommendation p {
    font-size: 0.875rem;
    color: var(--gray-700);
    margin: 0.25rem 0;
}

.assumption-badge {
    background: #fbbf24;
    color: #78350f;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    white-space: nowrap;
}

.assumption-note {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-style: italic;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.consolidation-message,
.consolidation-error {
    padding: 2rem;
    text-align: center;
    color: var(--gray-600);
    font-size: 1.1rem;
}

.consolidation-error {
    color: var(--error-color);
}

/* Consolidated Outcomes */
.consolidated-outcomes {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--gray-200);
}

.consolidated-outcomes h3 {
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.outcomes-description {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.outcome-countries {
    color: var(--gray-500);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* ============ Responsive ============ */

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .search-input-wrapper {
        flex-direction: column;
    }

    .search-button {
        justify-content: center;
    }

    .country-header {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .meta-info {
        flex-direction: column;
        gap: 0.5rem;
    }
}


/* ============ Structured Lists (for Last Assessed Therapy and bullet sections) ============ */

.structured-list {
    list-style: disc;
    padding-left: 1.5rem;
    margin: 0;
}

.structured-list li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.structured-list strong {
    color: var(--gray-700);
    font-weight: 600;
}

.comp-list {
    list-style: disc;
    padding-left: 1.5rem;
    margin: 0;
}

.comp-list li {
    margin-bottom: 0.25rem;
}


/* Country Tag Styles - Light green for interventions, dark green for original */
.country-tag-intervention {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    margin: 0 0.25rem;
    background-color: #86efac; /* Light green */
    color: #166534; /* Dark green text */
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.country-tag-original {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    margin: 0 0.25rem;
    background-color: #16a34a; /* Dark green */
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.country-tag.inappropriate {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    margin: 0 0.25rem;
    background-color: #fca5a5; /* Light red */
    color: #991b1b; /* Dark red text */
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ============ Consolidation Banners ============ */

.consolidation-success-banner {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 2px solid #28a745;
    color: #155724;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    animation: slideDown 0.3s ease-out;
}

.consolidation-success-banner .banner-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.consolidation-success-banner .icon {
    font-size: 1.5rem;
    font-weight: bold;
    color: #28a745;
}

.consolidation-success-banner .message {
    font-size: 1rem;
    font-weight: 500;
}

.consolidation-warning-banner {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #ffc107;
    color: #856404;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-md);
    animation: slideDown 0.3s ease-out;
}

.consolidation-warning-banner .icon {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffc107;
}

.consolidation-warning-banner .message {
    font-size: 1rem;
    font-weight: 500;
}

.toggle-view-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.toggle-view-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.toggle-view-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Additional styling for consolidated view container */
#consolidatedView {
    margin: 1.5rem 0;
    animation: fadeIn 0.3s ease-out;
}

#countryView {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Simple toggle button in header */
.toggle-view-btn-simple {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    margin-left: 1rem;
    transition: all 0.2s ease;
}

.toggle-view-btn-simple:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.toggle-view-btn-simple:active {
    transform: translateY(0);
}
