/* main.css — Materials Page */

/* =========================================
   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.03;
    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: rgba(33, 40, 66, 0.04);
    color: var(--brand-primary);
    padding: 8px 20px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    margin-bottom: 20px;
    border: 1px solid rgba(33, 40, 66, 0.08);
}

.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: linear-gradient(135deg, var(--brand-primary) 0%, #4a5568 60%, var(--brand-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mat-subtitle {
    font-size: 1.05rem;
    color: rgba(33, 40, 66, 0.55);
    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: 28px;
    border: 1.5px solid rgba(33, 40, 66, 0.07);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(33, 40, 66, 0.06);
    text-decoration: none;
    overflow: hidden;
    transition: transform 0.32s ease, box-shadow 0.32s ease, border-color 0.32s ease;
}

.subj-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 52px rgba(33, 40, 66, 0.13);
}

/* Coloured glow blob in corner */
.subj-card-bg {
    position: absolute;
    top: -60px;
    right: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    opacity: 0.07;
    transition: opacity 0.32s ease, transform 0.32s ease;
    pointer-events: none;
}

.subj-card:hover .subj-card-bg {
    opacity: 0.13;
    transform: scale(1.12);
}

/* Icon badge */
.subj-card-icon {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 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: rgba(33, 40, 66, 0.55);
    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: rgba(33, 40, 66, 0.5);
    background: rgba(33, 40, 66, 0.05);
    padding: 5px 11px;
    border-radius: 100px;
}

/* 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: rgba(33, 40, 66, 0.06);
    color: rgba(33, 40, 66, 0.4);
    transition: all 0.28s ease;
}

.subj-card:hover .subj-card-arrow {
    color: #fff;
    transform: translate(2px, -2px);
}

/* Per-subject colours */
.subj-math {
    border-color: rgba(99, 102, 241, 0.15);
}

.subj-cs {
    border-color: rgba(16, 185, 129, 0.15);
}

.subj-physics {
    border-color: rgba(245, 158, 11, 0.15);
}

.subj-chem {
    border-color: rgba(239, 68, 68, 0.15);
}

.subj-bio {
    border-color: rgba(20, 184, 166, 0.15);
}

.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;
}

.subj-cs:hover .subj-card-arrow {
    background: #10b981;
}

.subj-physics:hover .subj-card-arrow {
    background: #f59e0b;
}

.subj-chem:hover .subj-card-arrow {
    background: #ef4444;
}

.subj-bio:hover .subj-card-arrow {
    background: #14b8a6;
}



/* =========================================
   DETAIL PAGE — BACK LINK
   ========================================= */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(33, 40, 66, 0.5);
    text-decoration: none;
    margin-bottom: 40px;
    transition: color 0.2s ease;
}

.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: 100px;
    border: 1.5px solid rgba(33, 40, 66, 0.1);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(33, 40, 66, 0.6);
    cursor: pointer;
    transition: all 0.25s ease;
}

.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: 0 4px 16px rgba(33, 40, 66, 0.2);
}

.mat-search {
    position: relative;
    flex-shrink: 0;
}

.mat-search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(33, 40, 66, 0.38);
    font-size: 0.9rem;
    pointer-events: none;
}

.mat-search input {
    width: 260px;
    padding: 11px 20px 11px 42px;
    border-radius: 100px;
    border: 1.5px solid rgba(33, 40, 66, 0.1);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--brand-primary);
    outline: none;
    transition: all 0.25s ease;
}

.mat-search input::placeholder {
    color: rgba(33, 40, 66, 0.38);
}

.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: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 22px;
    border: 1.5px solid rgba(33, 40, 66, 0.07);
    overflow: hidden;
    box-shadow: 0 2px 14px rgba(33, 40, 66, 0.06);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.mat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 40px rgba(33, 40, 66, 0.12);
}

.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.04));
}

.mat-cs {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.04));
}

.mat-physics {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.04));
}

.mat-chem {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.04));
}

.mat-bio {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.08), rgba(20, 184, 166, 0.04));
}

.mat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.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: 100px;
    background: rgba(33, 40, 66, 0.07);
    color: rgba(33, 40, 66, 0.6);
}

.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: rgba(33, 40, 66, 0.58);
    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: rgba(33, 40, 66, 0.45);
}

.mat-card-footer {
    padding: 14px 22px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid rgba(33, 40, 66, 0.06);
}

.mat-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 100px;
    background: var(--brand-primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(33, 40, 66, 0.18);
}

.mat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(33, 40, 66, 0.25);
}

.mat-btn-ghost {
    display: inline-flex;
    align-items: center;
    padding: 9px 18px;
    border-radius: 100px;
    border: 1.5px solid rgba(33, 40, 66, 0.12);
    color: rgba(33, 40, 66, 0.6);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s ease;
}

.mat-btn-ghost:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.mat-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: rgba(33, 40, 66, 0.35);
}

.mat-no-results i {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
}

.mat-no-results p {
    font-size: 1rem;
    font-weight: 500;
}

/* =========================================
   SCROLL REVEAL
   ========================================= */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   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;
    }
}

/* =========================================
   ADMIN UPLOAD BUTTON (materials index)
   ========================================= */
.mat-admin-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    padding: 13px 28px;
    background: linear-gradient(135deg, #212842, #2f3d60);
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 100px;
    text-decoration: none;
    box-shadow: 0 6px 22px rgba(33, 40, 66, 0.25);
    transition: all 0.25s ease;
}

.mat-admin-upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 32px rgba(33, 40, 66, 0.35);
}

.mat-admin-upload-btn i {
    font-size: 1rem;
}

/* =========================================
   EMPTY STATE (no DB materials yet)
   ========================================= */
.mat-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: rgba(33, 40, 66, 0.35);
}

.mat-empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
}

.mat-empty-state p {
    font-size: 1rem;
    font-weight: 500;
}