/* Market Genel Kutusu */
.market-box {
    border: 2px solid #cc0000;
    padding: 20px;
    background: rgba(10, 10, 10, 0.95);
    border-radius: 10px;
}

/* Üst Başlık ve EP Alanı */
.market-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #ffcc00;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.ep-display {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ep-amount-badge {
    display: flex;
    align-items: center;
    background: #1a1a1a;
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid #444;
    color: #ffcc00;
    font-weight: bold;
    gap: 8px;
}

.ep-amount-badge img { width: 18px; height: 18px; }

.ep-plus-btn {
    background: #cc0000;
    color: #fff;
    width: 22px;
    height: 22px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 16px;
    margin-left: 5px;
    transition: 0.3s;
}

.ep-plus-btn:hover { background: #ff0000; transform: scale(1.1); }

/* Sekme Menüsü */
.market-tabs-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-link {
    flex: 1;
    padding: 12px;
    background: #252525;
    border: 1px solid #444;
    color: #bbb;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    border-radius: 5px;
}

.tab-link:hover { background: #333; color: #fff; }

.tab-link.active {
    background: #cc0000;
    color: #fff;
    border-color: #ff4444;
    box-shadow: 0 0 10px rgba(204, 0, 0, 0.4);
}

/* --- Kaydırma Alanı ve Scrollbar Ayarları --- */
#market-container {
    height: 600px;           /* Sayfanın çok uzamaması için sabit yükseklik */
    overflow-y: auto;        /* Dikey kaydırma aktif */
    overflow-x: hidden;      /* Yatay kaydırma kapalı */
    padding-right: 10px;     /* Scrollbar'ın ürünlere yapışmaması için */
    scrollbar-width: thin;    /* Firefox için ince bar */
    scrollbar-color: #cc0000 #1a1a1a; /* Firefox için renkler */
}

/* Chrome, Edge ve Safari için özel Scrollbar tasarımı */
#market-container::-webkit-scrollbar {
    width: 8px;
}

#market-container::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 10px;
}

#market-container::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #cc0000, #880000);
    border-radius: 10px;
    border: 1px solid #333;
}

#market-container::-webkit-scrollbar-thumb:hover {
    background: #ff0000;
}

/* Ürün Grid Yapısı */
.market-tab {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding-bottom: 20px;
}

/* Ürün Kartı */
.market-item {
    position: relative;
    background: rgba(30, 30, 30, 0.7);
    border: 1px solid #333;
    padding: 15px;
    text-align: center;
    border-radius: 8px;
    transition: all 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    min-height: 320px; /* Kartların boyunu eşitler */
}

/* KARTIN ÜZERİNE GELİNDİĞİNDE */
.market-item:hover {
    z-index: 10;
    transform: translateY(-5px);
    background: rgba(45, 45, 45, 1); /* Daha belirgin arka plan */
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    border-color: #ffcc00;
}

.market-item:hover p {
    /* Tüm metni göster */
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
    color: #fff;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 4px;
    margin-top: 5px;
}

.item-icon-box {
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    border: 1px solid #222;
}

/* Büyük item ikonları */
.market-item .item-icon-box img { 
    width: 64px !important; 
    height: 64px !important; 
    object-fit: contain; 
}

.market-item h4 { color: #ffcc00; margin: 10px 0 5px 0; font-size: 1.1em; }

.market-item p {
    color: #bbb;
    font-size: 0.85em;
    margin-bottom: 10px;
    line-height: 1.4;
    
    /* Kısıtlama: Normalde 2 satır göster ve kes */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
}

/* --- EP İkon Küçültme (Fiyat Yanındaki) --- */
.market-item .price {
    font-size: 1.1em;
    color: #ffcc00;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.market-item .price img {
    width: 16px !important;  /* Küçük ikon boyutu */
    height: 16px !important; 
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    vertical-align: middle;
}

.add-cart-btn {
    background: #008000;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.add-cart-btn:hover { background: #00a000; }

/* Bildirimler */
.notification {
    position: fixed;
    top: 25px;
    right: 25px;
    padding: 15px 25px;
    border-radius: 5px;
    color: #fff;
    z-index: 1000;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    display: none;
    animation: slideIn 0.3s ease-out;
}

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

.notif-success { background: #28a745; border-left: 5px solid #155724; }
.notif-error { background: #dc3545; border-left: 5px solid #721c24; }

/* Alt Kısım */
.market-footer {
    margin-top: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #333;
}

.footer-note { font-size: 0.85em; color: #666; font-style: italic; }

.cart-go-btn {
    background: #ff9800;
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 0 #bf360c;
}

.cart-go-btn:hover { background: #ffa726; transform: translateY(-1px); }

.no-item-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    color: #666;
    font-size: 1.2em;
}

/* Filtre Paneli Alanı */
.market-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #333;
}

/* Arama Kutusu */
.search-box {
    position: relative;
    flex: 2;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #cc0000;
}

.search-box input {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #444;
    padding: 10px 10px 10px 35px;
    color: #fff;
    border-radius: 5px;
    outline: none;
    transition: 0.3s;
}

.search-box input:focus {
    border-color: #cc0000;
    box-shadow: 0 0 5px rgba(204, 0, 0, 0.3);
}

/* Sıralama Kutusu */
.sort-box {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #aaa;
}

.sort-box select {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #444;
    color: #fff;
    padding: 9px;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

.sort-box select:focus {
    border-color: #ffcc00;
}

/* === GELİŞMİŞ MOBİL UYUMLULUK AYARLARI === */

@media (max-width: 768px) {
    /* 1. Header ve EP Alanı: Mobilde alt alta gelmeliler */
    .market-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .ep-display {
        flex-direction: column;
        width: 100%;
    }

    .user-info-text {
        font-size: 1.1rem;
    }

    /* 2. Sekme Menüsü: Mobilde yan yana sığmaz, kaydırılabilir yapıyoruz */
    .market-tabs-nav {
        overflow-x: auto;
        padding-bottom: 10px;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch; /* iOS için yumuşak kaydırma */
    }

    .tab-link {
        min-width: 100px; /* Butonların çok küçülmesini engeller */
        flex: 0 0 auto;
        padding: 10px 15px;
        font-size: 13px;
    }

    /* 3. Filtre Barı kısmını şu şekilde güncelle veya altına ekle */
    .search-box, .sort-box {
        width: 100%;
        display: flex; /* Elemanların iç içe geçmemesi için */
        box-sizing: border-box; /* Padding ve border'ı genişliğe dahil et */
    }

    .search-box input {
        width: 100%; /* İçindeki input'un da taşmasını engelle */
        box-sizing: border-box;
        max-width: 100%; /* Taşmaya karşı ekstra güvenlik */
    }

    .market-filter-bar {
        width: 100%;
        box-sizing: border-box;
        overflow: hidden; /* Her ihtimale karşı dışa taşanı gizle */
    }

    /* 4. Ürün Kartları: Mobilde yan yana 2 tane sığdırmak en iyisidir */
    .market-tab {
        grid-template-columns: repeat(2, 1fr) !important; /* Telefonlarda 2'li grid */
        gap: 10px; /* Boşluğu azaltıyoruz */
    }

    .market-item {
        min-height: auto; /* Mobilde sabit yükseklik sorun çıkarabilir */
        padding: 10px;
    }

    .market-item h4 {
        font-size: 0.9rem;
        height: 40px; /* İsimler 2 satırda eşitlensin */
        overflow: hidden;
    }

    .market-item p {
        display: none !important; /* Mobilde açıklamaları gizlemek alanı ferahlatır */
    }

    .market-item .item-icon-box img {
        width: 48px !important; /* İkonları biraz küçültelim */
        height: 48px !important;
    }

    /* 5. Alt Kısım: Buton tam genişlik */
    .market-footer {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .cart-go-btn {
        width: 100%;
    }

    /* 6. Bildirimler: Mobilde ekranın ortasına yakın veya tam üstte olmalı */
    .notification {
        left: 10px;
        right: 10px;
        top: 10px;
        text-align: center;
    }
}

/* Ekstra Küçük Ekranlar (Örn: iPhone 5/SE) */
@media (max-width: 380px) {
    .market-tab {
        grid-template-columns: 1fr !important; /* Çok küçük ekranda tekli sütun */
    }
}