/* ==========================================================================
   Acil Tıp FOAMed Portalı — Modern Klinik & Resüsitasyon Tasarımı
   ========================================================================== */

:root {
  /* Renk Paleti - Light Mode */
  --em-bg: #f8fafc;
  --em-surface: #ffffff;
  --em-surface-2: #f1f5f9;
  --em-border: #e2e8f0;
  --em-border-focus: #cbd5e1;
  --em-text: #0f172a;
  --em-text-muted: #64748b;
  --em-text-dim: #94a3b8;

  /* Acil Durum Vurgu Renkleri */
  --em-red: #e11d48;
  --em-red-dark: #be123c;
  --em-red-soft: #ffe4e6;
  --em-red-glow: rgba(225, 29, 72, 0.15);

  --em-blue: #0284c7;
  --em-blue-dark: #0369a1;
  --em-blue-soft: #e0f2fe;

  --em-cyan: #06b6d4;
  --em-cyan-soft: #cffafe;

  --em-green: #10b981;
  --em-green-soft: #d1fae5;

  --em-amber: #f59e0b;
  --em-amber-soft: #fef3c7;

  --em-purple: #8b5cf6;
  --em-purple-soft: #ede9fe;

  /* Kart & Gölgeler */
  --em-radius-sm: 8px;
  --em-radius: 14px;
  --em-radius-lg: 20px;
  --em-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --em-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --em-shadow-lg: 0 10px 30px -4px rgba(15, 23, 42, 0.1), 0 4px 10px -2px rgba(15, 23, 42, 0.05);

  --em-nav-height: 70px;
  --em-bottom-bar-height: 65px;
}

/* Koyu Mod (Resüsitasyon & Gece Nöbeti Teması) */
[data-theme="dark"] {
  --em-bg: #090d16;
  --em-surface: #111827;
  --em-surface-2: #1e293b;
  --em-border: #243044;
  --em-border-focus: #374151;
  --em-text: #f9fafb;
  --em-text-muted: #94a3b8;
  --em-text-dim: #64748b;

  --em-red-soft: rgba(225, 29, 72, 0.15);
  --em-blue-soft: rgba(2, 132, 199, 0.15);
  --em-cyan-soft: rgba(6, 182, 212, 0.15);
  --em-green-soft: rgba(16, 185, 129, 0.15);
  --em-amber-soft: rgba(245, 158, 11, 0.15);
  --em-purple-soft: rgba(139, 92, 246, 0.15);

  --em-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --em-shadow: 0 8px 25px -4px rgba(0, 0, 0, 0.5);
  --em-shadow-lg: 0 16px 36px -6px rgba(0, 0, 0, 0.7);
}

/* Temel Sıfırlamalar */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--em-bg);
  color: var(--em-text);
  line-height: 1.55;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
  padding-bottom: calc(var(--em-bottom-bar-height) + 20px);
}

@media (min-width: 992px) {
  body {
    padding-bottom: 0;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

/* Navigasyon Barı */
.em-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--em-nav-height);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--em-border);
  display: flex;
  align-items: center;
  transition: background 0.25s ease, border-color 0.25s ease;
}

[data-theme="dark"] .em-navbar {
  background: rgba(17, 24, 39, 0.92);
}

.em-navbar-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 max(20px, 2.5vw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.em-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.em-brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--em-red), #be123c);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  box-shadow: 0 4px 14px var(--em-red-glow);
  position: relative;
  overflow: hidden;
}

.em-brand-icon::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.25), transparent);
}

.em-brand-title {
  display: flex;
  flex-direction: column;
}

.em-brand-title span:first-child {
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(90deg, var(--em-text), var(--em-red));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.em-brand-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--em-red);
}

/* Nav Menü Linkleri (Desktop) */
.em-nav-links {
  display: none;
  align-items: center;
  gap: 6px;
}

@media (min-width: 992px) {
  .em-nav-links {
    display: flex;
  }
}

.em-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--em-radius-sm);
  color: var(--em-text-muted);
  font-weight: 600;
  font-size: 0.92rem;
  transition: all 0.2s ease;
}

.em-nav-link:hover, .em-nav-link.active {
  color: var(--em-text);
  background: var(--em-surface-2);
}

.em-nav-link.active {
  color: var(--em-red);
}

/* Arama Butonu (Command+K Tetikleyici) */
.em-search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--em-surface-2);
  border: 1px solid var(--em-border);
  border-radius: 30px;
  padding: 8px 16px;
  color: var(--em-text-muted);
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 180px;
}

@media (max-width: 768px) {
  .em-search-trigger {
    min-width: auto;
    padding: 8px 12px;
  }
  .em-search-trigger .shortcut-hint,
  .em-search-trigger .search-text {
    display: none;
  }
}

.em-search-trigger:hover {
  border-color: var(--em-red);
  color: var(--em-text);
}

.shortcut-hint {
  background: var(--em-surface);
  border: 1px solid var(--em-border);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: auto;
}

/* Hızlı Butonlar & Tema Değiştirici */
.em-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.em-btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--em-surface-2);
  border: 1px solid var(--em-border);
  color: var(--em-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.em-btn-icon:hover {
  background: var(--em-border);
}

/* Resüsitasyon Kırmızı Çubuğu (Resuscitation Fast Bar) */
.em-fast-bar {
  background: linear-gradient(90deg, #be123c, #e11d48, #9f1239);
  color: #fff;
  padding: 7px 0;
  font-size: 0.85rem;
  box-shadow: 0 2px 10px rgba(225, 29, 72, 0.3);
}

.em-fast-bar-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 max(20px, 2.5vw);
  display: flex;
  align-items: center;
  gap: 15px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.em-fast-bar-container::-webkit-scrollbar {
  display: none;
}

.em-fast-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
  padding-right: 12px;
  border-right: 1px solid rgba(255,255,255,0.3);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px #fff;
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.em-fast-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.25);
  transition: all 0.2s ease;
}

.em-fast-btn:hover {
  background: #ffffff;
  color: var(--em-red);
}

/* Ana Sayfa İçerik Konteynırı — Tüm Ekrana Yayılan Akıcı Düzen */
.em-main-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 24px max(20px, 2.5vw) 60px;
}

/* Hero / Karşılama Başlığı */
.em-hero {
  position: relative;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 45%, #eff6ff 100%);
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius-lg);
  padding: 35px 30px;
  margin-bottom: 30px;
  overflow: hidden;
  box-shadow: var(--em-shadow);
}

[data-theme="dark"] .em-hero {
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.08), rgba(6, 182, 212, 0.05));
  border: 1px solid var(--em-border);
}

.em-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--em-red-soft);
  color: var(--em-red);
  margin-bottom: 12px;
}

.em-hero-title {
  font-size: 2.1rem;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}

.em-hero-subtitle {
  color: var(--em-text-muted);
  font-size: 1.05rem;
  max-width: 720px;
  margin-bottom: 20px;
}

/* Kart Yapıları */
.em-card {
  background: var(--em-surface);
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius);
  padding: 22px;
  box-shadow: var(--em-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.em-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--em-shadow-lg);
  border-color: var(--em-border-focus);
}

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

.em-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.icon-red { background: var(--em-red-soft); color: var(--em-red); }
.icon-blue { background: var(--em-blue-soft); color: var(--em-blue); }
.icon-cyan { background: var(--em-cyan-soft); color: var(--em-cyan); }
.icon-green { background: var(--em-green-soft); color: var(--em-green); }
.icon-amber { background: var(--em-amber-soft); color: var(--em-amber); }
.icon-purple { background: var(--em-purple-soft); color: var(--em-purple); }

.em-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-red { background: var(--em-red-soft); color: var(--em-red); }
.badge-blue { background: var(--em-blue-soft); color: var(--em-blue); }
.badge-green { background: var(--em-green-soft); color: var(--em-green); }
.badge-amber { background: var(--em-amber-soft); color: var(--em-amber); }
.badge-purple { background: var(--em-purple-soft); color: var(--em-purple); }

/* Grid Düzenleri */
.em-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.em-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.em-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* Hesaplayıcı Arayüzü & Butonlar */
.calc-option-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--em-border);
  background: var(--em-surface);
  border-radius: var(--em-radius-sm);
  color: var(--em-text);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.calc-option-btn:hover {
  background: var(--em-surface-2);
  border-color: var(--em-red);
}

.calc-option-btn.selected {
  background: var(--em-red-soft);
  border-color: var(--em-red);
  color: var(--em-red);
  font-weight: 700;
}

/* Canlı Skor Göstergesi */
.live-score-card {
  position: sticky;
  top: 90px;
  background: var(--em-surface);
  border: 2px solid var(--em-border);
  border-radius: var(--em-radius-lg);
  padding: 24px;
  box-shadow: var(--em-shadow-lg);
  text-align: center;
}

.score-display {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  margin: 15px 0 10px;
}

.score-success { color: var(--em-green); }
.score-warning { color: var(--em-amber); }
.score-danger { color: var(--em-red); }

/* Mobil Alt Gezinme Barı (Mobile Bottom Nav) */
.em-bottom-bar {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--em-bottom-bar-height);
  background: var(--em-surface);
  border-top: 1px solid var(--em-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 1000;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

@media (min-width: 992px) {
  .em-bottom-bar {
    display: none;
  }
}

.em-bottom-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--em-text-muted);
  gap: 3px;
  flex: 1;
  padding: 6px 0;
  transition: all 0.2s ease;
}

.em-bottom-item i {
  font-size: 1.25rem;
}

.em-bottom-item.active, .em-bottom-item:hover {
  color: var(--em-red);
}

/* Command+K Canlı Arama Modalı */
.em-modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 20px 20px;
}

.em-modal-backdrop.open {
  display: flex;
}

.em-search-box {
  width: 100%;
  max-width: 640px;
  background: var(--em-surface);
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius-lg);
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-15px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.em-search-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--em-border);
  gap: 12px;
}

.em-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1.15rem;
  color: var(--em-text);
  font-family: inherit;
}

.em-search-results {
  max-height: 420px;
  overflow-y: auto;
  padding: 10px;
}

.em-search-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--em-radius-sm);
  color: var(--em-text);
  cursor: pointer;
  transition: background 0.15s ease;
}

.em-search-item:hover, .em-search-item.highlighted {
  background: var(--em-surface-2);
}

/* Toast Bildirimi */
.em-toast {
  position: fixed;
  bottom: 80px;
  right: 25px;
  background: #111827;
  color: #fff;
  border: 1px solid #374151;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.em-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Buton Stilleri */
.em-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--em-radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.em-btn-primary {
  background: var(--em-red);
  color: #fff;
  box-shadow: 0 2px 10px var(--em-red-glow);
}

.em-btn-primary:hover {
  background: var(--em-red-dark);
  color: #fff;
}

.em-btn-secondary {
  background: var(--em-surface-2);
  color: var(--em-text);
  border: 1px solid var(--em-border);
}

.em-btn-secondary:hover {
  background: var(--em-border);
}

.em-btn-success {
  background: var(--em-green);
  color: #fff;
}

/* Form Elemanları */
.em-form-group {
  margin-bottom: 18px;
}

.em-form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--em-text);
}

.em-form-control, .form-control, .form-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--em-radius-sm);
  border: 1px solid var(--em-border);
  background: var(--em-surface);
  color: var(--em-text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.em-form-control:focus, .form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--em-red);
  box-shadow: 0 0 0 3px var(--em-red-soft);
}
