/* ==========================================================================
   Kastaş — Üst Düzey Mobil Uyumluluk + Genel Override
   Tüm site için responsive iyileştirmeler; mevcut CSS'leri minimum etkilerle
   ezer. Class prefix yok, doğrudan vendor class'lara müdahale.
   --------------------------------------------------------------------------
   1. Ana menü wrap fix (Bilgi Bankası iki satır sorunu)
   2. Body horizontal scroll kilidi
   3. Tüm görseller responsive
   4. Touch hedefleri 44x44 px (Apple HIG / WCAG)
   5. Font ölçekleme — clamp() ile akışkan tipografi
   6. Mobil menü iyileştirmeleri
   7. Form alanları zoom önleme (16px min)
   8. Tablo overflow yatay scroll
   9. iOS Safe Area
   ========================================================================== */

/* ----- 1) MAİN NAV — wrap kapatma ve gap kontrolü ----- */
.navbar-nav .nav-item,
.navbar-nav .nav-item a,
.navbar-nav .nav-link,
.header-right-menu > li,
.header-right-menu > li > a {
    white-space: nowrap;
}


.navbar > li > a {
    /* Çok uzun menü adlarında font biraz küçülsün */
    letter-spacing: 0;
}

/* Geniş ekranlarda menü öğeleri arasındaki gap'i optimize et */
@media (min-width: 992px) and (max-width: 1199px) {
    .navbar > li > a {
        font-size: 13px;
        padding-left: 10px;
        padding-right: 10px;
    }
}

@media (min-width: 1200px) and (max-width: 1399px) {
    .navbar > li > a {
        font-size: 14px;
    }
}

/* ----- 2) BODY — yatay scroll kilidi (mobil mizanpaj korunur) -----
   DİKKAT: overflow-x:hidden html/body'de position:sticky'yi KIRAR (ürün
   detay filtre/tablo başlığı yapışmaz). clip scroll container oluşturmadığı
   için sticky çalışır; hidden yalnız eski tarayıcı fallback'i. */
html, body {
    overflow-x: hidden;
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

@media (max-width: 991px) {
    body {
        position: relative;
    }
}

/* ----- 3) GÖRSELLER — responsive default ----- */
img,
video,
picture {
    max-width: 100%;
    height: auto;
}

/* SVG ve iframe için de aynı */
iframe,
embed,
object {
    max-width: 100%;
}

/* iframe yüklemelerinde aspect-ratio koru */
.video-container,
.embed-responsive {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
}

.video-container > iframe,
.video-container > video,
.embed-responsive > iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

/* ----- 4) TOUCH HEDEFLERI — min 44x44 px (mobil) ----- */
@media (max-width: 991px) {
    .navbar > li > a,
    .header-right-menu > li > a,
    .btn,
    button,
    .button,
    a.menu-link,
    .footer-copyright > li > a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Form butonları */
    input[type="submit"],
    input[type="button"],
    button[type="submit"] {
        min-height: 44px;
        padding-top: 10px;
        padding-bottom: 10px;
    }
}

/* ----- 5) FONT ÖLÇEKLEME — clamp ile akışkan tipografi ----- */
@media (max-width: 767px) {
    h1, .h1 { font-size: clamp(1.75rem, 5.5vw, 2.5rem) !important; line-height: 1.2; }
    h2, .h2 { font-size: clamp(1.4rem, 4.5vw, 2rem) !important; line-height: 1.25; }
    h3, .h3 { font-size: clamp(1.2rem, 3.8vw, 1.6rem) !important; line-height: 1.3; }
    h4, .h4 { font-size: clamp(1.05rem, 3.2vw, 1.35rem) !important; line-height: 1.35; }
    body, p { font-size: 15px; line-height: 1.6; }

    /* Sayfa başlığı / hero overlay metinleri */
    .page-title,
    .hero-title,
    .banner-title {
        font-size: clamp(1.5rem, 6vw, 2.5rem) !important;
    }
}

/* ----- 6) FORM ELEMANLARI — iOS zoom önleme (en az 16px) ----- */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="url"],
textarea,
select {
    font-size: 16px; /* iOS Safari zoom yapmaması için kritik */
}

@media (min-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="search"],
    input[type="number"],
    input[type="url"],
    textarea,
    select {
        font-size: 14px;
    }
}

/* Input padding ve border-radius — daha rahat */
@media (max-width: 991px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
    textarea,
    select {
        padding: 11px 14px;
        min-height: 44px;
        border-radius: 8px;
    }
}

/* ----- 7) TABLOLAR — yatay scroll wrapper ----- */
@media (max-width: 767px) {
    .table-responsive,
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ----- 8) MOBİL MENÜ İYİLEŞTİRMELERİ ----- */
@media (max-width: 991px) {
    /* Hamburger menü iconu — daha büyük tıklama alanı */
    .navbar-toggler,
    .mobile-menu-toggle,
    .hamburger,
    [class*="menu-toggle"] {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }

    /* Mobil menü açıkken arka plan scroll kilidi */
    body.mobile-menu-open {
        overflow: hidden;
    }

    /* Mobil dropdown — daha rahat tıklama */
    .navbar .dropdown-menu a,
    .mobile-menu a {
        padding: 14px 16px;
    }
}

/* ----- 9) iOS SAFE AREA — notch'lu ekranlar için ----- */
@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    header,
    .header-wrapper {
        padding-top: env(safe-area-inset-top);
    }

    footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ----- 10) TIPOGRAFİ — okunabilirlik ----- */
@media (max-width: 767px) {
    /* Geniş paragraf uzun satırlarda daraltma — okuma rahat */
    p, .text-content {
        max-width: 100%;
        hyphens: auto;
        -webkit-hyphens: auto;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* ----- 11) CONTAINER — mobil dolu genişlik ----- */
@media (max-width: 767px) {
    .container,
    .container-fluid {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* ----- 12) BOOTSTRAP COL — mobilde tam genişlik (eski grid eklentileri için) ----- */
@media (max-width: 575px) {
    .col-9.pr-0,
    .col-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ----- 13) GÖRSEL OPTİMİZASYON — lazy loading yumuşak göster ----- */
img[loading="lazy"] {
    transition: opacity 0.3s ease;
}

img[loading="lazy"]:not([src]),
img[loading="lazy"]:not([src=""]) {
    opacity: 1;
}

/* ----- 14) BUTONLAR — touch ripple ve odak ----- */
button,
.btn,
input[type="submit"],
input[type="button"] {
    -webkit-tap-highlight-color: rgba(30, 64, 175, 0.15);
    touch-action: manipulation; /* Double-tap zoom kapat */
}

button:focus-visible,
.btn:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(30, 64, 175, 0.4);
    outline-offset: 2px;
}

/* ----- 15) SLİDER / CAROUSEL — touch-action ----- */
.slick-slider,
.slick-list,
[class*="slider"] {
    touch-action: pan-y pinch-zoom;
}

/* ----- 16) HERO / BANNER — mobilde aspect-ratio kontrolü ----- */
@media (max-width: 767px) {
    .banner,
    .hero,
    [class*="banner-image"],
    [class*="hero-image"] {
        min-height: auto;
    }

    .banner img,
    .hero img {
        height: auto !important;
        max-height: 60vh;
        object-fit: cover;
    }
}

/* ----- 17) FOOTER — mobilde column stack ----- */
@media (max-width: 767px) {
    footer .row > [class*="col-"] {
        margin-bottom: 24px;
    }

    footer .row > [class*="col-"]:last-child {
        margin-bottom: 0;
    }
}

/* ----- 18) DİL SEÇİCİ + SEPET — mobilde belirgin tıklama alanı ----- */
@media (max-width: 991px) {
    .language-switcher a,
    .lang-selector a,
    [class*="dil"] a {
        padding: 8px 12px;
        min-width: 44px;
        text-align: center;
    }
}

/* ----- 19) PRINT — gereksiz overlay/banner gizle ----- */
@media print {
    .kc-cookie-banner,
    .kc-cookie-modal,
    .navbar-toggler,
    .mobile-menu-toggle,
    nav,
    footer {
        display: none !important;
    }
}

/* ----- 20) REDUCED MOTION — animasyon hassasiyeti ----- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   21) MOBİL UYUMLULUK PATCH (audit sonrası eklenenler)
   ============================================================ */

/* --- Ürün listesi tablosu (.kastas-table-container) — XT200 vb. teknik özellikler --- */
@media (max-width: 767px) {
    .kastas-table-container {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    .kastas-table-container table { min-width: 600px; }
    .product-list-table .table-responsive { overflow-x: auto; }
    /* Filtre formu mobile'da tek kolon, dropdown'lar tam genişlik */
    .product-filters .content form { display: flex; flex-wrap: wrap; gap: 6px; }
    .product-filters .content form > span { flex: 1 1 calc(50% - 6px); min-width: 0; }
    .product-filters .content form input[type="text"] { width: 100%; }
}

/* --- Etkinlik kartı (.event-box) — mobile single column --- */
@media (max-width: 767px) {
    .event-box {
        display: flex !important;
        flex-direction: column;
    }
    .event-box .event-date,
    .event-box .event-detail {
        width: 100% !important;
        max-width: 100% !important;
    }
    .event-card-item, .calendar-card-item {
        margin-bottom: 16px;
    }
    .rotate-bar ul { display: flex; flex-wrap: wrap; gap: 4px; }
    .rotate-bar li { flex: 1 1 auto; text-align: center; }
}

/* --- Footer site haritası — mobilde tek kolon (column-count: 1) --- */
@media (max-width: 767px) {
    #footer .outside .footer-top .col-item .footer-nav {
        column-count: 1 !important;
    }
    #footer .outside .footer-top .col-item {
        margin-bottom: 24px;
    }
    .access-sites { flex-wrap: wrap; justify-content: center; gap: 8px; }
}

/* --- Header sağ logoları (SmartSeal / Seal-Link) — küçük ekranda kaydır --- */
@media (max-width: 1199px) and (min-width: 992px) {
    header .header-right-menu li img { max-height: 22px; width: auto; }
}
@media (max-width: 575px) {
    header .header-right-menu { display: none; }
}

/* --- Search bar mobile'da overlay --- */
@media (max-width: 767px) {
    .search-container .container-fluid { padding: 16px; }
    .search-container .best-search h3 { font-size: 1rem; }
    .search-container .input-group { flex-direction: row; }
}

/* --- Slider arrows mobile'da küçük + daha yakın --- */
@media (max-width: 575px) {
    .slick-prev, .slick-next,
    .homeBlog_blog-left, .homeBlog_blog-right {
        width: 32px !important;
        height: 32px !important;
    }
    .slider-controller { gap: 8px; }
}

/* --- Kategori ürün boxes (col-xl-3 col-lg-4) — mobile her zaman 2'li --- */
@media (max-width: 575px) {
    .product-rect-box.col-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .product-rect-box .product-gray-bg { padding: 8px; }
    .product-rect-box .image img { max-height: 100px; object-fit: contain; }
    .product-rect-box .text { font-size: 13px; }
}

/* --- Sticky sidebar mobile'da disable (full width) --- */
@media (max-width: 991px) {
    .sticky-container { position: static !important; }
    .sticky-sidebar, .sticky-product-menu-list { position: static !important; max-width: 100% !important; }
}

/* --- Tiptap rich content — long table responsive --- */
@media (max-width: 767px) {
    article.news-detail table,
    .col-lg-9 table {
        display: block;
        overflow-x: auto;
        max-width: 100%;
    }
}

/* --- Page title h1 — mobil küçült --- */
@media (max-width: 575px) {
    .page-title h1 { font-size: clamp(1.4rem, 5vw, 2rem) !important; line-height: 1.2; }
    .page-title { min-height: 140px; padding-top: 60px !important; }
    .page-title-filter { padding: 20px 0 !important; }
}

/* --- Form input + button mobile büyük tap area --- */
@media (max-width: 767px) {
    .form-control,
    select.form-control {
        min-height: 44px;
        font-size: 16px; /* iOS auto-zoom önle */
    }
    .submit-filter, .reset-filter, .kast-button {
        min-height: 44px;
        padding: 10px 16px;
    }
}

/* ================================================================
   Kullanıcı dostu özel checkbox — bülten formları (.ksl-check)
   Eski 002.png görselli .pretty kutucuklarının yerine net görünür,
   büyük tıklama alanlı, işaretlendiği belli olan bir kutu.
   ================================================================ */
.ksl-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    position: relative;
    user-select: none;
    line-height: 1.45;
    padding: 6px 0;
    margin: 0;
}
/* Native input'u gizle ama erişilebilir bırak (klavye/okuyucu) */
.ksl-check > input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 22px;
    height: 22px;
    margin: 0;
    cursor: pointer;
}
.ksl-check .ksl-box {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border: 2px solid #b9c2cc;
    border-radius: 5px;
    background: #fff;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
    position: relative;
    margin-top: 1px;
}
/* Onay işareti (tik) */
.ksl-check .ksl-box::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform .15s ease;
}
.ksl-check:hover .ksl-box { border-color: #003366; }
.ksl-check > input[type="checkbox"]:focus-visible + .ksl-box {
    box-shadow: 0 0 0 3px rgba(0, 51, 102, .25);
    border-color: #003366;
}
.ksl-check > input[type="checkbox"]:checked + .ksl-box {
    background: #003366;
    border-color: #003366;
}
.ksl-check > input[type="checkbox"]:checked + .ksl-box::after {
    transform: rotate(45deg) scale(1);
}
.ksl-check .ksl-check-label {
    color: #5a6673;
    font-size: 14px;
}
/* Zorunlu alan yıldızı */
.ksl-check.ksl-required .ksl-check-label::after {
    content: " *";
    color: #d33;
    font-weight: 700;
}
/* Sektör kutucukları grid içinde tam satır kaplasın */
.ksl-check.ksl-check-sector { padding: 4px 0; }
@media (max-width: 767px) {
    /* Mobilde daha rahat dokunuş */
    .ksl-check { gap: 14px; padding: 8px 0; }
    .ksl-check .ksl-box { width: 24px; height: 24px; }
    .ksl-check .ksl-box::after { left: 7px; top: 3px; }
}
