/* --- GENEL KONTEYNER --- */
.bagis-main-container {
    display: flex;
    gap: 25px;
    max-width: 1300px;
    margin: 30px auto 100px auto;
    padding: 0 15px;
    align-items: flex-start;
}

/* --- GRID VE KART YAPISI --- */
.bagis-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.bagis-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    height: 100%; /* Kartları eşit boy yapar */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.bagis-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.bagis-card-img {
    height: 290px;
    width: 100%;
}

.bagis-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* KART İÇERİĞİ */
.bagis-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1; /* İçeriğin kartı doldurmasını sağlar */
}

.bagis-card-body h3 {
    font-size: 18px;
    margin: 0 0 10px 0;
    color: #333;
    min-height: 45px; /* Başlıkları hizalar */
}

.bagis-card-price {
    font-weight: 700;
    font-size: 19px;
    color: rgb(8, 8, 97);
    margin-bottom: 20px;
}

/* --- BUTONLARIN OLDUĞU ALT KISIM --- */
.bagis-card-footer {
    margin-top: auto; /* Yazı kısa olsa da butonları en alta iter */
}

.qty-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.qty-wrapper input {
    width: 55px;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 5px;
    text-align: center;
}

/* BUTONLARIN YAN YANA DURMASI */
.bagis-action-buttons {
    display: flex !important;
    flex-direction: row !important; /* Her zaman yan yana */
    gap: 10px !important;
    width: 100% !important;
}

.bagis-action-buttons button {
    flex: 1 !important; /* Buton genişliklerini eşitler */
    padding: 12px 2px !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: 0.3s !important;
}

/* Turuncu: Enerjik ve dikkat çekici (Sepete Ekle için) */
.btn-sepete { 
    background: #f39c12; /* Modern bir hardal-turuncu */
    color: #fff; 
    transition: background 0.3s ease;
}

.btn-sepete:hover {
    background: #e67e22; /* Hover olduğunda bir tık daha koyu turuncu */
}

/* Yeşil: Güven veren ve tamamlayıcı (Hemen Bağışla için) */
.btn-hemen { 
    background: #27ae60; /* Canlı ama göz yormayan bir yeşil */
    color: #fff; 
    transition: background 0.3s ease;
}

.btn-hemen:hover {
    background: #219150; /* Hover olduğunda bir tık daha koyu yeşil */
}

/* --- SEPET SİDEBAR --- */
/* --- SAĞ SEPET SIDEBAR DÜZENLEME --- */
.bagis-sidebar-sepet {
    flex-shrink: 0;
    width: 320px;
}

.sepet-box {
    background: #fff;
    border: 1px solid #eee;
    padding: 20px;
    border-radius: 12px;
    box-sizing: border-box; /* Kutunun içindeki her şeyi sınırda tutar */
}

/* Tablonun taşmasını engelle */
.sepet-table-wrapper {
    width: 100%;
    overflow-x: hidden;
    margin-bottom: 15px;
}

.sepet-tablosu {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.sepet-tablosu th, .sepet-tablosu td {
    padding: 10px 5px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.btn-cikar {
    background-color: #ff4d4d;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
}

.btn-cikar:hover {
    background-color: #e60000;
}

/* Ödemeye Geç Butonu - Taşma Engelli */
.btn-odeme-link {
    display: block !important;
    width: 100% !important; /* Kutuya tam sığar */
    box-sizing: border-box !important; /* Padding'i genişliğe dahil eder, taşırmaz */
    padding: 15px !important;
    background: rgb(8, 8, 97) !important;
    color: #fff !important;
    text-align: center !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    margin-top: 15px !important;
    transition: 0.3s !important;
}

.btn-odeme-link:hover {
    background: rgb(35, 35, 143) !important;
    box-shadow: 0 4px 10px rgba(8, 8, 97, 0.2);
}

/* --- RESPONSIVE AYARLARI --- */
@media (max-width: 1024px) {
    .bagis-main-container { flex-direction: column; }
    .bagis-sidebar-sepet { width: 100%; position: static; }
}

@media (max-width: 480px) {
    .bagis-grid { grid-template-columns: 1fr; }
    
    .bagis-action-buttons {
        gap: 5px !important; /* Mobilde butonlar biraz yaklaşsın */
    }
    
    .bagis-action-buttons button {
        font-size: 11px !important; /* Mobilde yazılar sığsın */
    }
}

/* --- BAĞIŞ FİLTRE BUTONLARI --- */
.bagis-filtre {
    padding: 25px 0;
    background: #fdfdfd;
    border-bottom: 1px solid #eee;
}

.bagis-filtre .container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.bagis-filtre button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #ffffff;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bagis-filtre button i {
    font-size: 16px;
    color: rgb(8, 8, 97); /* İkonlar vakıf laciverti */
}

.bagis-filtre button:hover {
    border-color: rgb(35, 35, 143);
    color: rgb(35, 35, 143);
    background: #f8f8ff;
}

.bagis-filtre button.active {
    background: rgb(8, 8, 97);
    border-color: rgb(8, 8, 97);
    color: #fff;
}

.bagis-filtre button.active i {
    color: #fff; /* Aktifken ikon beyaz olsun */
}

/* Mobilde butonlar çok yer kaplarsa */
@media (max-width: 480px) {
    .bagis-filtre button {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* --- Genel Sayfa Yapısı --- */
.bagis-main-container {
    display: flex;
    gap: 20px;
    padding: 20px;
}

.bagis-grid {
    flex: 3;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.bagis-sidebar-sepet {
    flex: 1;
    min-width: 300px;
}

/* --- Modal Temel Yapısı --- */
.modal {
    display: none; 
    position: fixed;
    z-index: 9999; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    overflow-y: auto;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 25px;
    border-radius: 12px;
    width: 95%;
    max-width: 650px;
    position: relative;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #333;
}

#sepet-liste {
    margin: 20px 0;
    max-height: 50vh;
    overflow-y: auto;
}

/* --- Jilet Gibi Hizalama: Sepet Satırı --- */
.sepet-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    gap: 10px;
    width: 100%;
}

/* Ürün Adı */
.sepet-item-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
}

.sepet-item-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin: 0;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* --- Adet Kontrolleri (Tam Hizalı) --- */
.sepet-item-controls {
    display: inline-flex;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    height: 36px;
    flex-shrink: 0;
}

.qty-btn {
    background: #081085;
    color: white !important;
    border: none;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    transition: background 0.2s;
    flex-shrink: 0;
}

.qty-btn:first-child { border-radius: 4px 0 0 4px; }
.qty-btn:last-child { border-radius: 0 4px 4px 0; }
.qty-btn:hover { background: #1a1a9e; }

.qty-input {
    width: 45px;
    height: 36px;
    text-align: center;
    /* Butonlarla aynı renk yapıyoruz */
    background-color: #081085; 
    /* Yazıyı beyaz yapıyoruz ki okunsun */
    color: white !important;
    border: 1px solid #081085;
    border-left: none;
    border-right: none;
    font-size: 14px;
    font-weight: bold;
    margin: 0;
    padding: 1px;
    box-sizing: border-box;
    display: inline-block;
    flex-shrink: 0;
    /* Bazı tarayıcılarda varsayılan gölgeyi kaldırmak için */
    outline: none;
}

/* Sayı oklarını tamamen gizlemek için (daha temiz durur) */
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input[type=number] {
    -moz-appearance: textfield;
}

/* Fiyat Alanı */
.sepet-item-total {
    font-weight: 800;
    color: #28a745;
    font-size: 15px;
    white-space: nowrap;
    min-width: 80px;
    text-align: right;
    flex-shrink: 0;
}

/* Çıkar Butonu */
.btn-cikar-modal {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0 12px;
    height: 36px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
    flex-shrink: 0;
}

.btn-cikar-modal:hover {
    background: #c82333;
}

/* Modal Footer */
.modal-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #f8f9fa;
}

.modal-toplam-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#modal-toplam {
    font-size: 1.4rem;
    font-weight: 800;
    color: #081085;
}

.modal-sepet-btn {
    width: 100%;
    background: #081085;
    color: white;
    padding: 16px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.modal-sepet-btn:hover { background: #1a1a9e; }

/* --- Mobil Responsive --- */
@media (max-width: 600px) {
    .modal-content { padding: 15px 10px; }
    
    .sepet-item { 
        gap: 8px;
        flex-wrap: wrap;
    }

    .sepet-item-info {
        gap: 10px;
    }

    .sepet-item-name { font-size: 12px; }

    .sepet-item-controls {
        height: 32px;
    }

    .qty-btn { 
        width: 32px; 
        height: 32px; 
        font-size: 16px;
    }
    
    .qty-input { 
        width: 40px; 
        height: 32px; 
        font-size: 13px;
    }
    
    .sepet-item-total { 
        font-size: 13px; 
        min-width: 70px; 
    }
    
    .btn-cikar-modal { 
        padding: 0 10px; 
        height: 32px; 
        font-size: 11px; 
    }
}


/* Modal içindeki kontrol grubu kapsayıcısı */
#sepet-modal .sepet-item-controls {
    display: inline-flex;
    align-items: center;
    background-color: #081085; /* Kanka burası buton ve inputun ortak arka planı */
    border-radius: 50px; /* Hap şeklinde modern bir görünüm */
    padding: 3px 8px;
    gap: 0; /* Boşlukları kapattık ki bütün dursun */
}

/* Butonların temizlenmesi */
#sepet-modal .qty-btn {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: #081085;
    font-weight: bold;
    font-size: 18px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sayı giriş alanının temizlenmesi */
#sepet-modal .qty-input {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    width: 40px;
    text-align: center;
    font-weight: 800;
    color: #333;
    font-size: 15px;
    -moz-appearance: textfield; /* Firefox oklarını kaldırır */
}

/* Chrome/Safari oklarını kaldırma */
#sepet-modal .qty-input::-webkit-outer-spin-button,
#sepet-modal .qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Hover efekti (sadece butonlara) */
#sepet-modal .qty-btn:hover {
    color: #ff0000; /* Artı eksiye gelince renk değişsin istersen */
    transform: scale(1.1);
}

/* --- MOBİLDE RESİM BOYUTUNU BÜYÜTME --- */
@media (max-width: 480px) {
    .bagis-card-img {
        height: 350px !important; /* Masaüstünde 290px olan yüksekliği mobilde 350px'e çıkardık */
    }

    .bagis-card-img img {
        /* Resmin bozulmaması için object-fit zaten cover'da, 
           böylece görüntü sünmez, alanı doldurur. */
        object-position: center; 
    }
}