/* /assets/css/module-grid.css (V33.0 - SIDEBAR GHOST FIX) */

/* --- 1. ANA IZGARA (MAIN GRID) --- */
.module-grid-wrapper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}
@media (max-width: 1024px) { .module-grid-wrapper { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .module-grid-wrapper { grid-template-columns: 1fr; } }

/* --- 2. WIDGET KUTUSU (STANDART) --- */
.module-widget-wrapper {
    background: var(--surface-color);
    border-radius: var(--radius-main);
    /* Ana ekrandaki 3D gölge efekti */
    box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
    height: 360px; 
    display: flex;
    flex-direction: column;
    padding: 25px !important;
    position: relative;
    z-index: 1;
    border: 1px solid transparent;
    overflow: hidden; 
    transition: transform 0.3s;
}

/* Ana ekrandaki kartlar için hover efekti */
.module-widget-wrapper:hover {
    transform: translateY(-5px);
    border-color: var(--circuit-color);
}

/* --- 3. BAŞLIK ALANI --- */
.module-grid-wrapper .widget-title,
.module-header {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    color: var(--text-main);
    text-align: left;
    padding-left: 5px;
    padding-bottom: 15px;
    margin-bottom: 10px;
    border-bottom: 2px solid var(--bg-color);
    flex-shrink: 0; 
    position: relative;
    z-index: 20; /* İçerikten üstte olsun */
    background: var(--surface-color); 
}
.module-grid-wrapper .widget-title i, 
.module-header i { 
    margin-right: 10px; 
    color: var(--circuit-color); 
}

/* --- 4. İÇERİK ALANI & ANİMASYON --- */
.module-widget {
    flex-grow: 1; 
    position: relative;
    overflow: hidden; /* Kesinlikle taşmasın */
    padding: 0 5px;
    min-height: 0; 
    z-index: 10;
}

/* SCROLLER KAPSAYICI */
.widget-scroller-wrapper {
    height: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
    /* Maskeleme: Üst ve alttan silikleşme (Yumuşak Geçiş) */
    mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
    z-index: 5;
}

/* HAREKET EDEN PARÇA */
.widget-scroller {
    /* PHP veriyi 2 katına çıkardığı için -50% tam bir turdur */
    animation: scrollLoop 60s linear infinite; 
    will-change: transform; 
}

.module-widget-wrapper:hover .widget-scroller,
.module-widget:hover .widget-scroller {
    animation-play-state: paused;
}

@keyframes scrollLoop {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); } 
}

/* ===================================================================
   5. SIDEBAR (YAN MENÜ) ÖZEL - HAYALET AVCI MODU
   =================================================================== */

/* Sidebar Kapsayıcı: Tamamen izole ediyoruz */
.sidebar .module-widget-wrapper {
    height: 400px !important; 
    overflow: hidden !important; /* Taşmaları kes */
    margin-bottom: 30px;
    
    /* Temiz, tek katman zemin */
    background: var(--surface-color) !important;
    /* Hafif gölge, çift katman yok */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important; 
    
    padding: 0 !important; 
    border: 1px solid rgba(0,0,0,0.05) !important;
    border-radius: 12px !important; /* Standart köşe */
    
    /* Pseudo-elementlerin oluşmasını engelle */
    transform-style: flat !important; 
}

/* Sidebar Başlık: Yapışık ve temiz */
.sidebar .widget-title,
.sidebar .module-header {
    margin: 0 !important;
    padding: 15px 20px !important;
    background: var(--bg-color); /* Hafif farklı ton */
    border-bottom: 1px solid var(--circuit-color);
    z-index: 50 !important; /* En üstte */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Başlık altına hafif gölge */
}

/* Sidebar İçerik Alanı */
.sidebar .module-widget {
    padding: 10px 20px !important;
    background: var(--surface-color) !important;
    height: 100% !important;
}

/* HAYALETLERİ YOK ET (KIRMIZI ÇİZGİ SORUNU) */
/* ::before ve ::after elementlerini zorla kapatıyoruz */
.sidebar .module-widget-wrapper::before, 
.sidebar .module-widget-wrapper::after,
.sidebar .module-widget::before,
.sidebar .module-widget::after { 
    content: none !important;
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    border: none !important;
    box-shadow: none !important;
}

/* Sidebar Animasyon Hızı */
.sidebar .widget-scroller {
    animation-duration: 80s;
}
/* ===================================================================
   SMART CONTRAST PATCH (AKILLI KONTRAST YAMASI) - V16.0
   Amaç: Gündüz modunda;
   1. Beyaz zemin üzerindeki yazıları LACİVERT yap.
   2. Koyu zemin (Banner, Buton) üzerindeki yazıları BEYAZ koru.
   =================================================================== */

/* --- GRUP 1: BEYAZ KORUMA TİMİ (Bunlar KESİN BEYAZ kalmalı) --- */
/* Gündüz modunda olsa bile arka planı koyu olan alanlar */

body:not(.theme-dark) .welcome-banner h1,
body:not(.theme-dark) .welcome-banner p,
body:not(.theme-dark) .welcome-banner strong,
body:not(.theme-dark) .btn-primary,
body:not(.theme-dark) .caption-btn,
body:not(.theme-dark) .news-label,
body:not(.theme-dark) .badge-count,
body:not(.theme-dark) .media-text,
body:not(.theme-dark) .mini-thumb {
    color: #ffffff !important;
    text-shadow: none !important;
}

/* --- GRUP 2: LACİVERT TİMİ (Bunlar KESİN LACİVERT olmalı) --- */
/* Arka planı beyaz olan kartların başlıkları */

body:not(.theme-dark) .live-card h3,
body:not(.theme-dark) .live-card h4,
body:not(.theme-dark) .module-widget-wrapper .widget-title,
body:not(.theme-dark) .sidebar .widget-title,
body:not(.theme-dark) .content-title,
body:not(.theme-dark) .card-title,
body:not(.theme-dark) .article-title-stacked,
body:not(.theme-dark) .tender-title-stacked,
body:not(.theme-dark) .panel-username {
    color: #000080 !important; /* Lacivert */
    text-shadow: none !important; /* Gündüz neon parlamasını kapat */
}

/* --- GRUP 3: OKUNABİLİRLİK TİMİ (Açıklama Metinleri) --- */
/* Beyaz zeminde kaybolan gri/beyaz detay yazıları */

body:not(.theme-dark) .live-card p,
body:not(.theme-dark) .article-content,
body:not(.theme-dark) .article-content p,
body:not(.theme-dark) .article-meta-stacked,
body:not(.theme-dark) .tender-meta-grid,
body:not(.theme-dark) .widget-item span,
body:not(.theme-dark) .menu-link {
    color: #445566 !important; /* Koyu Gri (Okunur) */
}

/* Hover durumunda İkon ve Linkler (Canlılık kalsın) */
body:not(.theme-dark) a:hover,
body:not(.theme-dark) .widget-item:hover span,
body:not(.theme-dark) .menu-link:hover {
    color: var(--circuit-color) !important; /* Mavi */
}

/* --- GRUP 4: WIDGET İÇİ DÜZELTMELER --- */
/* Widget scroller içindeki linkler beyaz kalmış olabilir */
body:not(.theme-dark) .widget-scroller .widget-item {
    color: #445566 !important;
}
body:not(.theme-dark) .widget-scroller .widget-item i {
    color: var(--circuit-color) !important; /* İkonlar mavi kalsın */
}
/* ===================================================================
   WIDGET HEIGHT LIMITER (SAYFA UZAMA KORUMASI)
   Tüm widget kutularını standart bir yüksekliğe sabitler.
   =================================================================== */

/* 1. Sidebar ve Grid İçindeki Widgetlar İçin Yükseklik Sınırı */
.module-widget-wrapper,
.sidebar .module-widget-wrapper,
.live-card {
    /* 5-6 Öğe sığacak standart yükseklik */
    height: 380px !important; 
    max-height: 380px !important;
    min-height: 380px !important;
    
    /* İçerik taşarsa gizle (Animasyon içeride döner) */
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}

/* 2. İçerik Alanının Esnekliği */
.module-widget,
.card-content-layer {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* 3. Scroller Yüksekliği */
.widget-scroller-wrapper {
    height: 100% !important;
    position: relative;
}

/* 4. Kullanıcı Kartı (User Widget) İstisnası */
/* Sağ paneldeki kullanıcı kartı bozulmasın diye serbest bırakıyoruz */
.user-widget {
    height: auto !important;
    max-height: none !important;
    min-height: auto !important;
}

/* 5. İhale Listesi (List View) İçin Sınır */
/* Ana sayfadaki uzun listeleri de kontrol altına alıyoruz */
.tender-list-view-enhanced {
    max-height: 800px; /* Çok uzarsa scroll çıksın */
    overflow-y: auto;
    padding-right: 5px; /* Scroll çubuğu için boşluk */
}
/* Scroll çubuğunu güzelleştir */
.tender-list-view-enhanced::-webkit-scrollbar { width: 5px; }
.tender-list-view-enhanced::-webkit-scrollbar-thumb { background: var(--circuit-color); border-radius: 10px; }