/**
 * Luminie - Ortak Mobil CSS Standartları
 * Tüm sayfalarda tutarlı mobil deneyim için standart CSS kuralları
 * Güvenli şekilde mevcut stilleri bozmadan eklenir
 */

/* ==========================================================================
   MOBIL STANDART BREAKPOINT'LER
   ========================================================================== */

/* Ana mobil breakpoint - 768px ve altı */
@media (max-width: 768px) {
    
    /* ==========================================================================
       GENEL CONTAINER VE LAYOUT
       ========================================================================== */
    
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Sayfa başlıkları */
    .page-header {
        padding: 2rem 0 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    .page-header h1 {
        font-size: 1.75rem !important;
    }
    
    .page-header p {
        font-size: 1rem !important;
    }
    
    /* ==========================================================================
       KART SISTEMLERI - TÜM SAYFALARDA TUTARLI
       ========================================================================== */
    
    /* Modern kartlar (resources, categories vb.) */
    .modern-card {
        margin-bottom: 1rem !important;
        border-radius: 12px !important;
    }
    
    .modern-card .card-image {
        height: 180px !important;
    }
    
    .modern-card .card-content {
        padding: 1rem !important;
    }
    
    /* Kategori kartları */
    .category-card,
    .modern-category-card {
        margin-bottom: 1rem !important;
        border-radius: 12px !important;
        min-height: 200px !important;
    }
    
    /* İçerik kartları */
    .content-card {
        margin-bottom: 1rem !important;
        padding: 1rem !important;
    }
    
    /* ==========================================================================
       FORM VE INPUT STANDARTLARI
       ========================================================================== */
    
    /* iOS zoom engellemek için 16px minimum font */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important;
        padding: 12px 16px !important;
        border-radius: 8px !important;
    }
    
    /* Arama inputları */
    .search-input,
    .search-input-group input {
        font-size: 16px !important;
        padding: 12px 16px !important;
    }
    
    /* ==========================================================================
       BUTON STANDARTLARI
       ========================================================================== */
    
    /* Minimum dokunma alanı 44px */
    .btn {
        min-height: 44px !important;
        min-width: 44px !important;
        padding: 12px 16px !important;
    }
    
    .btn-sm {
        min-height: 36px !important;
        padding: 8px 12px !important;
    }
    
    .btn-lg {
        min-height: 52px !important;
        padding: 16px 24px !important;
    }
    
    /* ==========================================================================
       FILTRE VE ARAMA BÖLÜMLERI
       ========================================================================== */
    
    .filters-section {
        padding: 1.5rem 1rem !important;
        margin-bottom: 1.5rem !important;
        border-radius: 16px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    }

    .filters-section::before {
        height: 3px !important;
    }

    .filters-section .row {
        gap: 1rem;
    }

    .filters-section .col-md-4,
    .filters-section .col-md-3,
    .filters-section .col-md-6 {
        margin-bottom: 1rem;
    }

    .search-input-group {
        border-radius: 14px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
    }

    .search-input-group input {
        padding: 14px 16px !important;
        padding-right: 70px !important;
    }

    .search-input-group .search-btn {
        padding: 8px 12px !important;
        border-radius: 10px !important;
        right: 4px !important;
    }
    
    /* ==========================================================================
       SAYFALAMA (PAGINATION)
       ========================================================================== */
    
    .pagination-container {
        padding: 1rem !important;
        margin-top: 1rem !important;
        border-radius: 12px !important;
    }
    
    .pagination .page-link {
        min-height: 44px !important;
        min-width: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* ==========================================================================
       GRID SISTEMLERI
       ========================================================================== */
    
    /* İçerik grid'leri */
    .content-grid,
    .resources-grid {
        gap: 1rem !important;
    }
    
    /* Kategori grid'leri */
    .categories-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        padding: 0 0.5rem !important;
    }
    
    /* ==========================================================================
       TOUCH OPTIMIZASYONLARI
       ========================================================================== */
    
    /* Tüm tıklanabilir elementler için */
    .btn,
    .card,
    .nav-link,
    .dropdown-item,
    .page-link,
    .modern-card,
    .category-card {
        -webkit-tap-highlight-color: rgba(59, 130, 246, 0.1) !important;
        tap-highlight-color: rgba(59, 130, 246, 0.1) !important;
    }
    
    /* ==========================================================================
       FLOATING ELEMENTLER
       ========================================================================== */
    
    .floating-contact {
        bottom: 20px !important;
        right: 20px !important;
        gap: 12px !important;
    }
    
    .floating-btn {
        width: 55px !important;
        height: 55px !important;
        font-size: 1.4rem !important;
    }
    
    /* Tooltip'leri mobilde gizle */
    .floating-btn::after,
    .tooltip {
        display: none !important;
    }
}

/* ==========================================================================
   KÜÇÜK MOBIL CIHAZLAR - 576px ve altı
   ========================================================================== */

@media (max-width: 576px) {
    
    /* Container padding'i daha da azalt */
    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    /* Sayfa başlıkları daha küçük */
    .page-header {
        padding: 1.5rem 0 1rem !important;
    }
    
    .page-header h1 {
        font-size: 1.5rem !important;
    }
    
    /* Kartlar daha kompakt */
    .modern-card,
    .category-card,
    .content-card {
        margin-bottom: 0.75rem !important;
        padding: 0.75rem !important;
    }
    
    .modern-card .card-image {
        height: 150px !important;
    }
    
    /* Filtre bölümü daha kompakt */
    .filters-section {
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Butonlar biraz daha küçük ama hala dokunma dostu */
    .btn {
        padding: 10px 14px !important;
        font-size: 0.9rem !important;
    }
    
    /* Grid gap'leri azalt */
    .content-grid,
    .resources-grid,
    .categories-grid {
        gap: 0.75rem !important;
    }
}

/* ==========================================================================
   FOOTER MOBIL OPTIMIZASYONLARI
   ========================================================================== */

@media (max-width: 768px) {
    /* Ana sayfa hariç tüm sayfalarda footer'ı gizle */
    body:not(.homepage) .modern-footer {
        display: none !important;
    }

    /* Ana sayfa footer'ını mobilde kompakt yap */
    body.homepage .desktop-footer {
        display: none !important;
    }

    body.homepage .mobile-footer {
        display: block !important;
    }

    /* Footer gizli sayfalarda alt padding ekle */
    body:not(.homepage) {
        padding-bottom: 2rem;
    }
}

/* ==========================================================================
   DROPDOWN MOBIL OPTIMIZASYONLARI
   ========================================================================== */

@media (max-width: 768px) {
    /* Mobil dropdown'lar için tam ekran modal — yalnızca açıkken */
    .dropdown-menu.show {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: none !important;
        max-height: none !important;
        border: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
        z-index: 9999 !important;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        animation: mobileDropdownSlide 0.3s ease-out;
        display: flex !important;
        flex-direction: column;
        overflow-y: auto;
    }

    .dropdown-menu:not(.show) {
        display: none !important;
    }

    @keyframes mobileDropdownSlide {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Dropdown header */
    .dropdown-menu::before {
        content: '';
        position: sticky;
        top: 0;
        height: 60px;
        background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px;
        color: white;
        font-weight: 600;
        font-size: 18px;
        z-index: 10;
        flex-shrink: 0;
    }

    /* Notification dropdown header */
    .notification-menu::before {
        content: '📢 Bildirimler';
    }

    /* User dropdown header */
    .dropdown-menu[data-dropdown-type="profile"]::before,
    .user-menu::before {
        content: '👤 Profil Menüsü';
    }

    /* Close button */
    .mobile-close-btn {
        position: absolute;
        top: 15px;
        right: 20px;
        background: rgba(255, 255, 255, 0.2);
        border: none;
        color: white;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        cursor: pointer;
        z-index: 11;
        transition: all 0.2s ease;
        font-weight: bold;
    }

    .mobile-close-btn:hover,
    .mobile-close-btn:focus {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(1.1);
    }

    /* Notification menu content */
    .notification-menu {
        flex: 1;
        overflow-y: auto;
        padding: 0;
        margin-top: 0;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .notification-header {
        display: none; /* Hidden since we have modal header */
    }

    .notification-list {
        max-height: none;
        padding: 20px;
        background: white;
        margin: 0;
    }

    .notification-item {
        padding: 20px;
        border-radius: 12px;
        margin-bottom: 12px;
        background: #f8f9ff;
        border: 1px solid #e2e8f0;
        transition: all 0.3s ease;
    }

    .notification-item:hover {
        transform: none;
        background: #f1f5f9;
    }

    .notification-icon {
        width: 48px;
        height: 48px;
        border-radius: 14px;
        flex-shrink: 0;
    }

    .notification-title {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 4px;
    }

    .notification-text {
        font-size: 14px;
        color: #64748b;
        margin-bottom: 8px;
    }

    .notification-time {
        font-size: 12px;
        color: #94a3b8;
    }

    .notification-footer {
        padding: 20px;
        position: sticky;
        bottom: 0;
        background: white;
        border-top: 1px solid #e2e8f0;
        margin-top: auto;
        flex-shrink: 0;
    }

    /* User menu content */
    .user-menu {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
        background: white;
        border: none;
        box-shadow: none;
    }

    .user-menu-header {
        display: none; /* Hidden since we have modal header */
    }

    .user-menu .dropdown-item {
        padding: 16px 20px;
        border-radius: 12px;
        margin-bottom: 8px;
        background: #f8f9ff;
        border: 1px solid #e2e8f0;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        gap: 12px;
        text-decoration: none;
        color: #1e293b;
        font-weight: 500;
    }

    .user-menu .dropdown-item:hover {
        background: #f1f5f9;
        transform: translateX(5px);
        color: #1e293b;
    }

    .user-menu .dropdown-item i {
        width: 20px;
        text-align: center;
        color: var(--primary-blue);
    }

    /* Touch optimizasyonları */
    .notification-item,
    .user-menu .dropdown-item,
    .mobile-close-btn {
        -webkit-tap-highlight-color: rgba(59, 130, 246, 0.1);
        tap-highlight-color: rgba(59, 130, 246, 0.1);
        min-height: 44px;
    }

    /* Safe area for iOS */
    .dropdown-menu {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ==========================================================================
   WEBVIEW ÖZEL OPTIMIZASYONLAR
   ========================================================================== */

/* WebView algılama için */
@media (max-width: 768px) {

    /* WebView'da scroll performansı için */
    * {
        -webkit-overflow-scrolling: touch;
    }

    /* WebView'da animasyon performansı */
    .modern-card,
    .category-card {
        will-change: transform;
        transform: translateZ(0);
    }

    /* WebView'da input focus sorunları için */
    input:focus,
    textarea:focus,
    select:focus {
        transform: translateZ(0);
        -webkit-appearance: none;
    }
}

/* ==========================================================================
   ACCESSIBILITY VE KULLANICILIK
   ========================================================================== */

@media (max-width: 768px) {
    
    /* Reduced motion desteği */
    @media (prefers-reduced-motion: reduce) {
        .modern-card,
        .category-card,
        .btn {
            transition: none !important;
            animation: none !important;
        }
    }
    
    /* Dark mode desteği */
    @media (prefers-color-scheme: dark) {
        .modern-card,
        .filters-section,
        .pagination-container {
            background-color: #1f2937 !important;
            border-color: #374151 !important;
            color: #f9fafb !important;
        }
    }
    
    /* High contrast desteği */
    @media (prefers-contrast: high) {
        .btn,
        .modern-card,
        .category-card {
            border: 2px solid currentColor !important;
        }
    }
}
