/* Shared theme tokens for Clare (light/dark) */
:root {
  /* Primary backgrounds */
  --bg: #ffffff;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #fafbfc;

  /* Text colors */
  --fg: #0f172a;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #868e96;
  --muted-fg: #475569;

  /* Card and borders */
  --card: #f8fafc;
  --card-border: #e2e8f0;
  --border-color: #dee2e6;
  --border-light: #e5e7eb;

  /* Brand colors */
  --color-primary: #990033;  /* Clare maroon */
  --color-primary-dark: #7a0028;
  --color-primary-darker: #660022;
  --color-primary-light: rgba(153, 0, 51, 0.1);
  --color-primary-lighter: rgba(153, 0, 51, 0.05);

  /* Gray scale colors */
  --color-gray-50: #f8f9fa;
  --color-gray-100: #f1f3f5;
  --color-gray-200: #e9ecef;
  --color-gray-300: #dee2e6;
  --color-gray-400: #ced4da;
  --color-gray-500: #6c757d;
  --color-gray-600: #495057;
  --color-gray-700: #343a40;
  --color-gray-800: #212529;

  /* Accent and status colors */
  --accent: #0ea5e9;
  --accent-contrast: #ffffff;
  --accent-muted: #7dd3fc;
  --warning: #f59e0b;
  --warning-light: #fff3cd;
  --danger: #ef4444;
  --danger-light: #f8d7da;
  --success: #10b981;
  --success-light: #d4edda;
  --info: #17a2b8;
  --info-light: #d1ecf1;
  --link: #0ea5e9;
  --chip: #e2e8f0;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 8px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.06);
}

[data-theme="dark"] {
  /* Primary backgrounds */
  --bg: #1a1a1a;
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #242424;

  /* Text colors */
  --fg: #e5e7eb;
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted: #8a8a8a;
  --muted-fg: #94a3b8;

  /* Card and borders */
  --card: #2d2d2d;
  --card-border: #404040;
  --border-color: #3a3a3a;
  --border-light: #404040;

  /* Brand colors - maroon stays consistent */
  --color-primary: #990033;  /* Clare maroon - same in dark */
  --color-primary-dark: #7a0028;
  --color-primary-darker: #660022;
  --color-primary-light: rgba(153, 0, 51, 0.15);
  --color-primary-lighter: rgba(153, 0, 51, 0.1);

  /* Accent and status colors */
  --accent: #38bdf8;
  --accent-contrast: #1a1a1a;
  --accent-muted: #0b6ea7;
  --warning: #fbbf24;
  --danger: #f87171;
  --success: #34d399;
  --link: #7dd3fc;
  --chip: #2d2d2d;

  /* Shadows (darker for dark mode) */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.15);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
  --shadow-lg: 0 4px 8px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
}

/* Basic element mappings so templates can opt-in with vars */
body {
  font-family: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  padding-bottom: 80px;
}

a { color: var(--link); }

.card, .panel, .drawer, .box {
  background: var(--card);
  border-color: var(--card-border);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover { filter: brightness(0.95); }

.badge, .chip { background: var(--chip); color: var(--fg); }

/* Clare Logo Base Styles */
.logo-center {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

/* Enhanced Citation Overlay System */
.citation-link {
  color: #990033;
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  background: rgba(153, 0, 51, 0.05);
}

.citation-link:hover {
  background: rgba(153, 0, 51, 0.1);
  text-decoration: underline;
}

.citation-link.active {
  background: rgba(153, 0, 51, 0.15);
}

/* Enhanced Citation Bubble Styles */
.citation-bubble {
  position: absolute;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-width: 280px;
  opacity: 0;
  transform: scale(0.9) translateY(-10px);
  transition: all 0.2s ease;
  pointer-events: none;
}

.citation-bubble.show {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.citation-bubble.detailed {
  max-width: 400px;
  padding: 20px 24px;
}

/* Citation bubble arrow */
.citation-bubble::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 20px;
  width: 12px;
  height: 12px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-bottom: none;
  border-right: none;
  transform: rotate(45deg);
}

.citation-bubble-source {
  font-weight: 600;
  color: #990033;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.citation-bubble-source::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #990033;
  border-radius: 50%;
  flex-shrink: 0;
}

.citation-bubble-title {
  color: var(--fg);
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.3;
  font-size: 0.95rem;
}

.citation-bubble-link {
  color: #990033;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.citation-bubble-link:hover {
  text-decoration: underline;
}

.citation-bubble-link::after {
  content: '↗';
  font-size: 0.7rem;
}

/* Progressive disclosure button */
.show-details-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  margin-top: 8px;
  background: #990033;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.show-details-btn:hover {
  background: #7a0026;
  transform: translateY(-1px);
}

.show-details-btn::after {
  content: '→';
  transition: transform 0.2s ease;
}

.citation-bubble.detailed .show-details-btn {
  display: none;
}

/* Enhanced detailed view styles */
.citation-bubble.detailed .citation-evidence {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--card-border);
}

.evidence-grade {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #f0f9ff;
  border: 1px solid #0ea5e9;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #0369a1;
  margin-bottom: 8px;
}

.evidence-grade.grade-a {
  background: #dcfce7;
  border-color: #16a34a;
  color: #15803d;
}

.evidence-grade.grade-b {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #d97706;
}

.evidence-grade.grade-c {
  background: #fee2e2;
  border-color: #ef4444;
  color: #dc2626;
}

.publication-date {
  font-size: 0.8rem;
  color: var(--muted-fg);
  margin-bottom: 8px;
}

.citation-summary {
  font-size: 0.85rem;
  color: var(--muted-fg);
  line-height: 1.4;
  margin-bottom: 12px;
}

.clinical-details {
  background: var(--card);
  padding: 12px;
  border-radius: 6px;
  border-left: 3px solid #990033;
  margin-bottom: 12px;
}

.clinical-details-title {
  font-weight: 600;
  color: #990033;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.clinical-details-content {
  font-size: 0.85rem;
  color: var(--muted-fg);
  line-height: 1.4;
}

/* Dark mode adjustments */
[data-theme="dark"] .citation-bubble {
  background: var(--card);
  border-color: var(--card-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .citation-bubble::before {
  background: var(--card);
  border-color: var(--card-border);
}

[data-theme="dark"] .evidence-grade {
  background: rgba(240, 249, 255, 0.1);
  border-color: rgba(14, 165, 233, 0.3);
  color: #7dd3fc;
}

[data-theme="dark"] .evidence-grade.grade-a {
  background: rgba(220, 252, 231, 0.1);
  border-color: rgba(22, 163, 74, 0.3);
  color: #34d399;
}

[data-theme="dark"] .evidence-grade.grade-b {
  background: rgba(254, 243, 199, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

[data-theme="dark"] .evidence-grade.grade-c {
  background: rgba(254, 226, 226, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

[data-theme="dark"] .clinical-details {
  background: rgba(15, 23, 42, 0.5);
}

/* Mobile CSS removed - desktop only */

/* ===== HEADER STYLES ===== */
.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
  padding: 0;  /* Remove padding to allow absolute left positioning */
  min-height: 120px;
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

.header-content {
  width: 100%;  /* Full width */
  margin: 0;
  display: flex;
  justify-content: space-between;  /* Logo at absolute left, controls at absolute right */
  align-items: center;
  padding: 1rem 2rem;  /* Padding on content instead of parent */
}

.header .logo {
  text-decoration: none;
  display: flex;
  align-items: center;
}

.header h1 {
  color: var(--color-primary);
  margin: 0;
  font-size: 1.8em;
}

.header .title-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.header .subtitle {
  color: var(--text-secondary);
  font-size: 0.95em;
  margin: 0;
}

.auth-buttons {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Mobile CSS removed - desktop only */

/* ===== FOOTER STYLES =====*/
.page-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-light);
  padding: 0;  /* Remove padding to allow absolute positioning */
  z-index: 50;
  transition: all 0.3s ease;
}

.page-footer p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.footer-content {
  width: 100%;  /* Full width - no max-width constraint */
  display: flex;
  justify-content: space-between;  /* Left text at absolute left, right links at absolute right */
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 12px 24px;  /* Padding on content instead of parent */
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .footer-link:hover {
  color: #ffffff !important;
}

/* Footer with search box styling */
.page-footer.with-search {
  padding: 20px 24px 16px 24px;
  background: var(--bg-primary);
}

.page-footer .input-area.bottom {
  margin-bottom: 10px;
}

/* Mobile CSS removed - desktop only */
