/**
 * Plax3D Web - Mobil Responsive CSS
 * Tüm sayfalar için mobil uyumluluk
 */

/* ===========================================
   TEMEL MOBİL AYARLARI
   =========================================== */
@media (max-width: 768px) {
    /* Body overflow engelle */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    body {
        position: relative !important;
    }

    /* Touch-friendly tüm interaktif elementler */
    button,
    a,
    input,
    select,
    textarea {
        min-height: 44px;
        min-width: 44px;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }

    /* Genel padding ve margin ayarları */
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Font boyutları */
    body {
        font-size: 14px;
    }

    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }
    h4 { font-size: 16px; }
    h5 { font-size: 14px; }
    h6 { font-size: 13px; }
}

/* ===========================================
   HEADER MOBİL DÜZENLEME
   =========================================== */
@media (max-width: 768px) {
    /* Top bar gizle */
    .top-bar {
        display: none !important;
    }

    /* Header ayarları */
    .header {
        position: fixed;
        top: 64px; /* App banner için boşluk (banner 64px yüksekliğinde) */
        left: 0;
        right: 0;
        z-index: 10000 !important; /* Banner'ın altında */
    }
    
    /* Top bar - Desktop'ta göster, mobilde gizle */
    .top-bar {
        display: none; /* Mobilde gizli */
    }

    .header-inner {
        flex-wrap: nowrap;
        padding: 12px 15px !important;
        gap: 10px !important;
    }

    /* Logo küçült */
    .logo {
        font-size: 16px !important;
        white-space: nowrap;
    }

    /* Arama kutusu */
    .search-box {
        display: none; /* Mobilde arama için ayrı buton */
    }

    .search-box.mobile-active {
        display: block;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        padding: 10px 15px;
        background: white;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        z-index: 999;
    }

    /* Header butonları */
    .header-actions {
        gap: 8px !important;
        flex-wrap: nowrap;
    }

    .header-btn {
        padding: 8px 12px !important;
        font-size: 11px !important;
        white-space: nowrap;
    }

    .header-btn span {
        display: none; /* Sadece ikonlar göster */
    }

    /* Hamburger menu butonu */
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: transparent;
        border: none;
        cursor: pointer;
        font-size: 24px;
        color: #6366f1;
    }

    /* Mobil menü overlay */
    .mobile-menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 10006 !important; /* Banner'ın üstünde */
    }

    .mobile-menu-overlay.active {
        display: block;
    }

    /* Mobil menü drawer */
    .mobile-menu-drawer {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        box-shadow: -2px 0 8px rgba(0,0,0,0.15);
        transition: right 0.3s ease;
        z-index: 10007 !important; /* En üstte - Banner ve overlay'in üstünde */
        overflow-y: auto;
    }

    .mobile-menu-drawer.active {
        right: 0;
    }

    .mobile-menu-header {
        padding: 20px 15px;
        background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
        color: white;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-menu-close {
        background: transparent;
        border: none;
        color: white;
        font-size: 28px;
        cursor: pointer;
        width: 44px;
        height: 44px;
    }

    .mobile-menu-content {
        padding: 20px 15px;
    }

    .mobile-menu-item {
        display: block;
        padding: 15px 10px;
        color: #333;
        text-decoration: none;
        border-bottom: 1px solid #f0f0f0;
        font-size: 15px;
        transition: background 0.2s;
    }

    .mobile-menu-item:hover {
        background: #f8f9fa;
    }

    /* Kategori nav - MOBİLDE FIXED VE YUKARIDA SABİT KALSIN */
    .category-nav {
        position: fixed !important;
        top: 132px !important; /* App banner (64px) + Header (68px) = 132px */
        left: 0 !important;
        right: 0 !important;
        background: white !important;
        z-index: 9999 !important; /* Header'ın altında */
        box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
        border-bottom: 1px solid #e9d5ff !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none !important;
        margin: 0 !important;
        margin-top: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    .category-nav::-webkit-scrollbar {
        display: none !important;
    }

    .category-nav-inner {
        padding: 0 15px !important;
        gap: 0 !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap !important;
        scrollbar-width: none !important;
        display: flex !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    .category-nav-inner::-webkit-scrollbar {
        display: none !important;
        height: 0 !important;
    }

    .category-nav a {
        padding: 12px 16px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        border-bottom: 2px solid transparent !important;
        transition: all 0.2s;
    }
    
    .category-nav a:hover,
    .category-nav a.active {
        color: #6366f1 !important;
        border-bottom-color: #8b5cf6 !important;
    }

    /* Content için üst boşluk - APP BANNER + HEADER + CATEGORY NAV */
    body:has(.header) .container:first-of-type,
    body:has(.header) main:first-of-type,
    .container {
        margin-top: 176px !important; /* App banner 64px + Header 68px + Category 44px = 176px */
    }
}

/* ===========================================
   BANNER MOBİL DÜZENLEMELERİ - KRİTİK!
   =========================================== */
@media (max-width: 768px) {
    /* Büyük bannerlar section */
    .large-banner-section {
        margin: 15px auto !important;
        padding: 0 10px !important;
    }

    .large-banners-wrapper {
        border-radius: 12px !important;
        overflow: hidden !important;
    }

    /* Büyük banner item - MOBİL BOYUT */
    .large-banner-item {
        height: 180px !important;
        min-height: 180px !important;
        max-height: 180px !important;
        min-width: 100% !important;
        width: 100% !important;
    }

    /* Banner görselleri - TAM EKRAN SIĞDIR */
    .large-banner-item img {
        width: 100% !important;
        height: 100% !important;
        min-width: 100% !important;
        min-height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        display: block !important;
    }

    /* Banner navigation okları - MOBİL */
    .banner-nav-arrow {
        width: 32px !important;
        height: 32px !important;
        font-size: 16px !important;
    }

    .banner-nav-arrow.prev {
        left: 10px !important;
    }

    .banner-nav-arrow.next {
        right: 10px !important;
    }

    /* Banner indicators - MOBİL */
    .banner-indicators {
        bottom: 12px !important;
        gap: 6px !important;
    }

    .banner-indicator {
        width: 6px !important;
        height: 6px !important;
    }

    .banner-indicator.active {
        width: 20px !important;
    }

    /* Küçük bannerlar section */
    .small-banners-section {
        margin: 20px auto !important;
        padding: 0 10px !important;
    }

    .small-banners-grid {
        gap: 8px !important;
    }

    /* Küçük banner - MOBİL BOYUT */
    .small-banner-item {
        height: 120px !important;
        min-height: 120px !important;
        max-height: 120px !important;
        border-radius: 8px !important;
        overflow: hidden !important;
    }

    /* Küçük banner görselleri */
    .small-banner-item img {
        width: 100% !important;
        height: 100% !important;
        min-width: 100% !important;
        min-height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        display: block !important;
    }

    /* Küçük bannerları 2 sütun yap mobilde */
    .small-banners-grid.cols-3,
    .small-banners-grid.cols-4,
    .small-banners-grid.cols-5,
    .small-banners-grid.cols-6,
    .small-banners-grid.cols-7,
    .small-banners-grid.cols-8 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .small-banners-grid.cols-1 {
        grid-template-columns: 1fr !important;
    }

    .small-banners-grid.cols-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Çok küçük ekranlar için daha da küçült */
@media (max-width: 480px) {
    .large-banner-item {
        height: 160px !important;
        min-height: 160px !important;
        max-height: 160px !important;
    }

    .small-banner-item {
        height: 100px !important;
        min-height: 100px !important;
        max-height: 100px !important;
    }

    .banner-nav-arrow {
        width: 28px !important;
        height: 28px !important;
        font-size: 14px !important;
    }
}

/* Mini ekranlar (iPhone SE vb.) */
@media (max-width: 375px) {
    .large-banner-item {
        height: 140px !important;
        min-height: 140px !important;
        max-height: 140px !important;
    }

    .small-banner-item {
        height: 90px !important;
        min-height: 90px !important;
        max-height: 90px !important;
    }
}

/* ===========================================
   CARD VE GRID DÜZENLEMELERİ
   =========================================== */
@media (max-width: 768px) {
    /* Grid düzenlemeleri */
    .products-grid,
    .grid,
    .card-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    /* Card düzenlemeleri */
    .card,
    .product-card {
        padding: 12px !important;
    }

    .card img,
    .product-card img {
        height: 140px !important;
        object-fit: cover;
    }

    .card-title,
    .product-title {
        font-size: 13px !important;
        line-height: 1.3;
    }

    .card-price,
    .product-price {
        font-size: 16px !important;
    }

    .card-btn,
    .product-btn {
        padding: 10px !important;
        font-size: 12px !important;
    }
}

/* ===========================================
   FORM VE INPUT DÜZENLEMELERİ
   =========================================== */
@media (max-width: 768px) {
    .form-group {
        margin-bottom: 15px !important;
    }

    .form-input,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important; /* iOS zoom önleme */
        padding: 12px 15px !important;
        min-height: 48px !important;
    }

    .form-label {
        font-size: 13px !important;
        margin-bottom: 6px !important;
    }

    /* Button düzenlemeleri */
    .btn,
    button[type="submit"],
    .btn-primary,
    .btn-secondary {
        min-height: 48px !important;
        padding: 12px 20px !important;
        font-size: 15px !important;
        font-weight: 600 !important;
    }

    /* İki sütunlu form düzeni */
    .form-row {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .form-row > * {
        width: 100% !important;
    }
}

/* ===========================================
   TABLO DÜZENLEMELERİ
   =========================================== */
@media (max-width: 768px) {
    /* Tablo scroll */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 13px !important;
        min-width: 600px;
    }

    th, td {
        padding: 10px 8px !important;
    }

    /* Responsive tablo (card görünümü) */
    .table-responsive {
        display: block;
    }

    .table-responsive thead {
        display: none;
    }

    .table-responsive tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 15px;
        background: white;
    }

    .table-responsive td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0 !important;
        border-bottom: 1px solid #f0f0f0;
    }

    .table-responsive td:last-child {
        border-bottom: none;
    }

    .table-responsive td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #666;
    }
}

/* ===========================================
   MODAl VE POPUP DÜZENLEMELERİ
   =========================================== */
@media (max-width: 768px) {
    .modal,
    .popup {
        padding: 15px !important;
    }

    .modal-content,
    .popup-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 12px 12px 0 0 !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header,
    .popup-header {
        padding: 15px !important;
        font-size: 18px !important;
    }

    .modal-body,
    .popup-body {
        padding: 15px !important;
    }

    .modal-footer,
    .popup-footer {
        padding: 15px !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .modal-footer button,
    .popup-footer button {
        width: 100% !important;
    }
}

/* ===========================================
   SEPETve CHECKOUT MOBİL
   =========================================== */
@media (max-width: 768px) {
    .cart-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    .cart-item-image {
        width: 100% !important;
        height: 180px !important;
    }

    .cart-item-details {
        width: 100% !important;
    }

    .cart-summary {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 15px !important;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
        z-index: 100;
    }

    .cart-summary-sticky {
        padding-bottom: 80px !important;
    }

    .quantity-selector {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .quantity-selector button {
        width: 36px !important;
        height: 36px !important;
        font-size: 18px !important;
    }

    .quantity-selector input {
        width: 60px !important;
        text-align: center !important;
        font-size: 16px !important;
    }
}

/* ===========================================
   ÜRÜN DETAY MOBİL
   =========================================== */
@media (max-width: 768px) {
    .product-detail-container {
        flex-direction: column !important;
    }

    .product-images {
        width: 100% !important;
        margin-bottom: 20px;
    }

    .product-info {
        width: 100% !important;
    }

    .product-main-image {
        height: 300px !important;
    }

    .product-thumbnail {
        width: 60px !important;
        height: 60px !important;
    }

    .product-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 15px;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
        z-index: 100;
        display: flex;
        gap: 10px;
    }

    .product-actions button {
        flex: 1;
    }

    .product-detail-content {
        padding-bottom: 80px !important;
    }
}

/* ===========================================
   PROFİL VE HESAP AYARLARI MOBİL
   =========================================== */
@media (max-width: 768px) {
    .profile-container {
        flex-direction: column !important;
    }

    .profile-sidebar {
        width: 100% !important;
        margin-bottom: 20px;
    }

    .profile-content {
        width: 100% !important;
    }

    .profile-menu {
        display: flex;
        overflow-x: auto;
        gap: 10px;
        padding: 10px 0;
        -webkit-overflow-scrolling: touch;
    }

    .profile-menu-item {
        white-space: nowrap;
        padding: 10px 15px !important;
        font-size: 13px !important;
    }

    .address-card,
    .order-card {
        padding: 15px !important;
    }

    .address-actions,
    .order-actions {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .address-actions button,
    .order-actions button {
        width: 100% !important;
    }
}

/* ===========================================
   SATICI PANELİ MOBİL
   =========================================== */
@media (max-width: 768px) {
    .seller-dashboard {
        padding: 15px !important;
    }

    .seller-stats {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .seller-sidebar {
        display: none; /* Mobilde hamburger menü kullan */
    }

    .seller-sidebar.mobile-active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        background: white;
        z-index: 1000;
        box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    }

    .seller-content {
        width: 100% !important;
        padding: 0 !important;
    }

    .seller-table {
        font-size: 12px !important;
    }

    .seller-chart {
        height: 250px !important;
    }
}

/* ===========================================
   ARAMA SONUÇLARI MOBİL
   =========================================== */
@media (max-width: 768px) {
    .search-filters {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
        box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    }

    .search-filters.active {
        left: 0;
    }

    .filter-toggle-btn {
        display: flex !important;
        margin-bottom: 15px;
        width: 100%;
    }

    .search-results {
        width: 100% !important;
    }

    .sort-options {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===========================================
   YARDIMCI SINIFLAR
   =========================================== */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    .show-mobile {
        display: block !important;
    }

    .mobile-full-width {
        width: 100% !important;
    }

    .mobile-text-center {
        text-align: center !important;
    }

    .mobile-stack {
        flex-direction: column !important;
    }

    /* Mobil spacing */
    .mobile-mt-1 { margin-top: 8px !important; }
    .mobile-mt-2 { margin-top: 16px !important; }
    .mobile-mt-3 { margin-top: 24px !important; }
    .mobile-mb-1 { margin-bottom: 8px !important; }
    .mobile-mb-2 { margin-bottom: 16px !important; }
    .mobile-mb-3 { margin-bottom: 24px !important; }
    .mobile-p-1 { padding: 8px !important; }
    .mobile-p-2 { padding: 16px !important; }
    .mobile-p-3 { padding: 24px !important; }
}

/* ===========================================
   STICKY FOOTER BUTONLARI
   =========================================== */
@media (max-width: 768px) {
    .mobile-sticky-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 12px 15px;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
        z-index: 100;
        display: flex;
        gap: 10px;
    }

    .mobile-sticky-footer button {
        flex: 1;
    }

    /* Sticky footer varsa content'e padding ekle */
    body:has(.mobile-sticky-footer) main,
    body:has(.mobile-sticky-footer) .content {
        padding-bottom: 80px !important;
    }
}

/* ===========================================
   YATAY SCROLL DÜZENLEMELERİ
   =========================================== */
@media (max-width: 768px) {
    .horizontal-scroll {
        display: flex;
        overflow-x: auto;
        gap: 12px;
        padding: 15px 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .horizontal-scroll::-webkit-scrollbar {
        display: none;
    }

    .horizontal-scroll-item {
        flex: 0 0 auto;
        width: 160px;
    }
}

/* ===========================================
   TOUCH GESTİCİLERİ İYİLEŞTİRME
   =========================================== */
@media (max-width: 768px) {
    /* Swipe için enable */
    .swipeable {
        touch-action: pan-y;
    }

    /* Smooth scroll */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    /* Prevent double-tap zoom on buttons */
    button,
    a {
        touch-action: manipulation;
    }
}

/* ===========================================
   LOADİNG VE SKELETON MOBİL
   =========================================== */
@media (max-width: 768px) {
    .loading-overlay {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255, 255, 255, 0.95);
        z-index: 9999;
    }

    .skeleton {
        animation: skeleton-loading 1s linear infinite;
    }

    @keyframes skeleton-loading {
        0% { opacity: 0.6; }
        50% { opacity: 1; }
        100% { opacity: 0.6; }
    }
}
