/* ==========================================================================
   B2B SİSTEMİ - GELİŞMİŞ MOBİL & WEBVIEW UYUMLULUK MOTORU
   Sıfır Sağa-Sola Kayma (Zero Horizontal Overflow), Dokunmatik Optimizasyon,
   Kamera Vizörü ve Akıllı Alt Bar (iOS & Android %100 Uyumlu)
   ========================================================================== */

/* 1. KESİN YATAY KAYMA ENGELLEYİCİ (ZERO OVERFLOW GUARD) */
html {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: #f8fafc !important;
}

body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
  position: relative;
  margin: 0;
  padding: 0;
  background-color: #f8fafc !important;
  box-sizing: border-box;
}

/* Sayfa içerik alanları açık gri kalır */
.portal-content-wrap,
.product-detail-page,
.quick-order-page,
.cart-page-wrap,
.account-page-wrap,
.main-content {
  background-color: #f8fafc;
}

*, *::before, *::after {
  box-sizing: border-box;
}

img, svg, video, canvas {
  max-width: 100%;
  height: auto;
}

.container {
  width: 100% !important;
  max-width: 1320px;
  padding-left: 14px !important;
  padding-right: 14px !important;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* 2. MOBİL HEADER & ARAMA ÇUBUĞU OPTİMİZASYONU */
.mobile-logo {
  display: none !important;
}
.desktop-logo {
  display: block;
}
.mobile-header-cart-btn {
  display: none !important;
}
.barcode-mobile-text {
  display: none !important;
}
.barcode-desktop-text {
  display: inline;
}

@media (max-width: 768px) {
  .main-header {
    padding: 8px 0 10px 0 !important;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--b2b-navy) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
  }

  .header-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .header-top-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
  }

  .brand-logo-wrap {
    display: flex !important;
    align-items: center !important;
  }

  /* LOGO: Mobilde şeffaf vektörel logo (pk-logo.svg) ve yatay B2B rozetini göster, desktop logoyu gizle */
  .brand-logo-img.desktop-logo {
    display: none !important;
  }

  .brand-logo-img.mobile-logo {
    display: block !important;
    height: 34px !important;
    max-width: 195px !important;
    width: auto !important;
    object-fit: contain !important;
  }

  .header-financial-card {
    display: none !important;
  }

  .header-user-cluster,
  .header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  /* Mobilde Carinin Solundaki Sepet Butonu */
  .mobile-header-cart-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    background: linear-gradient(135deg, var(--b2b-blue), #2563eb) !important;
    color: #ffffff !important;
    text-decoration: none !important;
    position: relative !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    flex-shrink: 0 !important;
  }

  .mobile-header-cart-btn:active {
    transform: scale(0.94);
  }

  .mobile-header-cart-btn i {
    font-size: 15px !important;
    color: #ffffff !important;
  }

  .mobile-header-cart-btn .cart-qty-badge {
    position: absolute !important;
    top: -5px !important;
    right: -5px !important;
    background: #ef4444 !important;
    color: #ffffff !important;
    font-size: 9.5px !important;
    font-weight: 900 !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid var(--b2b-navy) !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3) !important;
  }

  .dealer-profile-wrap .dealer-meta {
    display: none !important;
  }

  .dealer-profile-wrap {
    padding: 2px !important;
    border: none !important;
    background: transparent !important;
  }

  .dealer-avatar {
    width: 32px !important;
    height: 32px !important;
    font-size: 12px !important;
  }

  .header-logout-btn {
    padding: 6px 8px !important;
    height: 36px !important;
    font-size: 11px !important;
  }

  .header-logout-btn .logout-text {
    display: none !important;
  }

  .header-bottom-row {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    gap: 8px !important;
  }

  /* SADECE MOBİLDE FAVORİ VE ESKİ SEPET BUTONLARINI GİZLE */
  .header-action-cluster,
  .header-fav-btn,
  #headerFavBtn,
  .fav-toggle-btn {
    display: none !important;
  }

  /* Arama Alanı (2. Satır Tam Genişlik) */
  .search-container {
    grid-area: search;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  .search-input-wrap {
    height: 42px !important;
    padding-left: 36px !important;
    padding-right: 106px !important; /* Barkod butonu sadeleştiği için arama yazma alanı genişletildi */
    border-radius: var(--radius-full) !important;
    background: #ffffff !important;
  }

  .search-icon {
    left: 12px !important;
    font-size: 14px !important;
  }

  .search-input {
    font-size: 13px !important;
    height: 100% !important;
    padding: 0 !important;
  }

  .search-input::placeholder {
    font-size: 12px !important;
  }

  .search-actions-group {
    right: 4px !important;
    gap: 4px !important;
  }

  .search-submit-btn {
    height: 34px !important;
    padding: 0 9px !important;
    font-size: 11.5px !important;
  }

  .search-submit-btn span {
    display: inline !important;
  }

  .barcode-scan-btn {
    height: 34px !important;
    padding: 0 8px !important;
    font-size: 11.5px !important;
    background: linear-gradient(135deg, #0284c7, #0369a1) !important;
    gap: 4px !important;
  }

  .barcode-desktop-text {
    display: none !important;
  }

  .barcode-mobile-text {
    display: inline !important;
    font-size: 11px !important;
    font-weight: 700 !important;
  }

  .barcode-scan-btn svg {
    width: 14px !important;
    height: 14px !important;
    fill: #ffffff !important;
  }
}

/* 3. MOBİL FİNANSAL BİLGİ ŞERİDİ */
@media (max-width: 768px) {
  .dealer-financial-strip {
    padding: 8px 0 !important;
  }

  .financial-card {
    width: 100% !important;
    padding: 8px 12px !important;
  }

  .financial-card .fin-value {
    font-size: 15px !important;
  }
}

/* 4. MOBİL VİTRİN SEKMELERİ & KAMPANYA BANNERLARI */
@media (max-width: 768px) {
  .hero-tabs-wrap {
    margin-bottom: 12px !important;
  }

  .hero-tabs-list {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 8px !important;
    padding-bottom: 6px !important;
    scrollbar-width: none;
  }

  .hero-tabs-list::-webkit-scrollbar {
    display: none;
  }

  .hero-tab-item {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    padding: 8px 14px !important;
    font-size: 12.5px !important;
    border-radius: 10px !important;
  }

  .banner-slider-container {
    border-radius: 12px !important;
  }

  .banner-slide img {
    height: 160px !important;
    object-fit: cover !important;
  }
}

/* 5. MOBİL TEK SÜTUNLU (FULL-WIDTH) ÜRÜN KATALOĞU & ARAMA LİSTESİ */
@media (max-width: 768px) {
  .portal-grid-layout {
    display: block !important;
  }

  .filters-sidebar {
    display: none !important; /* Mobilde modal filtre */
  }

  .products-toolbar {
    padding: 8px 12px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .toolbar-left, .toolbar-right {
    justify-content: space-between !important;
    width: 100% !important;
  }

  /* Tek Kolonlu / Yatay Tam Genişlikte Mobil Ürün Izgarası */
  .products-grid,
  .product-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    width: 100% !important;
  }

  .product-card {
    width: 100% !important;
    padding: 14px 14px !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }

  .product-img-wrap {
    height: 190px !important;
    background: #f8fafc !important;
    border-radius: 12px !important;
    padding: 12px !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 12px !important;
  }

  .product-img {
    max-height: 100% !important;
    max-width: 100% !important;
    object-fit: contain !important;
  }

  .product-body {
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .product-meta-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 6px !important;
    font-size: 11.5px !important;
  }

  .product-brand {
    font-size: 11.5px !important;
    font-weight: 800 !important;
    color: var(--b2b-blue) !important;
    text-transform: uppercase !important;
  }

  .product-stock-code {
    font-size: 11.5px !important;
    color: #64748b !important;
    font-family: monospace !important;
  }

  .product-title {
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    height: auto !important;
    max-height: 44px !important;
    color: var(--b2b-navy) !important;
    margin-bottom: 8px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  .product-barcode-row {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 11.5px !important;
    margin-bottom: 12px !important;
    flex-wrap: wrap !important;
  }

  .product-barcode-row .barcode-val {
    font-size: 11.5px !important;
    padding: 2px 7px !important;
  }

  .product-pricing-box {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 10px 12px !important;
    margin-bottom: 10px !important;
  }

  .pricing-row-list {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 12px !important;
  }

  .pricing-row-net {
    display: flex !important;
    justify-content: space-between !important;
    align-items: baseline !important;
  }

  .pricing-row-vat {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-top: 6px !important;
    border-top: 1px dashed #e2e8f0 !important;
  }

  .package-info-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    font-size: 11.5px !important;
    color: #475569 !important;
    margin-bottom: 10px !important;
    padding: 6px 10px !important;
    background: #f1f5f9 !important;
    border-radius: 8px !important;
  }

  .quick-multipliers {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    margin-bottom: 12px !important;
  }

  .quick-multipliers .mult-btn {
    padding: 7px 4px !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    text-align: center !important;
    white-space: nowrap !important;
  }

  .card-cart-controls {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .card-cart-controls .quantity-picker {
    height: 42px !important;
    border-radius: 10px !important;
  }

  .card-cart-controls .qty-btn {
    width: 38px !important;
    height: 100% !important;
    font-size: 16px !important;
    font-weight: 800 !important;
  }

  .card-cart-controls .qty-input {
    width: 48px !important;
    font-size: 14px !important;
    font-weight: 800 !important;
  }

  .card-cart-controls .btn-add-cart {
    flex: 1 !important;
    height: 42px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 0 12px !important;
  }
}

/* 6. MOBİL TABLO KORUMASI (SEPET, EKSTRE, SİPARİŞLER) */
.table-responsive-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
  border-radius: 12px;
}

@media (max-width: 768px) {
  .b2b-table {
    min-width: 600px; /* Tablo içeriğini sıkıştırmadan yatay kaydırılabilir yap */
  }
  
  .b2b-table th, .b2b-table td {
    padding: 10px 8px !important;
    font-size: 11.5px !important;
  }
}

/* 7. MOBİL ALT SABİT MENÜ (BOTTOM NAVIGATION BAR) */
.mobile-bottom-nav-bar {
  display: none;
}

@media (max-width: 992px) {
  .header-fav-btn,
  #headerFavBtn,
  .header-action-cluster .header-fav-btn,
  .header-actions .header-fav-btn,
  .header-action-btn.header-fav-btn,
  a[href*="filter=favorites"],
  a[title*="Favori"],
  button[title*="Favori"],
  .fav-toggle-btn {
    display: none !important;
  }

  .floating-fiyat-gor-btn {
    display: none !important;
  }

  .mobile-bottom-nav-bar {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: calc(58px + env(safe-area-inset-bottom, 20px)) !important;
    background: var(--b2b-navy) !important; 
    border-top: 1px solid var(--b2b-navy-border) !important;
    box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.35);
    z-index: 99999 !important;
    align-items: flex-start;
    justify-content: space-around;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 20px)) 6px !important;
    box-sizing: border-box;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
    touch-action: none;
  }

  /* Alt barın altına zırhlı uzantı (iOS elastik kaydırmada altındaki boşluğu kapatır) */
  .mobile-bottom-nav-bar::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 500px;
    background: var(--b2b-navy);
    pointer-events: none;
  }

  .portal-footer, .main-footer {
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
    background: var(--b2b-navy-deep) !important;
  }
  .mobile-only-footer-text {
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
    background: var(--b2b-navy-deep) !important;
    color: #94a3b8 !important;
    margin-bottom: 0 !important;
  }
  .product-detail-page, .quick-order-page, .cart-page-layout, .account-page {
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .nav-bar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 10px;
    font-weight: 700;
    flex: 1;
    height: 100%;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
  }

  .nav-bar-btn i {
    font-size: 19px;
  }

  .nav-bar-btn.active, .nav-bar-btn:hover {
    color: #38bdf8;
  }

  .nav-bar-btn .cart-badge-pill {
    position: absolute;
    top: 6px;
    right: 22%;
    background: #ef4444;
    color: white;
    font-size: 9.5px;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 10px;
    border: 2px solid var(--b2b-navy);
  }

  /* Ortadaki Büyük Yuvarlak Barkod Butonu */
  .nav-scan-floating-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-top: -24px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.5);
    border: 4px solid var(--b2b-navy);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .nav-scan-floating-btn:active {
    transform: scale(0.9);
  }
}

/* 9. HEADER VE MOBİL ÇIKIŞ YAP (LOGOUT) BUTONU */
.header-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 38px;
}

.header-logout-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

.header-logout-btn.guest-login-btn {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.35);
}

.header-logout-btn.guest-login-btn:hover {
  background: var(--b2b-blue, #196cb3);
  color: #ffffff;
  border-color: var(--b2b-blue, #196cb3);
  box-shadow: 0 3px 10px rgba(25, 108, 179, 0.35);
}

@media (max-width: 768px) {
  .header-logout-btn .logout-text {
    display: none;
  }
  .header-logout-btn {
    padding: 6px 8px;
    height: 34px;
  }
}

/* 10. MOBİL FOOTER SADELEŞTİRME (SADECE MOBİLDE TEK SATIR, MASAÜSTÜ KORUNUR) */
.mobile-only-footer-text {
  display: none;
}

@media (max-width: 768px) {
  .portal-footer {
    padding: 14px 0 calc(85px + env(safe-area-inset-bottom, 20px)) 0 !important;
    background: var(--b2b-navy-deep) !important;
    border-top: 1px solid var(--b2b-navy-border) !important;
    margin-top: 20px !important;
    text-align: center !important;
  }

  .portal-footer .footer-grid {
    display: none !important;
  }

  .portal-footer .footer-bottom-bar {
    display: none !important;
  }

  .mobile-only-footer-text {
    display: block !important;
    text-align: center !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    letter-spacing: 0.3px !important;
    padding: 4px 0 !important;
  }

  /* Account Sayfası Alt Footer Sadeliği */
  .main-footer {
    margin-top: 20px !important;
    padding: 12px 0 calc(85px + env(safe-area-inset-bottom, 20px)) 0 !important;
    background: var(--b2b-navy-deep) !important;
    border-top: 1px solid var(--b2b-navy-border) !important;
  }

  .main-footer .footer-bottom-inner {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 4px !important;
  }

  .main-footer .footer-bottom-inner > div:first-child {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
  }

  .main-footer .footer-bottom-inner > div:last-child {
    display: none !important;
  }

  /* 11. MOBİL CARİ PROFİL KARTI (FERAH, AYDINLIK VE ŞIK TASARIM) */
  .account-profile-card {
    padding: 12px 14px !important;
    margin-bottom: 14px !important;
    border-radius: 14px !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05) !important;
  }

  .profile-card-inner {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .profile-left-cluster {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
  }

  .profile-dealer-avatar,
  #dealerInitials {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, var(--b2b-blue), #38bdf8) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 2px 8px rgba(25, 108, 179, 0.25) !important;
    flex-shrink: 0 !important;
  }

  .profile-dealer-info {
    min-width: 0 !important;
    flex: 1 !important;
  }

  .profile-company-title {
    font-size: 14px !important;
    font-weight: 800 !important;
    margin: 0 0 3px 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    color: var(--b2b-navy) !important;
  }

  .profile-dealer-meta {
    font-size: 11px !important;
    color: #64748b !important;
    gap: 5px !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .profile-dealer-meta strong {
    color: #1e293b !important;
  }

  .profile-dealer-meta .meta-separator {
    color: #cbd5e1 !important;
  }

  .profile-right-cluster {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    margin-top: 2px !important;
    padding-top: 8px !important;
    border-top: 1px solid #f1f5f9 !important;
    gap: 6px !important;
  }

  .profile-balance-badge {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 8px 12px !important;
    border-radius: 10px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
  }

  .balance-badge-label {
    font-size: 11.5px !important;
    color: #64748b !important;
    font-weight: 700 !important;
  }

  .balance-badge-val {
    font-size: 14px !important;
    font-weight: 900 !important;
  }

  .profile-logout-btn {
    display: none !important; /* Mobilde üst header'da çıkış butonu olduğundan mükerrer buton gizlenir */
  }

  /* Mobilde sağ alttaki yüzen WhatsApp butonunu gizle */
  .floating-whatsapp-btn {
    display: none !important;
  }
}



