/* ============================================================
   TEMAD Emlak — Mobil Menü Responsive Düzeltmeler
   Konumlandırma: Sağdan sol taraftan açılır
   ============================================================ */

/* Mobil Menü: Sağdan açılan overlay */
.mobile-nav {
  position: fixed;
  top: 0;
  right: -340px;
  bottom: 0;
  width: min(84vw, 340px);
  max-width: 100vw;
  background: #f8fcff;
  z-index: 1050;
  overflow-y: auto;
  transition: right 0.25s ease;
  box-shadow: -10px 0 24px rgba(0, 0, 0, 0.18);
  -webkit-overflow-scrolling: touch;
  padding-top: 84px;
}

/* Açık durumdayken */
.mobile-nav.show {
  right: 0;
}

/* Arka plan overlay − dinamik */
body.mobile-nav-open {
  overflow: hidden;
}

body.mobile-nav-open .site-header {
  z-index: 1045;
}

body.mobile-nav-open::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 15, 30, 0.45);
  z-index: 1040;
}

/* Mobil menü içeriği */
.mobile-nav nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px 0;
}

.mobile-nav a {
  display: block;
  padding: 14px 20px;
  color: #1A1A2E;
  font-size: 15px;
  font-weight: 500;
  border-left: 0;
  border-bottom: 1px solid rgba(26, 26, 46, 0.08);
  margin-left: 0;
  transition: all 0.2s ease;
  text-decoration: none;
  position: relative;
}

.mobile-nav a:hover,
.mobile-nav a.active {
  background: rgba(232, 84, 10, 0.12);
  color: #E8540A;
  padding-left: 24px;
}

.mobile-nav .btn-turuncu {
  margin: 12px 16px;
  padding: 12px 24px;
  width: calc(100% - 32px);
  background: #E8540A;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.mobile-nav .btn-turuncu:hover {
  background: #C45C2A;
  transform: translateX(-2px);
}

/* Hamburger menü butonunu göster */
#mobileMenuToggle {
  display: none !important;
}

@media (max-width: 992px) {
  /* Mobil cihazlarda hamburger butonu göster */
  #mobileMenuToggle {
    display: block !important;
    background: none;
    border: none;
    color: #1A1A2E;
    padding: 8px;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    transition: transform 0.2s ease;
  }

  #mobileMenuToggle:hover {
    transform: scale(1.1);
  }

  #mobileMenuToggle.active {
    transform: rotate(90deg);
  }

  /* Mobil menüyü göster */
  .mobile-nav {
    display: block;
  }

  /* Sayfa scroll çalışması için pozisyon düzeltme */
  body.mobile-menu-open {
    overflow: hidden;
  }

  body.mobile-menu-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
  }
}

@media (max-width: 640px) {
  .mobile-nav {
    width: min(90vw, 320px);
    right: -320px;
  }
}

/* ── Responsive Form Alanları ──────────────────────────── */
@media (max-width: 768px) {
  /* Arama formu mobil */
  .arama-form {
    flex-direction: column !important;
    gap: 12px !important;
  }

  .arama-field {
    width: 100% !important;
    min-width: auto !important;
  }

  .arama-field label {
    font-size: 12px;
    margin-bottom: 6px;
  }

  .arama-field select,
  .arama-field input {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
  }

  .arama-buton {
    width: 100%;
    padding: 12px;
  }
}

/* ── Panel Sayfaları Responsive ──────────────────────── */
@media (max-width: 768px) {
  .panel-sidebar {
    display: none;
    position: fixed;
    left: -280px;
    top: 0;
    width: 280px;
    height: 100vh;
    background: #1A1A2E;
    transition: left 0.3s ease;
    z-index: 998;
  }

  .panel-sidebar.active {
    left: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  }

  .panel-content {
    width: 100%;
  }

  .panel-toggle {
    display: flex;
    padding: 12px;
    margin-bottom: 12px;
  }
}

/* ── Admin Dashboard Responsive ──────────────────────── */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .chart-container {
    height: 300px !important;
  }
}

@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: 1fr !important;
  }

  .kpi-card {
    padding: 16px !important;
  }

  .kpi-card h3 {
    font-size: 14px !important;
  }

  .kpi-card .num {
    font-size: 24px !important;
  }

  .table-responsive {
    font-size: 12px;
  }

  .table-responsive tr td {
    padding: 8px !important;
  }
}

/* ── İlan Detay Sayfası Responsive ──────────────────── */
@media (max-width: 768px) {
  .ilan-detay-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .ilan-foto-container {
    width: 100%;
    order: 1;
  }

  .ilan-bilgi-sidebar {
    width: 100%;
    order: 2;
  }

  .foto-galeri-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
}

/* ── Sayfa Geçişleri Düzeltme ──────────────────────– */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
  }

  .container-xl {
    padding-left: 16px;
    padding-right: 16px;
  }

  /* Form kontrolleri */
  select, input[type="text"], input[type="email"], input[type="phone"], textarea {
    min-height: 44px;
    font-size: 16px;
  }

  /* Buton boyutları touch-friendly */
  .btn {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 16px;
  }
}

/* ── Yan-scrol önle ──────────────────────────────── */
@media (max-width: 640px) {
  body, html {
    position: relative;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  body * {
    max-width: 100%;
    box-sizing: border-box;
  }
}
