/* SmartMed Space - Unified News Design
   Fancy but production-safe unified design for all news pages
   =========================================================== */

:root {
  --bg-dark: #0a0f1a;
  --bg-card: rgba(17, 24, 39, 0.95);
  --bg-card-solid: #111827;
  --accent-purple: #7c3aed;
  --accent-cyan: #06b6d4;
  --accent-teal: #14b8a6;
  --accent-gold: #f59e0b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: rgba(148, 163, 184, 0.15);
  --highlight-bg: rgba(124, 58, 237, 0.12);
  --highlight-border: #7c3aed;
  --success-green: #10b981;
  --link-color: #60a5fa;
  --link-hover: #93c5fd;
  --gradient-primary: linear-gradient(135deg, #7c3aed, #6d28d9);
  --gradient-secondary: linear-gradient(135deg, #06b6d4, #0891b2);
  --gradient-tertiary: linear-gradient(135deg, #f59e0b, #d97706);
}

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

body {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #0f172a 50%, #1e1b4b 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.7;
  padding: 20px;
}

/* Back Navigation - Unified */
.article-nav {
  max-width: 1200px;
  margin: 0 auto 20px;
  padding: 0.85rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.article-nav a {
  color: var(--accent-cyan);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.article-nav a:hover {
  color: var(--accent-purple);
  transform: translateX(-3px);
}

.article-nav a::before {
  content: '←';
  font-size: 1.1rem;
}

/* Container - Unified */
.container {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 
    0 8px 40px rgba(0, 0, 0, 0.4),
    0 0 60px rgba(124, 58, 237, 0.05);
  border: 1px solid var(--border-color);
  overflow: hidden;
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header - Unified */
header {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(6, 182, 212, 0.15));
  color: white;
  padding: 40px 30px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 10px rgba(124, 58, 237, 0.3);
}

header .week-date {
  font-size: 1.1em;
  color: var(--text-secondary);
  margin-bottom: 5px;
  font-weight: 500;
}

header .subtitle {
  font-size: 0.95em;
  color: var(--text-muted);
  font-style: italic;
}

/* Content Area */
.content {
  padding: 40px;
}

@media (max-width: 768px) {
  .content {
    padding: 20px;
  }
}

/* Section Styling */
.section {
  margin-bottom: 50px;
  position: relative;
}

.section::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gradient-primary);
  border-radius: 3px;
}

.section-content {
  padding-left: 20px;
}

.section-title {
  font-size: 1.8em;
  color: var(--accent-cyan);
  border-bottom: 2px solid var(--accent-purple);
  padding-bottom: 15px;
  margin-bottom: 25px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: '';
  width: 12px;
  height: 12px;
  background: var(--accent-purple);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-purple);
}

/* News Items - Enhanced */
.news-item {
  background: rgba(30, 41, 59, 0.6);
  border-left: 4px solid var(--accent-purple);
  padding: 25px;
  margin-bottom: 20px;
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.news-item::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 50px 50px;
  border-color: transparent transparent var(--accent-purple) transparent;
  opacity: 0.1;
  transition: opacity 0.3s ease;
}

.news-item:hover::before {
  opacity: 0.2;
}

.news-item:hover {
  background: rgba(30, 41, 59, 0.8);
  box-shadow: 0 6px 25px rgba(124, 58, 237, 0.15);
  transform: translateX(5px);
  border-left-color: var(--accent-cyan);
}

.news-item h3 {
  color: var(--accent-teal);
  margin-bottom: 12px;
  font-size: 1.3em;
  font-weight: 600;
  transition: color 0.3s ease;
}

.news-item:hover h3 {
  color: var(--accent-gold);
}

.news-item .date {
  color: var(--text-muted);
  font-size: 0.9em;
  margin-bottom: 10px;
  font-style: italic;
}

.news-item p {
  color: var(--text-secondary);
  margin-bottom: 15px;
  line-height: 1.8;
}

.news-item a {
  display: inline-block;
  background: var(--gradient-primary);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.95em;
  margin-top: 12px;
  transition: all 0.3s ease;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.2);
}

.news-item a:hover {
  background: var(--gradient-secondary);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
  transform: translateY(-2px);
}

/* Tables - Enhanced */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 25px 0;
  font-size: 0.95em;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

table th {
  background: var(--gradient-primary);
  color: white;
  padding: 18px 15px;
  text-align: left;
  font-weight: 600;
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

table td {
  padding: 16px 15px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: background 0.2s ease;
}

table tr:nth-child(even) {
  background: rgba(30, 41, 59, 0.4);
}

table tr:hover {
  background: rgba(124, 58, 237, 0.1);
  transform: scale(1.01);
}

table tr:last-child td {
  border-bottom: none;
}

table td a {
  color: var(--accent-cyan);
  text-decoration: underline;
  transition: color 0.2s ease;
}

table td a:hover {
  color: var(--accent-gold);
}

/* Highlight Boxes - Enhanced */
.highlight {
  background: linear-gradient(120deg, rgba(124, 58, 237, 0.15), rgba(6, 182, 212, 0.1));
  padding: 25px;
  border-radius: 12px;
  margin: 25px 0;
  border-left: 5px solid var(--accent-purple);
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.1);
  position: relative;
  overflow: hidden;
}

.highlight::before {
  content: '✨';
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 2rem;
  color: var(--accent-purple);
  opacity: 0.1;
}

.highlight h4 {
  color: var(--accent-cyan);
  margin-bottom: 15px;
  font-size: 1.3em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.highlight p,
.highlight li {
  color: var(--text-secondary);
  line-height: 1.8;
}

.perspective-box {
  background: rgba(6, 182, 212, 0.1);
  border-left: 5px solid var(--accent-cyan);
  padding: 25px;
  border-radius: 12px;
  margin: 25px 0;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.1);
}

.perspective-box h4 {
  color: var(--accent-teal);
  margin-bottom: 15px;
  font-size: 1.2em;
}

.perspective-box p {
  color: var(--text-secondary);
  line-height: 1.8;
}

.perspective-box em {
  color: var(--text-secondary);
  display: block;
  margin-bottom: 12px;
  font-style: italic;
}

.clinical-tips {
  background: rgba(124, 58, 237, 0.1);
  border-left: 5px solid var(--accent-purple);
  padding: 25px;
  border-radius: 12px;
  margin: 25px 0;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.1);
}

.clinical-tips h4 {
  color: var(--accent-purple);
  margin-bottom: 20px;
  font-size: 1.2em;
}

.clinical-tips ul {
  margin-left: 25px;
}

.clinical-tips li {
  margin-bottom: 12px;
  color: var(--text-secondary);
  line-height: 1.8;
  position: relative;
  padding-left: 15px;
}

.clinical-tips li::before {
  content: '•';
  color: var(--accent-cyan);
  position: absolute;
  left: 0;
}

.clinical-tips li strong {
  color: var(--accent-teal);
}

/* Metric Cards - Enhanced */
.key-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  margin: 30px 0;
}

.metric-card {
  background: var(--gradient-primary);
  color: white;
  padding: 30px 25px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 6px 25px rgba(124, 58, 237, 0.3);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.metric-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 10px 35px rgba(124, 58, 237, 0.4);
}

.metric-card .number {
  font-size: 2.5em;
  font-weight: bold;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.metric-card .label {
  font-size: 0.95em;
  opacity: 0.95;
  line-height: 1.4;
  position: relative;
  z-index: 1;
}

/* Tags - Enhanced */
.tag {
  display: inline-block;
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  padding: 6px 16px;
  border-radius: 25px;
  font-size: 0.85em;
  margin-right: 10px;
  margin-bottom: 10px;
  border: 1px solid rgba(6, 182, 212, 0.3);
  transition: all 0.3s ease;
  font-weight: 500;
}

.tag:hover {
  background: rgba(6, 182, 212, 0.3);
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.2);
}

/* External link indicator */
.external-link::after {
  content: ' ↗';
  color: var(--accent-cyan);
}

/* Footer - Unified */
footer {
  background: rgba(10, 15, 26, 0.8);
  color: var(--text-muted);
  padding: 30px;
  text-align: center;
  font-size: 0.9em;
  border-top: 1px solid var(--border-color);
  margin-top: 40px;
}

footer p {
  margin-bottom: 10px;
  line-height: 1.6;
}

footer a {
  color: var(--accent-cyan);
  text-decoration: none;
}

footer a:hover {
  color: var(--accent-purple);
  text-decoration: underline;
}

/* Archive Page Specific */
.archive-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  padding: 40px 30px;
  border: 1px solid var(--border-color);
}

.archive-container h1 {
  font-size: 2.3em;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 35px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.archive-menu {
  list-style: none;
  padding: 0;
  margin: 0 0 35px 0;
}

.archive-menu li {
  background: rgba(30, 41, 59, 0.4);
  border-left: 4px solid var(--accent-purple);
  margin-bottom: 20px;
  border-radius: 10px;
  padding: 20px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.archive-menu li::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  background: var(--gradient-secondary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.archive-menu li:hover {
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.15);
  background: rgba(30, 41, 59, 0.6);
  transform: translateX(5px);
}

.archive-menu li:hover::before {
  opacity: 1;
}

.archive-link {
  text-decoration: none;
  color: var(--text-primary);
  font-size: 1.2em;
  font-weight: 500;
  transition: all 0.3s ease;
  display: block;
  margin-bottom: 5px;
}

.archive-link:hover {
  color: var(--accent-cyan);
  transform: translateX(5px);
}

.week-label {
  color: var(--accent-purple);
  font-weight: 400;
  font-size: 0.95em;
  margin-left: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 15px;
  }

  header h1 {
    font-size: 1.8em;
  }

  .section-title {
    font-size: 1.4em;
  }

  .content {
    padding: 20px;
  }

  .news-item {
    padding: 20px;
  }

  table {
    font-size: 0.85em;
  }

  table th, table td {
    padding: 12px 10px;
  }

  .metric-card {
    padding: 20px 15px;
  }

  .metric-card .number {
    font-size: 2em;
  }

  .archive-container {
    padding: 30px 20px;
  }

  .archive-container h1 {
    font-size: 1.8em;
  }

  .archive-menu li {
    padding: 16px;
  }

  .archive-link {
    font-size: 1.1em;
  }
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: #000;
    padding: 0;
  }

  .article-nav {
    display: none;
  }

  .container {
    box-shadow: none;
    border: 1px solid #ddd;
    background: white;
    color: #000;
  }

  .metric-card {
    background: #667eea;
    -webkit-print-color-adjust: exact;
    color: white;
  }

  .news-item {
    background: #f8f9fa;
    color: #333;
    border-left-color: #667eea;
  }

  .highlight, .perspective-box, .clinical-tips {
    background: #f0f2f8;
    border-left-color: #667eea;
  }

  a {
    color: #0066cc;
    text-decoration: underline;
  }

  .tag {
    background: #e0e0e0;
    color: #333;
    border-color: #ccc;
  }
}

/* Animation Enhancements */
@media (prefers-reduced-motion: no-preference) {
  .news-item {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .metric-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  table tr {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(17, 24, 39, 0.5);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background: var(--accent-purple);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* Selection Highlighting */
::selection {
  background: var(--accent-purple);
  color: white;
}

/* Code blocks */
code {
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent-cyan);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: 'Fira Code', 'Monaco', monospace;
  font-size: 0.9em;
}

/* Blockquote styling */
blockquote {
  font-style: italic;
  color: var(--text-secondary);
  background: var(--highlight-bg);
  border-left: 4px solid var(--highlight-border);
  padding: 1.25rem 1.5rem;
  border-radius: 0 8px 8px 0;
  margin: 1.75rem 0;
  position: relative;
}

blockquote::before {
  content: '"';
  font-size: 3rem;
  color: var(--accent-purple);
  opacity: 0.3;
  position: absolute;
  margin-left: -1rem;
  margin-top: -0.5rem;
}

/* Joke/Snarky asides */
.joke,
.snarky {
  font-style: italic;
  color: var(--text-muted);
  background: rgba(6, 182, 212, 0.08);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  border-left: 3px solid var(--accent-cyan);
}

/* Lists */
ul, ol {
  margin: 1rem 0 1.5rem 1.5rem;
  color: var(--text-secondary);
}

li {
  margin-bottom: 0.6rem;
}

li b, li strong {
  color: var(--accent-cyan);
}

/* Images */
.img-section {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.75rem;
  margin: 2rem 0;
}

.img-block {
  text-align: center;
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 300px;
}

.img-block img,
img:not([class]) {
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(124, 58, 237, 0.1);
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.img-block img:hover,
img:not([class]):hover {
  transform: scale(1.02);
  box-shadow: 
    0 8px 30px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(124, 58, 237, 0.15);
}

.img-caption {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 0.5rem;
}

/* Standalone images */
body > img,
.container > img,
.article-container > img,
main > img,
p > img {
  display: block;
  margin: 2rem auto;
  max-width: 85%;
  border-radius: 12px;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(124, 58, 237, 0.1);
  border: 1px solid var(--border-color);
}

/* Main element */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

main section {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
}

/* Spotlight entries */
.spotlight-container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 2.5rem 4rem;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid var(--border-color);
}

.spotlight-entry {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.spotlight-entry:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.spotlight-entry h2,
.spotlight-entry h3 {
  color: var(--accent-cyan);
  border-bottom: none;
  margin-top: 0;
}

/* Reference sections */
.reference,
.sources {
  font-size: 0.95rem;
  color: var(--text-muted);
  background: rgba(6, 182, 212, 0.08);
  border-left: 4px solid var(--accent-cyan);
  padding: 1.25rem 1.5rem;
  border-radius: 0 8px 8px 0;
  margin-top: 2rem;
}

.sources h3 {
  color: var(--accent-cyan);
  margin-top: 0;
}

.sources ul {
  margin-bottom: 0;
}

/* Article header */
header {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(6, 182, 212, 0.1));
  border-bottom: 1px solid var(--border-color);
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  backdrop-filter: blur(10px);
}

header h1 {
  margin-bottom: 0.5rem;
}

header p {
  color: var(--text-muted);
  margin: 0;
}

/* Article footer */
footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
}

/* Additional responsive adjustments */
@media (max-width: 600px) {
  h1 {
    font-size: 1.65rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .img-section {
    gap: 1rem;
  }

  .img-block {
    flex: 1 1 100%;
    max-width: 100%;
  }

  table {
    font-size: 0.85rem;
  }

  th, td {
    padding: 0.6rem 0.5rem;
  }
}

/* Utility classes */
.text-center {
  text-align: center;
}

.mt-4 {
  margin-top: 1.5rem;
}

.mb-4 {
  margin-bottom: 1.5rem;
}

.p-4 {
  padding: 1.5rem;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-dark: #0a0f1a;
    --bg-card: rgba(17, 24, 39, 0.95);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}