/* comparemobile.css */
/* Mobil uyumluluk ve Navbar İzolasyonu - Karşılaştırma Sayfası */

/* ========== Global Layout Control (Taşmayı Önle) ========== */
@media (max-width: 1024px) {

    html,
    body {
        max-width: 100%;
        overflow-x: hidden !important;
        position: relative;
        margin: 0;
        padding: 0;
    }

    .section-header,
    .card,
    .container,
    .footer {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .main-content {
        padding: 1rem 0;
        overflow-x: hidden;
        width: 100%;
    }

    /* Grid Sistemini Tek Kolona Düşür */
    .grid-2,
    .grid-3,
    .grid-4,
    .filter-grid-3 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

/* ========== İZOLE EDİLMİŞ MOBİL NAVBAR (Header) - indexhtmlmobile.css'den alındı ========== */
@media (max-width: 1024px) {

    /* 1. Base/Layout CSS etkilerini sıfırla */
    .header {
        position: sticky !important;
        top: 0 !important;
        z-index: 1001 !important;
        /* Menüden düşük, içerikten yüksek */
        background-color: var(--card-bg) !important;
        /* Kart rengi */
        height: 60px !important;
        /* Yükseklik sabit */
        width: 100% !important;
        border-bottom: 1px solid var(--border-color) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
        padding: 0 !important;
        /* İç boşluğu container halledecek */
        margin: 0 !important;
    }

    /* 2. İçeriği Ortala ve Hizala */
    .header .header-content {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        max-width: 100% !important;
        /* Container sınırlamasını kaldır */
        height: 100% !important;
        padding: 0 1rem !important;
        /* Sağdan soldan boşluk */
        margin: 0 auto !important;
        /* Ortala */
    }

    /* 3. Logo Ayarları (Tamamen İzole) */
    .header .logo {
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
    }

    .header .logo a {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        text-decoration: none !important;
    }

    .header .logo-img {
        height: 32px !important;
        width: auto !important;
        flex-shrink: 0 !important;
        object-fit: contain !important;
        display: block !important;
    }

    .header .logo-text {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    .header .logo-text span:first-child {
        font-size: 1.1rem !important;
        font-weight: 700 !important;
        color: var(--text-primary) !important;
        line-height: 1 !important;
    }

    .header .logo-text span:last-child {
        display: none !important;
        /* Küçük sloganı mobilde gizle */
    }

    /* 4. Desktop Nav'ı Kesinlikle Gizle */
    .desktop-nav {
        display: none !important;
    }

    /* 5. Sağ Taraf (Menü Butonu ve Kullanıcı İkonları) */
    .header .user-actions {
        display: flex !important;
        align-items: center !important;
        gap: 0.75rem !important;
        margin-left: auto !important;
        /* Logodan uzağa it */
    }

    /* Theme Toggle vb. diğer butonlar için */
    .navbar-theme-section button,
    .navbar-auth-section button,
    .navbar-user-section button {
        /* Gerekirse buraya özel stil ekle, şu an base.css butonu fena değil */
    }

    /* Hamburger Menu Button - Tamamen Özel Stil */
    .mobile-menu-btn {
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        width: 24px !important;
        height: 16px !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: 2002 !important;
        /* Menünün üstünde kalsın */
    }

    .mobile-menu-btn span {
        width: 100% !important;
        height: 1.7px !important;
        /* İncelttim (3px -> 1.5px) */
        background-color: var(--text-primary) !important;
        border-radius: 2px !important;
        transition: all 0.3s ease-in-out !important;
        display: block !important;
        transform-origin: left center !important;
    }

    /* Animasyonlu Durum */
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) !important;
        top: 0px !important;
    }

    .mobile-menu-btn.active span:nth-child(2) {
        width: 0% !important;
        opacity: 0 !important;
    }

    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) !important;
        top: 21px !important;
        /* Tahmini */
    }

    /* ========== AÇILIR MOBİL MENÜ (PORTFOLIO STYLE - ABSOLUTE & HIGH Z-INDEX) ========== */
    .mobile-nav {
        display: block !important;
        /* Kullanıcı isteği üzerine ABSOLUTE (index.html'deki son hali) */
        position: absolute !important;
        top: 60px !important;
        /* Header yüksekliği kadar */
        left: 0 !important;
        width: 100% !important;
        height: auto !important;
        max-height: 0 !important;
        overflow: hidden !important;

        /* Arka Plan Rengi (Base CSS'i ez) */
        background-color: #ffffff !important;

        /* Başlangıçta border yok (animasyon zıplamasını engellemek için) */
        border-bottom: 0px solid transparent !important;
        box-shadow: none !important;

        transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out, visibility 0.3s, border-bottom 0.3s, box-shadow 0.3s !important;

        /* Z-Index: En yüksek (Export vb. butonları ezmek için) */
        z-index: 2147483647 !important;

        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    [data-theme="dark"] .mobile-nav {
        background-color: #1e272e !important;
    }

    .mobile-nav.active {
        max-height: 85vh !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        overflow-y: auto !important;

        /* Aktif olunca border ve shadow gelir */
        border-bottom: 1px solid var(--border-color) !important;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
    }

    .mobile-nav-list {
        padding: 1rem 0 !important;
        margin: 0 !important;
        list-style: none !important;
        background: transparent !important;
    }

    .mobile-nav-item {
        border-bottom: 1px solid var(--border-color) !important;
        margin: 0 !important;
    }

    .mobile-nav-link {
        display: flex !important;
        align-items: center !important;
        padding: 1rem 1.5rem !important;
        color: var(--text-primary) !important;
        font-weight: 500 !important;
        font-size: 1rem !important;
        text-decoration: none !important;
        background: transparent !important;
    }

    .mobile-nav-link:active {
        background-color: var(--bg-hover) !important;
    }

    .mobile-nav-link i {
        width: 24px !important;
        margin-right: 12px !important;
        text-align: center !important;
        color: var(--primary-color) !important;
        display: inline-block !important;
    }

    /* Pro Butonu */
    .mobile-nav .pro-nav-link {

        width: auto !important;
        margin: 1rem 1.5rem !important;
        align-items: center !important;
        justify-content: center !important;
        color: #1e272e !important;
        /* Koyu yazı */
        background: linear-gradient(135deg, #93c572, #7cb342) !important;
        /* Yeşil gradient */
        border-radius: 9999px !important;
        padding: 0.6rem 1.5rem !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
        font-weight: 600 !important;
        text-decoration: none !important;
    }

    .mobile-nav .pro-nav-link i {
        color: inherit !important;
    }
}

/* ========== Small Screen Fixes (Galaxy SE, S8+, etc.) ========== */
@media (max-width: 375px) {

    .header .header-content {
        padding: 0 0.5rem !important;
    }

    .header .logo-text span:first-child {
        font-size: 1rem !important;
    }

    .header .user-actions {
        gap: 0.5rem !important;
    }
}

/* ========== Compare Page Specific Mobile Styles ========== */
@media (max-width: 768px) {

    /* Buton Grubu - Üstteki Sil/Kaydet butonları */
    .section-actions.flex {
        flex-direction: row !important;
        /* Yan yana kalsın ama sığmazsa ? */
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        gap: 0.5rem !important;
    }

    .section-actions button {
        flex: 1 1 auto !important;
        font-size: 0.8rem !important;
        padding: 0.5rem !important;
        white-space: nowrap !important;
    }

    /* Filtre Alanı - Mobilde Tek Kolon */
    .filter-grid-3 {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .filter-grid-3 .form-group {
        width: 100% !important;
    }

    /* Buton Ezme (Export/Clear butonunun menü üstüne çıkmasını engelle) */
    .btn-outline,
    .btn-primary {
        z-index: 1 !important;
        /* Menüden düşük olsun */
        position: relative;
    }

    /* Tablo ve Liste Alanları */
    .table-container {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Seçili Fonlar Listesi (Pilller / Kartlar) */
    #selectedFundsList {
        flex-direction: row !important;
        /* Yan yana aksın */
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }

    /* Seçili Fon Kartı (Dinamik oluşturulan element) */
    #selectedFundsList .card {
        width: 48% !important;
        /* İkili sığsın */
        flex: 1 1 45% !important;
        padding: 0 !important;
        /* Kartın kendi paddingini sıfırla */
        min-height: auto !important;
    }

    #selectedFundsList .card .card-header {
        padding: 0.5rem !important;
        min-height: auto !important;
    }

    #selectedFundsList .card .card-body {
        padding: 0.5rem !important;
    }

    #selectedFundsList .card h4 {
        font-size: 0.9rem !important;
        margin-bottom: 0 !important;
    }

    #selectedFundsList .card .fund-code {
        font-size: 0.85rem !important;
    }

    #selectedFundsList .card .btn-sm {
        padding: 0.2rem 0.4rem !important;
        font-size: 0.7rem !important;
        width: auto !important;
        height: auto !important;
    }

    /* İçerik metinlerini küçült */
    #selectedFundsList .card .text-muted {
        font-size: 0.65rem !important;
        margin-bottom: 0 !important;
    }

    #selectedFundsList .card .font-semibold {
        font-size: 0.8rem !important;
    }

    /* Genel Başlıklar ve Form Etiketleri (Küçültme) */
    .page-title {
        font-size: 1.25rem !important;
        /* H1 küçült */
    }

    .card-title,
    .section-header h3 {
        font-size: 1rem !important;
    }

    .form-label {
        font-size: 0.85rem !important;
    }
}

/* Email Truncation Fix */
@media (max-width: 1024px) {
    .email-domain {
        display: none !important;
    }

    #userEmail {
        min-width: 0 !important;
        display: inline-block !important;
        max-width: 100px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        vertical-align: bottom !important;
    }
}