/* ========================================
   FIX.CSS - TÜM SORUNLAR KESIN ÇÖZÜM V2
   ======================================== */

/* 0. SCROLL OPTİMİZASYONU - JANK ÖNLEME */
html {
  scroll-behavior: smooth !important;
  -webkit-overflow-scrolling: touch !important;
}

body {
  overflow-x: hidden !important;
  overflow-y: scroll !important;
  -webkit-overflow-scrolling: touch !important;
}

/* GPU acceleration için will-change */
.main-slider,
.slider,
.carousel,
.nav-mobile,
.category-card-trendyol,
.product-item {
  will-change: transform !important;
  -webkit-backface-visibility: hidden !important;
  backface-visibility: hidden !important;
}

/* Mobilde scroll engellenmesini önle */
@media (max-width: 991.98px) {
  html, body {
    position: relative !important;
    overflow-y: scroll !important;
    height: auto !important;
    min-height: 100vh !important;
  }
  
  /* Sticky/Fixed elementlerde transform kullan (composite layer) */
  .nav-top,
  .main-menu,
  header#header {
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
  }
}

/* 1. MOBİL SCROLL DÜZELTMESİ */
@media (max-width: 991.98px) {
  html, body {
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch !important;
    position: relative !important;
    height: auto !important;
  }
  
  #wrapper {
    padding-top: 65px !important;
  }
  
  .slick-slider, .slick-list, .slick-track {
    touch-action: pan-y !important;
  }
}

/* 2. OVERLAY DÜZELTMESİ - varsayılan kapalı */
#overlay_bg,
#menu-overlay,
.overlay-bg,
.background-dark {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -1 !important;
  position: fixed !important;
  top: -9999px !important;
  left: -9999px !important;
}

/* 3. HAMBURGER MENÜ AÇILDIĞINDA */
body.mobile-menu-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
}

body.mobile-menu-open #overlay_bg {
  display: block !important;
  visibility: visible !important;
  opacity: 0.6 !important;
  pointer-events: auto !important;
  z-index: 9998 !important;
  position: fixed !important;
  background-color: rgba(0,0,0,0.6) !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
}

/* MENÜ GÖRÜNÜR OLSUN */
body.mobile-menu-open .nav-mobile {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  transform: translateX(0) !important;
  z-index: 9999 !important;
}

.nav-mobile {
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 80% !important;
  max-width: 320px !important;
  background-color: #fff !important;
  z-index: 9999 !important;
  transform: translateX(-100%) !important;
  transition: transform 0.3s ease !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.nav-mobile.nav-mobile-open {
  transform: translateX(0) !important;
}

/* 4. MOBİL SLIDER DÜZELTMESİ */
@media (max-width: 992px) {
  #main-slider .item,
  .main-slider .item {
    background-size: contain !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
  }
  
  .container-boxed-slider .slider-container,
  .container-boxed-slider #main-slider {
    aspect-ratio: 16 / 6;
    height: auto !important;
  }
}

/* 5. KATEGORİ KARTLARI - TRENDYOL TARZI */
/* Grid düzeltmesi */
.section-categories .row {
  margin-left: -8px !important;
  margin-right: -8px !important;
}

.section-categories .category-card-wrapper {
  padding-left: 8px !important;
  padding-right: 8px !important;
  margin-bottom: 16px !important;
}

/* Mobil: 1 sütun (Trendyol gibi) */
@media (max-width: 991.98px) {
  .section-categories .category-card-wrapper {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
}

/* Desktop: 3 sütun */
@media (min-width: 992px) {
  .section-categories .category-card-wrapper {
    flex: 0 0 33.3333% !important;
    max-width: 33.3333% !important;
  }
}

/* Kategori kartı - Trendyol tarzı */
.section-categories .category-card-trendyol {
  display: block !important;
  width: 100% !important;
  position: relative !important;
  overflow: hidden !important;
  border-radius: 12px !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  text-decoration: none !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
  transition: all 0.3s ease !important;
}

/* Mobilde ve Desktop'ta 2:1 oran (yatay) */
.section-categories .category-card-trendyol {
  aspect-ratio: 2 / 1 !important; /* 2 genişlik, 1 yükseklik */
}

.section-categories .category-card-trendyol:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.15) !important;
  transform: translateY(-2px) !important;
}

/* Kategori görseli */
.section-categories .category-card-image {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  border: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
  transition: transform 0.4s ease !important;
}

.section-categories .category-card-trendyol:hover .category-card-image {
  transform: scale(1.08) !important;
}

/* Gradient Overlay (Trendyol gibi altta koyu) */
.section-categories .category-card-overlay {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  height: 100% !important;
  background: linear-gradient(
    to bottom, 
    rgba(0,0,0,0) 0%, 
    rgba(0,0,0,0.3) 60%, 
    rgba(0,0,0,0.7) 100%
  ) !important;
  display: flex !important;
  align-items: flex-end !important;
  padding: 20px !important;
  pointer-events: none !important;
}

/* Kategori Başlığı (altda, beyaz, kalın) */
.section-categories .category-card-title {
  color: #fff !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.3 !important;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
  letter-spacing: 0.3px !important;
}

/* Mobilde başlık daha büyük */
@media (max-width: 991.98px) {
  .section-categories .category-card-title {
    font-size: 20px !important;
  }
  
  .section-categories .category-card-overlay {
    padding: 16px !important;
  }
}

/* 6. ÜRÜN KARTLARI - BAŞLIK 2 SATIR TAM */
@media (max-width: 991.98px) {
  .product-list-content .row {
    margin-left: -8px !important;
    margin-right: -8px !important;
  }
  
  .product-list-content .col-6,
  .product-list-content .col-sm-6,
  .product-list-content div[class*="col-6"] {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  
  .product-item {
    margin-bottom: 16px !important;
  }
  
  .product-item .img-product-container {
    aspect-ratio: 1 / 1 !important;
    overflow: hidden !important;
  }
  
  .product-item .img-product-container img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
  
  /* ÜRÜN BAŞLIKLARI - 2 SATIR TAM GÖSTER */
  .product-list-content .product-item .product-title,
  .product-list-content .product-item .product-title a,
  .product-list-content .product-item h3,
  .product-list-content .product-item h3 a {
    font-size: 13px !important;
    line-height: 1.35 !important;
    height: auto !important;
    max-height: 35px !important; /* 2 satır: 13px * 1.35 * 2 = ~35px */
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    white-space: normal !important;
    word-break: break-word !important;
    word-wrap: break-word !important;
  }
}

/* Ürün listesi sayfası için de (desktop dahil) */
.product-item .product-title,
.product-item .product-title a,
.product-item h3,
.product-item h3 a {
  font-size: 14px !important;
  line-height: 1.35 !important;
  height: auto !important;
  max-height: 38px !important; /* 2 satır */
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  white-space: normal !important;
  word-break: break-word !important;
}

/* 7. FOOTER DÜZELTMESİ - MOBİLDE DÜZENLİ */
@media (max-width: 991.98px) {
  /* Footer products (üst kategori bölümü) */
  .footer-products {
    padding: 25px 0 !important;
    background: #f5f5f5 !important;
  }
  
  .footer-products .row {
    margin-left: -8px !important;
    margin-right: -8px !important;
  }
  
  .footer-products .footer-widget {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    padding: 0 8px !important;
    margin-bottom: 15px !important;
  }
  
  .footer-products .footer-title-small {
    font-size: 13px !important;
    font-weight: 600 !important;
    margin-bottom: 8px !important;
  }
  
  .footer-products .footer-link-list {
    font-size: 11px !important;
  }
  
  /* Footer corporate container */
  .footer-corporate {
    padding: 30px 0 20px 0 !important;
    background: #262626 !important;
  }
  
  .footer-corporate .container {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }
  
  .footer-corporate .row {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-left: -8px !important;
    margin-right: -8px !important;
  }
  
  /* TÜM SÜTUNLAR 50% */
  .footer-corporate .row > .col-12,
  .footer-corporate .row > .col-md-3,
  .footer-corporate .row > div[class*="col"] {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    padding: 0 8px !important;
    margin-bottom: 20px !important;
  }
  
  /* LOGO + HAKKIMIZDA (ilk sütun) - AYRI BİR SATIR */
  .footer-corporate .row > div:first-child {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    margin-bottom: 25px !important;
    order: 1 !important;
    padding-bottom: 20px !important;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
  }
  
  .footer-corporate .footer-logo img {
    max-width: 160px !important;
    height: auto !important;
    margin-bottom: 12px !important;
  }
  
  .footer-corporate .footer-about {
    font-size: 12px !important;
    line-height: 1.5 !important;
    color: #dcdcdc !important;
    margin-bottom: 15px !important;
  }
  
  /* DİĞER SÜTUNLAR (Popüler Sayfalar, Bilgilendirme, Abonelik) */
  .footer-corporate .row > div:nth-child(2),
  .footer-corporate .row > div:nth-child(3),
  .footer-corporate .row > div:nth-child(4) {
    order: 2 !important;
  }
  
  /* BAŞLIKLAR */
  .footer-corporate .footer-title,
  .footer-corporate h4 {
    font-size: 13px !important;
    font-weight: 700 !important;
    margin-bottom: 10px !important;
    text-align: left !important;
    color: #fff !important;
  }
  
  /* LİNKLER */
  .footer-corporate .footer-link-list {
    font-size: 11px !important;
    text-align: left !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
  }
  
  .footer-corporate .footer-link-list li {
    margin-bottom: 5px !important;
    list-style: none !important;
  }
  
  .footer-corporate .footer-link-list li a {
    padding: 2px 0 !important;
    display: block !important;
    color: #f1f1f1 !important;
    opacity: 0.85 !important;
  }
  
  .footer-corporate .footer-link-list li a:hover {
    opacity: 1 !important;
  }
  
  /* SOSYAL MEDYA */
  .footer-corporate .footer-social-links {
    margin-top: 10px !important;
    display: flex !important;
    gap: 10px !important;
  }
  
  /* ABONELİK FORMU */
  .footer-corporate .newsletter input {
    font-size: 12px !important;
  }
  
  .footer-corporate .newsletter button {
    font-size: 11px !important;
    padding: 8px 12px !important;
  }
}

/* 8. MEGA MENÜ - tek satır */
@media (min-width: 992px) {
  .mega-menu a,
  .mega-menu .dropdown-item {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

/* 9. TAWK.TO + SCROLL BUTONLARINI MOBİLDE GİZLE */
@media (max-width: 991.98px) {
  iframe[src*="tawk"], 
  .tawk-min-container, 
  .tawk-widget-container,
  #toTop, 
  .scrollup, 
  .back-to-top {
    display: none !important;
  }
}

/* 10. INFO BADGES */
.tk-info-badges {
  margin-top: 15px;
}

.tk-info-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.tk-info-ic {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff3ec;
}

.tk-info-ic i {
  font-size: 18px;
  color: #f26a21;
}

.tk-info-txt {
  font-size: 14px;
  color: #333;
}

.tk-info-txt strong {
  font-weight: 800;
}

/* 11. KATEGORİ SAYFASI İÇERİK YAZISI - "DEVAMI" BUTONU DÜZELTMESİ */
.cat-desc {
  background: #fff;
  padding: 20px;
  margin-top: 20px;
  margin-bottom: 0;
  border-radius: 8px;
  position: relative;
}

/* Collapsed durumu (kapalı) */
.cat-desc:not(.is-open) {
  max-height: 280px !important;
  overflow: hidden !important;
  padding-bottom: 60px !important; /* buton için yer */
}

/* Gradient overlay (kapalıyken altta soluk) */
.cat-desc:not(.is-open)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
  pointer-events: none;
  z-index: 1;
}

/* Expanded durumu (açık) */
.cat-desc.is-open {
  max-height: none !important;
  padding-bottom: 20px !important;
}

.cat-desc.is-open::after {
  display: none !important;
}

/* Devamı / Kapat butonu */
.cat-desc-toggle {
  background: #ff6600 !important;
  color: #fff !important;
  padding: 12px 32px !important;
  border-radius: 6px !important;
  border: none !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  box-shadow: 0 2px 8px rgba(255,102,0,0.3) !important;
  transition: all 0.3s ease !important;
  display: inline-block !important;
  margin-top: 20px !important;
  position: relative !important;
  z-index: 10 !important;
}

.cat-desc-toggle:hover {
  background: #e65500 !important;
  box-shadow: 0 4px 12px rgba(255,102,0,0.4) !important;
  transform: translateY(-2px) !important;
}

/* Mobilde buton daha büyük */
@media (max-width: 991.98px) {
  .cat-desc {
    padding: 16px;
  }
  
  .cat-desc:not(.is-open) {
    max-height: 240px !important;
    padding-bottom: 50px !important;
  }
  
  .cat-desc-toggle {
    padding: 14px 36px !important;
    font-size: 16px !important;
    margin-top: 16px !important;
  }
}
