/* =====================================================
   ANDROID RESPONSIVE FIX - CB Hizmet
   Android cihazlarda görülen responsive sorunları çözümü
   ===================================================== */

/* Android WebView ve Chrome için özel ayarlar */
@supports (-webkit-appearance: none) {
    /* Android Chrome ayarları */
    .mobile-menu-toggle {
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Android cihazlar için Mobile Menu Toggle düzeltmeleri */
@media screen and (max-width: 768px) {
    
    /* Mobile Menu Toggle düzeltmeleri */
    .mobile-menu-toggle {
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        width: 44px !important;
        height: 44px !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        z-index: 1002 !important;
        /* Android için özel dokunma alanı */
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* Hamburger çizgileri */
    .hamburger-line {
        display: block !important;
        width: 22px !important;
        height: 2px !important;
        background: #333 !important;
        border-radius: 1px !important;
        transition: all 0.3s ease !important;
        margin: 2px 0 !important;
        transform-origin: center !important;
        /* Android optimizasyonu */
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        will-change: transform;
    }
    
    /* Mobile Menu düzeltmeleri */
    .mobile-menu {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100vh !important;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease !important;
        z-index: 1001 !important;
        /* Android scroll düzeltmesi */
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
    }
    
    .mobile-menu.active {
        transform: translateX(0) !important;
    }
    
    /* Header'da mobil toggle konumlandırması */
    .header .container {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        position: relative !important;
    }
    
    /* Logo ve toggle arasında denge */
    .logo {
        flex: 1 !important;
        max-width: calc(100% - 60px) !important;
    }
    
    /* Desktop nav gizleme */
    .nav {
        display: none !important;
    }
    
    .header-cta {
        display: none !important;
    }
}

/* Android spesifik viewport ayarları */
@media screen and (max-width: 480px) {
    
    /* Çok küçük Android cihazlar için */
    .mobile-menu-toggle {
        width: 40px !important;
        height: 40px !important;
    }
    
    .hamburger-line {
        width: 20px !important;
    }
    
    /* Mobile menu içerik padding */
    .mobile-menu-content {
        padding: 20px 15px !important;
    }
    
    .mobile-nav-item {
        margin: 8px 0 !important;
    }
    
    .mobile-nav-link {
        padding: 12px 16px !important;
        font-size: 16px !important;
        /* Android için minimum dokunma alanı */
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
    }
}

/* Samsung Internet ve WebView için özel ayarlar */
@media screen and (-webkit-min-device-pixel-ratio: 2) {
    .mobile-menu-toggle {
        /* Retina ekranlar için keskinlik */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .hamburger-line {
        /* Retina'da çizgi kalınlığı */
        height: 1.5px !important;
    }
}

/* Android 4.4+ WebView uyumluluğu */
@media screen and (max-width: 768px) {
    
    /* Eski Android sürümleri için fallback */
    .mobile-menu {
        /* Backdrop filter desteklenmiyorsa */
        background: rgba(255, 255, 255, 0.95) !important;
    }
    
    /* Transform alternatifleri */
    @supports not (transform: translateX(-100%)) {
        .mobile-menu {
            left: -100% !important;
            transform: none !important;
        }
        
        .mobile-menu.active {
            left: 0 !important;
        }
    }
}

/* Android Chrome'da hamburger menü animasyonu */
@media screen and (max-width: 768px) {
    
    .mobile-menu-toggle.active .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translateY(6px) !important;
        background: #667eea !important;
    }
    
    .mobile-menu-toggle.active .hamburger-line:nth-child(2) {
        opacity: 0 !important;
        transform: scale(0) !important;
    }
    
    .mobile-menu-toggle.active .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translateY(-6px) !important;
        background: #667eea !important;
    }
}

/* Android'da body scroll kilitleme */
@media screen and (max-width: 768px) {
    
    body.mobile-menu-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        /* Android'da scroll bounce'u önleme */
        -webkit-overflow-scrolling: auto !important;
    }
}

/* Android klavye açıldığında viewport ayarları */
@media screen and (max-width: 768px) and (max-height: 500px) {
    
    .mobile-menu {
        height: 100vh !important;
        /* Klavye açık durumda */
        position: fixed !important;
    }
    
    .mobile-menu-content {
        padding: 10px 15px !important;
        overflow-y: auto !important;
        max-height: calc(100vh - 20px) !important;
    }
}

/* Android'da touch feedback */
@media screen and (max-width: 768px) {
    
    .mobile-menu-toggle:active {
        background: rgba(102, 126, 234, 0.1) !important;
        border-radius: 50% !important;
        /* Android'da haptic feedback simülasyonu */
        transform: scale(0.95) !important;
    }
    
    .mobile-nav-link:active {
        background: rgba(102, 126, 234, 0.1) !important;
        transform: scale(0.98) !important;
    }
}

/* Samsung One UI ve Xiaomi MIUI için özel ayarlar */
@media screen and (max-width: 768px) {
    
    /* Özel Android UI'ları için margin ayarları */
    .header {
        padding-top: max(10px, env(safe-area-inset-top)) !important;
        padding-bottom: 10px !important;
    }
    
    .mobile-menu {
        /* Android'da full screen */
        top: 0 !important;
        padding-top: max(60px, env(safe-area-inset-top, 60px)) !important;
        padding-bottom: max(20px, env(safe-area-inset-bottom, 20px)) !important;
    }
}

/* Android'da orientation change düzeltmeleri */
@media screen and (max-width: 768px) and (orientation: landscape) {
    
    .mobile-menu {
        /* Yatay modda tam ekran */
        width: 100vw !important;
        height: 100vh !important;
    }
    
    .mobile-menu-content {
        padding: 15px !important;
        columns: 2 !important;
        column-gap: 20px !important;
    }
    
    .mobile-nav-item {
        break-inside: avoid !important;
        margin: 5px 0 !important;
    }
}

/* Android Chrome'da pull-to-refresh'i devre dışı bırakma */
@media screen and (max-width: 768px) {
    
    body {
        overscroll-behavior-y: contain !important;
        /* Android'da aşağı çekme yenilemeyi önler */
    }
    
    .mobile-menu {
        overscroll-behavior: contain !important;
        /* Menu açıkken scroll bounce'u önler */
    }
}

/* Android'da specifik cihaz ayarları */

/* Galaxy S serisi için */
@media screen and (max-width: 768px) and (min-resolution: 2dppx) {
    .mobile-menu-toggle {
        /* AMOLED ekranlar için kontrast artırımı */
        filter: contrast(1.1) !important;
    }
}

/* Xiaomi cihazlar için */
@media screen and (max-width: 768px) and (min-aspect-ratio: 19/9) {
    .mobile-menu {
        /* Uzun ekranlar için */
        padding-top: 80px !important;
    }
}

/* Android'da performans optimizasyonu */
@media screen and (max-width: 768px) {
    
    .mobile-menu,
    .mobile-menu-toggle,
    .hamburger-line {
        /* GPU acceleration */
        will-change: transform !important;
        transform: translateZ(0) !important;
    }
    
    .mobile-menu-toggle {
        /* Android'da render optimizasyonu */
        contain: layout style paint !important;
    }
}

/* Android WebView için JavaScript fallback'leri */
@media screen and (max-width: 768px) {
    
    /* CSS-only hamburger menu (JS çalışmazsa) */
    .mobile-menu-toggle:not(.js-enabled) {
        position: relative !important;
    }
    
    .mobile-menu-toggle:not(.js-enabled):focus + .mobile-menu {
        transform: translateX(0) !important;
    }
}