/* =========================================================
   FİLTRE STİLLERİ - Bölüm Sayfaları için
   ========================================================= */

/* Filtre Ana Bölümü */
.filter-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.filter-header h3 {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.btn-reset {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-reset:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Filtre Grid */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
}

.filter-group {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.filter-group label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-group label i {
    font-size: 0.9rem;
}

/* Filtre Butonları */
.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 0.9rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.25s ease;
    font-weight: 500;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.filter-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* Renkli Butonlar */
.filter-btn.devlet.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #10b981;
}

.filter-btn.vakif.active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-color: #f59e0b;
}

.filter-btn.turkce.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-color: #ef4444;
}

.filter-btn.ingilizce.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: #3b82f6;
}

.filter-btn.burslu.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border-color: #8b5cf6;
}

.filter-btn.indirimli.active {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    color: white;
    border-color: #ec4899;
}

.filter-btn.ucretli.active {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    border-color: #6b7280;
}

/* Arama Kutusu */
.search-group {
    grid-column: 1 / -1;
}

.uni-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.uni-search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.uni-search-input:focus {
    outline: none;
    border-color: white;
    background: rgba(255, 255, 255, 0.25);
}

/* Filtre İstatistik */
.filter-stats {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.filter-stats span {
    font-weight: 700;
    font-size: 1.1rem;
}

/* =========================================================
   BÖLÜM HEADER GELİŞTİRİLMİŞ
   ========================================================= */

.bolum-header-enhanced {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    color: white;
}

.bolum-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.bolum-header-enhanced h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bolum-header-enhanced h1 i {
    color: #667eea;
}

.year-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.bolum-header-enhanced .bolum-description {
    color: rgba(255, 255, 255, 0.75);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* İstatistik Kartları */
.bolum-stats-enhanced {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s, background 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.12);
}

.stat-card i {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.stat-card.total i {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.stat-card.devlet i {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.stat-card.vakif i {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.stat-card.ing i {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.stat-card.burs i {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

/* =========================================================
   TABLO İÇİ BADGE'LER
   ========================================================= */

.uni-cell {
    min-width: 200px;
}

.uni-name {
    font-weight: 600;
    color: var(--text-dark, #1e293b);
    margin-bottom: 0.25rem;
}

.uni-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

.type-badge.devlet {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.type-badge.vakif {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.type-badge.kktc {
    background: rgba(99, 102, 241, 0.15);
    color: #4f46e5;
}

.lang-badge {
    font-size: 0.9rem;
}

.burs-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
}

.burs-badge.burslu {
    background: rgba(139, 92, 246, 0.15);
    color: #7c3aed;
}

.burs-badge.indirim {
    background: rgba(236, 72, 153, 0.15);
    color: #db2777;
}

.burs-badge.ucretli {
    background: rgba(107, 114, 128, 0.15);
    color: #4b5563;
}

.fakulte-cell {
    font-size: 0.85rem;
    color: var(--text-light, #6b7280);
}

.siralama {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
}

/* =========================================================
   MOBİL UYUMLULUK
   ========================================================= */

@media (max-width: 768px) {
    .filter-section {
        padding: 1rem;
        border-radius: 12px;
    }

    .filter-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .filter-btn {
        padding: 0.4rem 0.7rem;
        font-size: 0.75rem;
    }

    .bolum-header-enhanced {
        padding: 1.25rem;
        border-radius: 12px;
    }

    .bolum-header-enhanced h1 {
        font-size: 1.3rem;
    }

    .bolum-stats-enhanced {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .bolum-header-enhanced .bolum-description {
        color: #e2e8f0;
        font-size: 1.1rem;
        max-width: 800px;
        margin: 0 auto 30px auto;
        line-height: 1.6;
        opacity: 0.9;
    }

    .bolum-description-text {
        color: #e2e8f0;
        font-size: 1.05rem;
        max-width: 800px;
        margin: 15px auto 25px auto;
        line-height: 1.6;
        opacity: 0.95;
        background: rgba(255, 255, 255, 0.1);
        padding: 15px 20px;
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .bolum-description-text p {
        margin: 0;
    }

    .bolum-description-text strong {
        color: #fff;
        font-weight: 600;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-card i {
        font-size: 1.2rem;
        width: 32px;
        height: 32px;
    }

    .stat-value {
        font-size: 1rem;
    }

    .uni-badges {
        gap: 0.25rem;
    }

    .type-badge,
    .burs-badge {
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
    }
}

@media (max-width: 480px) {
    .bolum-stats-enhanced {
        grid-template-columns: 1fr;
    }

    .filter-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn-reset {
        width: 100%;
        justify-content: center;
    }
}

/* =========================================================
   MOBIL TABLO AYARLARI (ÖZEL)
   ========================================================= */

@media (max-width: 768px) {

    /* 
       MOBİL MÜKEMMELLEŞTİRME (V15 - SYNC WITH INDEX.HTML)
       - index.html'deki style.css Phase 14 kurallarıyla senkronize.
    */

    /* RESET & Sıkılaştırma */
    #mainTable {
        min-width: 0 !important;
        width: 100% !important;
        table-layout: auto !important;
        margin: 0 !important;
    }

    #mainTable th,
    #mainTable td {
        padding: 4px 2px !important;
        vertical-align: middle;
    }

    /* 1) Üniversite: Genişleyebilen Ana Kolon */
    .uni-cell {
        width: auto !important;
        min-width: unset !important;
        white-space: normal;
        padding-left: 2px !important;
        font-size: 0.8rem;
        line-height: 1.3;
    }

    .uni-name {
        font-size: 0.8rem;
        font-weight: 700;
        line-height: 1.2;
        word-wrap: break-word;
    }

    .uni-faculty {
        font-size: 0.65rem !important;
        color: #64748b;
        margin-top: 2px;
        line-height: 1.2;
        display: block !important;
    }

    /* Fakülte kolonu: Mobilde gizle (Üniversite altında zaten var) */
    .fakulte-cell,
    #mainTable td:nth-child(2),
    #mainTable th:nth-child(2) {
        display: none !important;
    }

    /* Bölüm kolonu: Mobilde gizle (sayfa zaten o bölüme ait) */
    .bolum-cell,
    .bolum-col,
    #mainTable td:nth-child(3),
    #mainTable th:nth-child(3) {
        display: none !important;
    }

    /* 2) Tür Kolonu: İÇERİĞE GÖRE KÜÇÜL */
    #mainTable .col-tur {
        width: 1px !important;
        /* Shrink to content hack */
        min-width: unset !important;
        max-width: unset !important;
        padding: 4px 2px !important;
        white-space: nowrap !important;
        vertical-align: middle;
    }

    /* Stacked Cell */
    .stacked-cell {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1px;
        width: auto;
    }

    .col-tur .badge,
    .stacked-cell .badge {
        font-size: 0.65rem !important;
        font-weight: 700;
        padding: 2px 4px !important;
        border-radius: 3px;
        text-align: center;
        line-height: 1;
    }

    .type-sub {
        font-size: 0.6rem;
        font-weight: 600;
        color: #475569;
        letter-spacing: -0.3px;
        line-height: 1;
    }

    .lang-sub {
        font-size: 0.55rem;
        color: #dc2626;
        font-weight: 700;
        letter-spacing: -0.3px;
        line-height: 1;
    }

    /* 3) Taban Puan */
    .col-puan {
        width: auto !important;
        min-width: unset !important;
        max-width: unset !important;
        white-space: nowrap !important;
        font-weight: 800;
        font-size: 0.85rem;
        color: #2563eb;
        text-align: right;
        padding-right: 4px !important;
        letter-spacing: -0.5px;
    }

    /* 4) Sıralama */
    .col-sira {
        width: auto !important;
        min-width: unset !important;
        max-width: unset !important;
        white-space: nowrap !important;
        font-size: 0.75rem;
        font-family: 'Roboto Mono', monospace;
        letter-spacing: -0.5px;
        text-align: center;
    }

    /* 5) Yıl Kolonu: GİZLE */
    .col-yil {
        display: none !important;
    }

    /* 6) Kontejan ve Yerleşen */
    .col-kont,
    .col-yer {
        width: auto !important;
        min-width: unset !important;
        white-space: nowrap !important;
        font-size: 0.7rem;
        text-align: center;
        color: #475569;
        padding: 4px 2px !important;
    }
}

/* =========================================================
   MOBİL OVERRIDE - Bölüm görünsün, Tür küçük kalsın
   (BUNU CSS'İN EN ALTINA EKLE)
   ========================================================= */
@media (max-width: 768px) {

    /* 1) Fakülte/Bölüm alanlarını GÖSTER (mevcut display:none'i ez) */
    .fakulte-cell,
    #mainTable td:nth-child(2),
    #mainTable th:nth-child(2),
    .bolum-cell,
    .bolum-col,
    #mainTable td:nth-child(3),
    #mainTable th:nth-child(3) {
        display: table-cell !important;
    }

    /* Fakülte/Bölüm metni mobilde düzgün sarsın (taşma olmasın) */
    .fakulte-cell,
    .bolum-cell,
    .bolum-col,
    #mainTable td:nth-child(2),
    #mainTable td:nth-child(3) {
        white-space: normal !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
        line-height: 1.15 !important;
        font-size: 0.70rem !important;
        /* mobilde yer kazandırır */
        color: #64748b !important;
        padding: 4px 2px !important;
        vertical-align: middle !important;
    }

    /* 2) TÜR kolonu: içerik kadar küçülsün */
    /* Senin yapında tür kolonu .col-tur ise bunu sıkılaştırıyoruz */
    #mainTable .col-tur,
    #mainTable th.col-tur,
    #mainTable td.col-tur {
        width: 1% !important;
        /* shrink */
        white-space: nowrap !important;
        /* sarma yok */
        padding: 4px 1px !important;
        text-align: center !important;
        vertical-align: middle !important;
    }

    /* Tür içindeki stacked görünüm daha kompakt */
    .stacked-cell {
        display: inline-flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 1px !important;
        width: auto !important;
        min-width: unset !important;
    }

    .col-tur .badge,
    .stacked-cell .badge {
        font-size: 0.62rem !important;
        font-weight: 800 !important;
        padding: 1px 4px !important;
        border-radius: 3px !important;
        line-height: 1 !important;
        display: inline-block !important;
    }

    .type-sub {
        font-size: 0.58rem !important;
        line-height: 1 !important;
        letter-spacing: -0.2px !important;
        white-space: nowrap !important;
    }

    .lang-sub {
        font-size: 0.54rem !important;
        line-height: 1 !important;
        letter-spacing: -0.2px !important;
        white-space: nowrap !important;
    }

    /* 3) Üniversite hücresi taşmayı düzgün yapsın */
    .uni-cell {
        white-space: normal !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
    }

    .uni-name {
        font-size: 0.78rem !important;
        line-height: 1.15 !important;
    }

    .uni-faculty {
        display: block !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        font-size: 0.62rem !important;
        line-height: 1.15 !important;
    }

    /* 4) Yıl kolonu gizli kalsın istiyorsan (sen zaten gizliyorsun) */
    .col-yil {
        display: none !important;
    }
}