/* ==========================================================================
   calc-med.ru — Modern Evidence-Based Medical Design System
   Semantic, Responsive, Fast Loading, SSR-Friendly
   ========================================================================== */

:root {
  --primary-50: #f0f9ff;
  --primary-100: #e0f2fe;
  --primary-500: #0284c7;
  --primary-600: #0369a1;
  --primary-700: #075985;
  --primary-900: #0c4a6e;
  
  --medical-teal: #0d9488;
  --medical-green: #10b981;
  --medical-amber: #f59e0b;
  --medical-rose: #f43f5e;
  
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --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);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--slate-800);
  background-color: #f8fafc;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-700);
}

/* Global Text Justification for all regular content text */
p, 
.card-desc, 
.article-body p, 
.article-body li, 
.calculator-article-box p, 
.calculator-article-box li,
.wysiwyg-content p, 
.wysiwyg-content li, 
.affiliate-text, 
.footer-disclaimer, 
.hero-desc, 
.category-desc, 
#res-summary,
.faq-answer,
.disclaimer-box,
.lead-desc,
.step-desc {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Container */
.container {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Header & Banner Slot */
.global-banner-slot {
  width: 100%;
  background: #0f172a;
  overflow: hidden;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.global-banner-slot img {
  max-width: 100%;
  max-height: 90px;
  object-fit: cover;
  display: block;
  margin: 0 auto;
}

.sticky-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--slate-200);
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.25rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 2.25rem;
  height: 2.25rem;
  background: linear-gradient(135deg, #0284c7, #0d9488);
  border-radius: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 1.25rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--slate-600);
  padding: 0.5rem 0.25rem;
  position: relative;
  transition: color 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary-600);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--primary-600);
  border-radius: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Button styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1.25rem;
  border-radius: 0.5rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  color: #ffffff;
  box-shadow: 0 4px 8px rgba(2, 132, 199, 0.35);
  transform: translateY(-1px);
}

.btn-outline {
  border-color: var(--slate-300);
  background: #ffffff;
  color: var(--slate-700);
}

.btn-outline:hover {
  border-color: var(--slate-400);
  background: var(--slate-50);
  color: var(--slate-900);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

/* Hero Section */
.hero-section {
  position: relative;
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
  padding: 3.5rem 0 3rem;
  border-bottom: 1px solid var(--slate-200);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2.5rem;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #e0f2fe;
  color: #0369a1;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--slate-900);
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--slate-600);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.hero-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 1rem;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}

/* Category Sections & Cards */
.category-title-wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--slate-200);
}

.category-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--slate-900);
  margin: 0;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 0.85rem;
  padding: 1.5rem;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #bae6fd;
}

.card-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.6rem;
  background-color: #f0fdf4;
  color: #15803d;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--slate-900);
  margin: 0 0 0.5rem;
}

.card-desc {
  font-size: 0.92rem;
  color: var(--slate-600);
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--slate-100);
  padding-top: 0.85rem;
  font-size: 0.82rem;
  color: var(--slate-500);
}

/* Trust / Клинический стандарт badges */
.med-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #0369a1;
  background-color: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--slate-700);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--slate-800);
  background-color: #ffffff;
  border: 1px solid var(--slate-300);
  border-radius: 0.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.form-help {
  font-size: 0.82rem;
  color: var(--slate-500);
  margin-top: 0.3rem;
}

.radio-group, .checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--slate-200);
  border-radius: 0.5rem;
  background-color: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
}

.radio-card:hover {
  background-color: var(--slate-50);
  border-color: var(--slate-300);
}

.radio-card input {
  margin-top: 0.25rem;
}

/* Result Box */
.result-card {
  display: none;
  background: #ffffff;
  border: 2px solid #38bdf8;
  border-radius: 1rem;
  padding: 1.75rem;
  margin-top: 2rem;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 9999px;
  margin-bottom: 0.5rem;
}

.badge-emerald { background-color: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-teal { background-color: #ccfbf1; color: #0f766e; border: 1px solid #99f6e4; }
.badge-amber { background-color: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-orange { background-color: #ffedd5; color: #c2410c; border: 1px solid #fed7aa; }
.badge-rose { background-color: #ffe4e6; color: #be123c; border: 1px solid #fecdd3; }
.badge-indigo { background-color: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; }

/* Affiliate Monetization Slots */
.affiliate-slot {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.affiliate-content {
  flex-grow: 1;
}

.affiliate-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #92400e;
  margin: 0 0 0.25rem;
}

.affiliate-text {
  font-size: 0.88rem;
  color: #78350f;
  margin: 0;
}

/* Social Share Block */
.social-share-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.social-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  border-radius: 0.4rem;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.social-share-btn:hover {
  opacity: 0.9;
  color: #ffffff;
}

.btn-vk { background-color: #0077ff; }
.btn-tg { background-color: #229ed9; }
.btn-ok { background-color: #ee8208; }
.btn-x { background-color: #0f1419; border: 1px solid #334155; }
.btn-max {
  background: linear-gradient(135deg, #0284c7 0%, #4f46e5 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  font-family: inherit;
}
.btn-viber { background-color: #7360f2; }

/* Lead Capture Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  background: #ffffff;
  border-radius: 1rem;
  max-width: 500px;
  width: 100%;
  padding: 2rem;
  position: relative;
  box-shadow: var(--shadow-xl);
  animation: fadeIn 0.2s ease;
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--slate-400);
  cursor: pointer;
}

/* Article Styles */
.article-cover {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 0.75rem;
  margin-bottom: 2rem;
}

.article-header {
  margin-bottom: 2rem;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.88rem;
  color: var(--slate-500);
  margin-top: 1rem;
}

.author-card {
  background: #f8fafc;
  border: 1px solid var(--slate-200);
  border-radius: 0.75rem;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.author-avatar {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--primary-600);
  font-size: 1.25rem;
}

.toc-box {
  background-color: #f1f5f9;
  border-left: 4px solid var(--primary-500);
  padding: 1.25rem 1.5rem;
  border-radius: 0 0.5rem 0.5rem 0;
  margin: 2rem 0;
}

.toc-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--slate-900);
  margin: 0 0 0.75rem;
}

.toc-list {
  margin: 0;
  padding-left: 1.25rem;
  list-style: decimal;
}

.toc-list li {
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.article-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #1e293b;
}

.article-body h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--slate-900);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--slate-200);
}

.article-body h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--slate-800);
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
}

/* Footer */
.global-footer {
  background-color: #0f172a;
  color: #94a3b8;
  padding: 4rem 0 2rem;
  margin-top: 4rem;
  border-top: 1px solid #1e293b;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-heading {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.6rem;
}

.footer-links a {
  color: #94a3b8;
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: #ffffff;
}

.footer-disclaimer {
  font-size: 0.8rem;
  line-height: 1.5;
  color: #64748b;
  border-top: 1px solid #1e293b;
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .affiliate-slot { flex-direction: column; align-items: stretch; text-align: center; }
  .calc-detail-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 640px) {
  .header-inner { height: 3.75rem; }
  .nav-links { display: none; }
  .cards-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.85rem; }
}

