/* DALGA 2 — Saha optimizasyonu CSS
   GÖREV 1: Mobil alt navigasyon, GÖREV 2: Sticky CTA + FAB,
   GÖREV 5: Yüksek kontrast modu (data-contrast="high"). */

/* ============== GÖREV 1 — Mobil Alt Navigasyon ============== */
.sv-mbn {
  display: none;
}

@media (max-width: 768px) {
  .sv-mbn {
    display: flex !important;
    align-items: flex-end;
    justify-content: space-around;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)) 4px;
    min-height: 64px;
  }
  /* Body alt boşluk — son içerik alt nav arkasında kalmasın */
  html.sv-has-mbn body {
    padding-bottom: 76px;
  }
}

.sv-mbn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1 1 0;
  min-width: 48px;
  min-height: 48px;
  padding: 6px 4px;
  text-decoration: none;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: 12px;
  transition: color 0.15s, background 0.15s;
}

.sv-mbn-item i {
  font-size: 1.25rem;
  line-height: 1;
}

.sv-mbn-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sv-mbn-item:hover,
.sv-mbn-item:focus {
  color: #C2410C; /* DALGA 3 — 5.18:1 AA ✅ (önceki #F97316 = 2.80:1 fail) */
  background: rgba(194, 65, 12, 0.08);
}

.sv-mbn-item.active {
  color: #C2410C; /* DALGA 3 — 5.18:1 AA ✅ */
  font-weight: 600;
}

.sv-mbn-item.active i {
  transform: scale(1.05);
}

/* FAB — orta tab 1.2x büyük, marka turuncusu floating
   DALGA 3 — gradient marka kimliği için kalır AMA daha koyu durakla başlar
   böylece beyaz metin/ikon kontrastı 5.18:1+ garanti olur (orange-700 → orange-800). */
.sv-mbn-fab {
  flex: 0 0 auto;
  min-width: 64px;
  min-height: 64px;
  padding: 0;
  margin: -22px 4px 0 4px;
  background: linear-gradient(135deg, #C2410C, #9A3412);
  color: #ffffff;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  box-shadow: 0 6px 16px rgba(154, 52, 18, 0.45);
  font-weight: 700;
}

.sv-mbn-fab i {
  font-size: 1.55rem;
}

.sv-mbn-fab span {
  position: absolute;
  bottom: -18px;
  font-size: 0.65rem;
  color: #475569;
  font-weight: 600;
}

.sv-mbn-fab:hover,
.sv-mbn-fab:focus,
.sv-mbn-fab.active {
  color: #ffffff;
  background: linear-gradient(135deg, #9A3412, #7C2D12);
}

/* ============== GÖREV 2 — Sticky CTA + FAB ============== */
/* Form altında tek primary buton sticky (mobile only) */
@media (max-width: 768px) {
  .sv-sticky-cta,
  #submitBtn,
  .btn-sticky-bottom {
    position: sticky;
    bottom: 80px; /* alt nav 64px + 16px padding */
    z-index: 50;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  }
  /* Eğer alt nav YOKsa (anonim sayfalar), bottom 16 */
  html:not(.sv-has-mbn) .sv-sticky-cta,
  html:not(.sv-has-mbn) #submitBtn,
  html:not(.sv-has-mbn) .btn-sticky-bottom {
    bottom: 16px;
  }
}

/* Floating Action Button — liste sayfalarında "+ Yeni"
   DALGA 3 — beyaz ikon kontrastı için orange-700+ */
.sv-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C2410C, #9A3412);
  color: #ffffff !important;
  border: none;
  box-shadow: 0 6px 16px rgba(154, 52, 18, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  z-index: 1030;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.sv-fab:hover,
.sv-fab:focus {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(154, 52, 18, 0.55);
  color: #ffffff;
  background: linear-gradient(135deg, #9A3412, #7C2D12);
}

@media (max-width: 768px) {
  html.sv-has-mbn .sv-fab {
    bottom: 80px; /* alt nav üstünde dur */
  }
}

/* ============== GÖREV 5 — Yüksek Kontrast Modu (WCAG AAA) ============== */
body[data-contrast="high"] {
  background: #ffffff !important;
  color: #000000 !important;
}

body[data-contrast="high"] *:not(i):not(.fa):not([class*="fa-"]) {
  color: #000000 !important;
  background-color: transparent !important;
  background-image: none !important;
}

body[data-contrast="high"] a,
body[data-contrast="high"] a * {
  color: #0000EE !important;
  text-decoration: underline !important;
  font-weight: 600 !important;
}

body[data-contrast="high"] button,
body[data-contrast="high"] .btn,
body[data-contrast="high"] input,
body[data-contrast="high"] select,
body[data-contrast="high"] textarea {
  background: #ffffff !important;
  color: #000000 !important;
  border: 2px solid #000000 !important;
  font-weight: 600 !important;
}

body[data-contrast="high"] .btn-primary,
body[data-contrast="high"] .sv-mbn-fab,
body[data-contrast="high"] .sv-fab {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #000000 !important;
}

body[data-contrast="high"] .sv-mbn {
  background: #ffffff !important;
  border-top: 3px solid #000000 !important;
}

body[data-contrast="high"] .sv-mbn-item.active {
  color: #000000 !important;
  background: #FFD700 !important;
  outline: 2px solid #000000;
}

/* 48px touch target korunsun (Dalga 1 uyumlu) */
body[data-contrast="high"] button,
body[data-contrast="high"] .btn,
body[data-contrast="high"] a.btn {
  min-height: 48px !important;
  min-width: 48px !important;
}

/* ============== Voice button — kayıt animasyonu ============== */
.voice-btn.recording {
  background: #DC2626 !important;
  color: #ffffff !important;
  border-color: #DC2626 !important;
  animation: sv-voice-pulse 1.2s infinite;
}

@keyframes sv-voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

.voice-btn.voice-not-supported {
  display: none !important;
}

/* ============== PWA Install Banner ============== */
.sv-install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 84px;
  background: #ffffff;
  border: 1px solid #C2410C; /* DALGA 3 — non-text border 4.76:1+ */
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 1050;
  display: none;
  animation: slideUpBanner 0.3s ease-out;
}

.sv-install-banner.visible { display: block; }

@media (min-width: 769px) {
  .sv-install-banner {
    left: auto;
    right: 24px;
    bottom: 24px;
    max-width: 380px;
  }
}
