/* ==========================================================================
   MATERIALS — PAGE-SPECIFIC STYLES
   Shared base/reveal: /assets/css/base.css
   Shared navbar/footer/mobile shell: /assets/css/nav-footer.css
   ========================================================================== */

/* =========================================
   WRAPPER & BACKGROUND DECORATION
   ========================================= */
.mat-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 140px 24px 100px;
    position: relative;
    z-index: 1;
}

.mat-wrapper::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 600px;
    background-image:
        radial-gradient(var(--brand-primary) 0.5px, transparent 0.5px),
        radial-gradient(var(--brand-primary) 0.5px, transparent 0.5px);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
    opacity: 0.05;
    z-index: -1;
    mask-image: linear-gradient(to bottom, black, transparent);
    -webkit-mask-image: linear-gradient(to bottom, black, transparent);
}

/* =========================================
   PAGE INTRO
   ========================================= */
.page-intro {
    text-align: center;
    margin-bottom: 60px;
}

.innovative-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-glass);
    color: var(--brand-primary);
    padding: 8px 20px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    margin-bottom: 20px;
    border: 1px solid var(--glass-border);
}

.innovative-title {
    font-size: clamp(2.8rem, 6vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.1;
    margin-bottom: 20px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mat-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 480px;
    margin: 0 auto;
}

/* =========================================
   SUBJECT CARDS GRID (index page)
   ========================================= */
.subject-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.subj-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 36px 32px 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    overflow: hidden;
    transition: all var(--transition-base);
}

.subj-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: rgba(33, 40, 66, 0.2);
}

/* Coloured glow blob in corner */
.subj-card-bg {
    position: absolute;
    top: -60px;
    right: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    opacity: 0.05;
    transition: all var(--transition-base);
    pointer-events: none;
}

.subj-card:hover .subj-card-bg {
    opacity: 0.1;
    transform: scale(1.12);
}

/* Icon badge */
.subj-card-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(33, 40, 66, 0.08);
}

/* Text content */
.subj-card-content h2 {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--brand-primary);
    letter-spacing: -0.5px;
    margin-bottom: 10px;
}

.subj-card-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 18px;
}

.subj-card-stats {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.subj-card-stats span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-glass);
    padding: 5px 11px;
    border-radius: var(--radius-full);
}

/* Arrow in bottom-right corner */
.subj-card-arrow {
    position: absolute;
    bottom: 28px;
    right: 28px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    background: var(--bg-glass);
    color: var(--text-muted);
    transition: all var(--transition-base);
}

.subj-card:hover .subj-card-arrow {
    color: #fff;
    transform: translate(2px, -2px);
}

/* Per-subject colours (Uyumlulaştırıldı) */
.subj-math .subj-card-bg { background: #6366f1; }
.subj-cs .subj-card-bg { background: #10b981; }
.subj-physics .subj-card-bg { background: #f59e0b; }
.subj-chem .subj-card-bg { background: #ef4444; }
.subj-bio .subj-card-bg { background: #14b8a6; }

.subj-math .subj-card-icon { color: #6366f1; }
.subj-cs .subj-card-icon { color: #10b981; }
.subj-physics .subj-card-icon { color: #f59e0b; }
.subj-chem .subj-card-icon { color: #ef4444; }
.subj-bio .subj-card-icon { color: #14b8a6; }

.subj-math:hover .subj-card-arrow { background: #6366f1; box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3); }
.subj-cs:hover .subj-card-arrow { background: #10b981; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }
.subj-physics:hover .subj-card-arrow { background: #f59e0b; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }
.subj-chem:hover .subj-card-arrow { background: #ef4444; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }
.subj-bio:hover .subj-card-arrow { background: #14b8a6; box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3); }

/* =========================================
   DETAIL PAGE — BACK LINK
   ========================================= */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 40px;
    transition: color var(--transition-fast);
}

.back-link:hover {
    color: var(--brand-primary);
}

/* =========================================
   DETAIL PAGE — FILTER ROW
   ========================================= */
.mat-filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 36px;
    flex-wrap: wrap;
}

.mat-filter-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mat-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    border: 1px solid var(--glass-border);
    background: #ffffff;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
}

.mat-tab:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.mat-tab.active {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-sm);
}

.mat-search {
    position: relative;
    flex-shrink: 0;
}

.mat-search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.mat-search input {
    width: 260px;
    padding: 11px 20px 11px 42px;
    border-radius: var(--radius-full);
    border: 1px solid var(--glass-border);
    background: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--brand-primary);
    outline: none;
    transition: all var(--transition-base);
}

.mat-search input::placeholder {
    color: var(--text-muted);
}

.mat-search input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(33, 40, 66, 0.07);
}

/* =========================================
   DETAIL PAGE — MATERIALS CARD GRID
   ========================================= */
.mat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: start;
}

.mat-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
}

.mat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(33, 40, 66, 0.2);
}

.mat-card.hidden {
    display: none;
}

.mat-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
}

.mat-math { background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(99, 102, 241, 0.02)); }
.mat-cs { background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.02)); }
.mat-physics { background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.02)); }
.mat-chem { background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.02)); }
.mat-bio { background: linear-gradient(135deg, rgba(20, 184, 166, 0.08), rgba(20, 184, 166, 0.02)); }

.mat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.mat-math .mat-card-icon { color: #6366f1; }
.mat-cs .mat-card-icon { color: #10b981; }
.mat-physics .mat-card-icon { color: #f59e0b; }
.mat-chem .mat-card-icon { color: #ef4444; }
.mat-bio .mat-card-icon { color: #14b8a6; }

.mat-type-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    color: var(--text-secondary);
}

.mat-card-body {
    padding: 20px 22px;
    flex: 1;
}

.mat-card-body h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand-primary);
    line-height: 1.4;
    margin-bottom: 10px;
}

.mat-card-body p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 16px;
}

.mat-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.mat-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
}

.mat-card-footer {
    padding: 14px 22px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--glass-border);
}

.mat-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.mat-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--brand-light);
}

.mat-btn-ghost {
    display: inline-flex;
    align-items: center;
    padding: 9px 18px;
    border-radius: var(--radius-full);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-base);
}

.mat-btn-ghost:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: rgba(33, 40, 66, 0.05);
}

/* =========================================
   SCROLL REVEAL
   ========================================= */


/* =========================================
   ADMIN UPLOAD BUTTON (materials index)
   ========================================= */
.mat-admin-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    padding: 13px 28px;
    background: var(--gradient-primary);
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.mat-admin-upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.mat-admin-upload-btn i {
    font-size: 1rem;
}

/* =========================================
   EMPTY STATE (no DB materials yet)
   ========================================= */
.mat-empty-state, .mat-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.mat-empty-state i, .mat-no-results i {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
}

.mat-empty-state p, .mat-no-results p {
    font-size: 1rem;
    font-weight: 500;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 1100px) {
    .subject-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .subject-cards-grid .subj-card:last-child:nth-child(3n + 2) {
        grid-column: span 1;
    }

    .mat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .mat-wrapper {
        padding: 130px 16px 70px;
    }

    .subject-cards-grid {
        grid-template-columns: 1fr;
    }

    .mat-filter-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .mat-search input {
        width: 100%;
    }

    .mat-grid {
        grid-template-columns: 1fr;
    }

    .innovative-title {
        font-size: 2.6rem;
    }
}

/* =========================================
   PREMIUM E-LEARNING MATERYAL KARTLARI
   ========================================= */

/* Kartların Grid Düzeni */
.mat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

/* Ana Kart Çerçevesi */
.mat-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 25px rgba(33, 40, 66, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.mat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(33, 40, 66, 0.1);
}

/* --- 1. KART BANNER (ÜST KOYU KISIM) --- */
.mat-card-banner {
    position: relative;
    height: 180px;
    /* Hafif Izgara (Grid) Deseni */
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Varsayılan Arkaplan Rengi (Aşama belirtilmemişse) */
    background-color: #1e2235; 
}

/* Sağ Üst Köşedeki Aşama Rozeti (Transparan Cam Efekti) */
.mat-banner-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
    letter-spacing: 0.5px;
}

/* Ortadaki Büyük İkon Yuvarlağı (İçi Boş, İnce Çerçeveli) */
.mat-banner-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: transparent; /* Arkaplan Yok */
    border: 1px solid rgba(255, 255, 255, 0.15); /* İnce dış çizgi */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.03); /* Etrafındaki hafif silik halka */
    transition: all 0.3s ease;
}

/* İkonun İçindeki Simge */
.mat-banner-icon i {
    color: #ffffff; /* Varsayılan İkon Rengi */
    transition: all 0.3s ease;
}

/* Hover Animasyonu */
.mat-card:hover .mat-banner-icon {
    transform: scale(1.05);
    box-shadow: 0 0 0 12px rgba(255, 255, 255, 0.05);
}

/* Banner Altındaki Alt İstatistikler (Sınıf, Dil, Aşama) */
.mat-banner-stats {
    position: absolute;
    bottom: 16px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.mat-banner-stats span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mat-banner-stats span i {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Her istatistik arasına nokta (•) koyar */
.mat-banner-stats span:not(:last-child)::after {
    content: "•";
    margin-left: 12px;
    opacity: 0.4;
}


/* --- 2. KART GÖVDESİ (BEYAZ KISIM) --- */
.mat-card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
}

.mat-card-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
    line-height: 1.3;
}

.mat-card-desc {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; /* Çok uzunsa 2 satırda kes */
    overflow: hidden;
}

/* İndirme Barı (Progress Area) */
.mat-progress-area {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
}

.mat-progress-bar {
    flex-grow: 1;
    height: 6px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
}

.mat-progress-fill {
    height: 100%;
    width: 100%; /* Her zaman tam dolu */
    border-radius: 10px;
    background: #3b82f6; /* Varsayılan Bar Rengi */
}

.mat-downloads {
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    white-space: nowrap;
}


/* --- 3. KART FOOTER (BUTON KISMI) --- */
.mat-card-footer {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end; /* Butonu sağa hizalar */
    background: #ffffff;
}

.mat-btn, .mat-btn-locked {
    background: #2a3353; /* Resimdeki koyu lacivert buton rengi */
    color: #ffffff;
    padding: 10px 24px;
    border-radius: 100px; /* Hap (Yuvarlak) şeklinde buton */
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.mat-btn:hover {
    background: #1e2235;
    transform: translateY(-2px);
}

/* Giriş yapmayanlar için Kilitli Buton Stili */
.mat-btn-locked {
    background: #f1f5f9;
    color: #64748b;
}


/* =========================================
   4. AŞAMALARA GÖRE DİNAMİK RENKLER 
   (Banner Arkaplanı, İkon Rengi, Bar Rengi)
   ========================================= */

/* RAYON AŞAMASI (Koyu Yeşil) */
.stage-rayon .mat-card-banner { background-color: #0f3f35; }
.stage-rayon .mat-banner-icon i { color: #6ee7b7; }
.stage-rayon .mat-progress-fill { background: #10b981; }

/* YARI FİNAL AŞAMASI (Koyu Lacivert) */
.stage-yfinal .mat-card-banner { background-color: #1a1f35; }
.stage-yfinal .mat-banner-icon i { color: #ffffff; }
.stage-yfinal .mat-progress-fill { background: #3b82f6; }

/* FİNAL AŞAMASI (Koyu Bordo/Kırmızı) */
.stage-final .mat-card-banner { background-color: #3f1115; }
.stage-final .mat-banner-icon i { color: #fca5a5; }
.stage-final .mat-progress-fill { background: #ef4444; }


/* ==========================================================================
   MATERIALS MOBILE V2 — PAGE CONTENT
   Shared mobile navigation is intentionally NOT defined in this file.
   ========================================================================== */


@media (max-width: 768px) {

    :root {
        --mat-mobile-pad: 12px;
        --mat-mobile-surface: rgba(255, 255, 255, .95);
        --mat-mobile-border: rgba(33, 40, 66, .08);
        --mat-mobile-shadow: 0 8px 24px rgba(33, 40, 66, .075);
    }

    html {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        scroll-padding-top: 76px;
    }

    body {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden !important;
        padding-bottom: calc(78px + env(safe-area-inset-bottom));
        background:
            radial-gradient(circle at 100% 0%, rgba(89, 103, 232, .07), transparent 26%),
            linear-gradient(180deg, #f8f9fc 0%, #f1f3f8 56%, #eceff5 100%);
    }

    

    /* ------------------------------------------------------------------
       SAME MOBILE TOP BAR AS HOMEPAGE
       ------------------------------------------------------------------ */

    

    

    

    

    

    

    

    /* ------------------------------------------------------------------
       SAME MOBILE BOTTOM NAV AS HOMEPAGE
       ------------------------------------------------------------------ */

    

    

    

    

    /* ------------------------------------------------------------------
       MOBILE PROFILE BOTTOM SHEET
       ------------------------------------------------------------------ */

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    /* ------------------------------------------------------------------
       MATERIALS INDEX WRAPPER / INTRO
       ------------------------------------------------------------------ */

    .mat-wrapper {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding:
            calc(82px + env(safe-area-inset-top))
            var(--mat-mobile-pad)
            28px;
        overflow: hidden;
    }

    .mat-wrapper::before {
        height: 420px;
        background-size: 20px 20px;
        opacity: .035;
    }

    .page-intro {
        width: 100%;
        margin-bottom: 20px;
        text-align: left;
    }

    .innovative-tag {
        margin-bottom: 8px;
        padding: 5px 9px;
        border-radius: 9px;
        font-size: .50rem;
        letter-spacing: 1.1px;
    }

    .innovative-title {
        margin-bottom: 8px;
        font-size: clamp(2rem, 10vw, 2.8rem);
        line-height: .98;
        letter-spacing: -1.35px;
    }

    .mat-subtitle {
        max-width: 100%;
        margin: 0;
        font-size: .73rem;
        line-height: 1.52;
    }

    #admin-action-container {
        width: 100%;
    }

    .mat-admin-upload-btn {
        width: 100%;
        min-height: 42px;
        margin-top: 12px;
        padding: 9px 12px;
        justify-content: center;
        border-radius: 11px;
        font-size: .68rem;
    }

    /* ------------------------------------------------------------------
       SUBJECT CATEGORIES — compact mobile cards
       ------------------------------------------------------------------ */

    .subject-cards-grid {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .subj-card {
        min-width: 0;
        min-height: 146px;
        padding: 11px;
        gap: 7px;
        border-radius: 14px;
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr);
        grid-template-rows: auto 1fr auto;
        grid-template-areas:
            "icon content"
            "icon content"
            "stats stats";
        align-items: start;
        box-shadow: 0 5px 16px rgba(33, 40, 66, .055);
    }

    .subj-card:hover {
        transform: none;
        box-shadow: 0 5px 16px rgba(33, 40, 66, .055);
    }

    .subj-card-bg {
        top: -35px;
        right: -35px;
        width: 100px;
        height: 100px;
        opacity: .06;
    }

    .subj-card-icon {
        grid-area: icon;
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: .88rem;
        box-shadow: 0 3px 10px rgba(33, 40, 66, .07);
    }

    .subj-card-content {
        grid-area: content;
        min-width: 0;
    }

    .subj-card-content h2 {
        margin-bottom: 4px;
        font-size: .72rem;
        line-height: 1.18;
        letter-spacing: -.15px;
    }

    .subj-card-content p {
        margin-bottom: 7px;
        font-size: .56rem;
        line-height: 1.38;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .subj-card-stats {
        grid-area: stats;
        gap: 4px;
        align-self: end;
    }

    .subj-card-stats span {
        min-height: 23px;
        padding: 4px 7px;
        gap: 4px;
        border-radius: 7px;
        font-size: .50rem;
    }

    .subj-card-arrow {
        position: absolute;
        right: 8px;
        bottom: 8px;
        width: 27px;
        height: 27px;
        border-radius: 8px;
        font-size: .56rem;
        opacity: .72;
    }

    /* ------------------------------------------------------------------
       DETAIL PAGE — BACK LINK / FILTERS / SEARCH
       These styles also help category subpages using the same CSS.
       ------------------------------------------------------------------ */

    .back-link {
        min-height: 36px;
        margin-bottom: 14px;
        padding: 7px 10px;
        gap: 6px;
        border: 1px solid var(--mat-mobile-border);
        border-radius: 10px;
        background: #fff;
        font-size: .64rem;
    }

    .mat-filter-row {
        width: 100%;
        margin-bottom: 15px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .mat-filter-tabs {
        width: 100%;
        padding-bottom: 2px;
        display: flex;
        flex-wrap: nowrap;
        gap: 5px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .mat-filter-tabs::-webkit-scrollbar {
        display: none;
    }

    .mat-tab {
        flex: 0 0 auto;
        min-height: 34px;
        padding: 7px 10px;
        gap: 5px;
        border-radius: 10px;
        font-size: .61rem;
    }

    .mat-search {
        width: 100%;
    }

    .mat-search i {
        left: 12px;
        font-size: .72rem;
    }

    .mat-search input {
        width: 100%;
        min-height: 40px;
        padding: 8px 12px 8px 34px;
        border-radius: 11px;
        font-size: .70rem;
    }

    /* ------------------------------------------------------------------
       MATERIAL DETAIL CARDS
       ------------------------------------------------------------------ */

    .mat-grid {
        width: 100%;
        padding: 0;
        display: grid;
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .mat-card {
        width: 100%;
        min-width: 0;
        border-radius: 14px;
        box-shadow: 0 5px 16px rgba(33, 40, 66, .055);
    }

    .mat-card:hover {
        transform: none;
        box-shadow: 0 5px 16px rgba(33, 40, 66, .055);
    }

    .mat-card-banner {
        height: 128px;
        background-size: 17px 17px;
    }

    .mat-banner-badge {
        top: 9px;
        right: 9px;
        padding: 4px 8px;
        gap: 4px;
        font-size: .52rem;
    }

    .mat-banner-icon {
        width: 49px;
        height: 49px;
        font-size: 1.15rem;
        box-shadow: 0 0 0 6px rgba(255, 255, 255, .03);
    }

    .mat-card:hover .mat-banner-icon {
        transform: none;
    }

    .mat-banner-stats {
        bottom: 9px;
        gap: 6px;
        padding-inline: 9px;
        flex-wrap: wrap;
        font-size: .54rem;
    }

    .mat-banner-stats span {
        gap: 3px;
    }

    .mat-banner-stats span:not(:last-child)::after {
        margin-left: 6px;
    }

    .mat-card-body {
        padding: 12px;
        gap: 6px;
    }

    .mat-card-title,
    .mat-card-body h3 {
        margin: 0;
        font-size: .80rem;
        line-height: 1.3;
    }

    .mat-card-desc,
    .mat-card-body p {
        margin: 0;
        font-size: .63rem;
        line-height: 1.45;
    }

    .mat-progress-area {
        margin-top: 7px;
        gap: 8px;
    }

    .mat-progress-bar {
        height: 4px;
    }

    .mat-downloads {
        font-size: .55rem;
    }

    .mat-meta {
        gap: 7px;
    }

    .mat-meta span {
        font-size: .55rem;
    }

    .mat-card-footer {
        padding: 9px 11px 11px;
        gap: 6px;
        justify-content: stretch;
    }

    .mat-card-footer .mat-btn,
    .mat-card-footer .mat-btn-locked,
    .mat-card-footer .mat-btn-ghost {
        min-height: 36px;
        padding: 7px 10px;
        justify-content: center;
        flex: 1;
        border-radius: 9px;
        font-size: .61rem;
    }

    .mat-empty-state,
    .mat-no-results {
        padding: 36px 12px;
    }

    .mat-empty-state i,
    .mat-no-results i {
        margin-bottom: 8px;
        font-size: 1.7rem;
    }

    .mat-empty-state p,
    .mat-no-results p {
        font-size: .70rem;
    }

    /* ------------------------------------------------------------------
       FOOTER
       ------------------------------------------------------------------ */

    

    

    
}


@media (max-width: 420px) {

    :root {
        --mat-mobile-pad: 9px;
    }

    

    .innovative-title {
        font-size: clamp(1.85rem, 10vw, 2.45rem);
    }

    .subject-cards-grid {
        grid-template-columns: 1fr;
    }

    .subj-card {
        min-height: 96px;
        grid-template-columns: 42px minmax(0, 1fr) 28px;
        grid-template-rows: auto auto;
        grid-template-areas:
            "icon content arrow"
            "icon stats arrow";
        align-items: center;
    }

    .subj-card-icon {
        width: 42px;
        height: 42px;
    }

    .subj-card-content p {
        -webkit-line-clamp: 1;
        margin-bottom: 4px;
    }

    .subj-card-arrow {
        grid-area: arrow;
        position: static;
        align-self: center;
    }
}
