/* ===========================================
   Mada Platform - Grade Subjects Page
   Hero, Breadcrumb, Subjects Grid, Subject Cards
   =========================================== */

/* ===========================================
   PAGE LAYOUT
   =========================================== */
.subjects-page {
    min-height: 100vh;
    background: var(--bg-light);
    /* main already offsets fixed header via --header-offset */
    padding-top: 0;
}

/* ===========================================
   SUBJECTS HERO SECTION
   =========================================== */
.subjects-hero {
    padding: 60px 20px 60px;
    text-align: center;
    position: relative;
    background: var(--dark-gradient);
    margin-bottom: 20px;
    color: #ffffff;
    overflow: hidden;
    box-shadow: 0 22px 50px rgba(2, 6, 23, 0.35);
}

.subjects-hero .bubbles-container {
    opacity: 0.8;
}

.subjects-hero .bubble {
    position: absolute;
    bottom: -120px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.06));
    border: 1px solid rgba(255,255,255,0.18);
    backdrop-filter: blur(6px);
    animation: subjectsFloatUp 16s infinite ease-in-out;
}

.subjects-hero .bubble:nth-child(1) { left: 10%; width: 80px; height: 80px; animation-delay: 0s; animation-duration: 18s; }
.subjects-hero .bubble:nth-child(2) { left: 20%; width: 40px; height: 40px; animation-delay: 2s; animation-duration: 15s; }
.subjects-hero .bubble:nth-child(3) { left: 35%; width: 100px; height: 100px; animation-delay: 4s; animation-duration: 20s; }
.subjects-hero .bubble:nth-child(4) { left: 50%; width: 60px; height: 60px; animation-delay: 1s; animation-duration: 16s; }
.subjects-hero .bubble:nth-child(5) { left: 65%; width: 90px; height: 90px; animation-delay: 3s; animation-duration: 17s; }
.subjects-hero .bubble:nth-child(6) { left: 80%; width: 50px; height: 50px; animation-delay: 5s; animation-duration: 14s; }

@keyframes subjectsFloatUp {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.75; }
    90% { opacity: 0.75; }
    100% { transform: translateY(-120vh) rotate(720deg); opacity: 0; }
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    font-size: 1rem;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: rgba(255, 255, 255, 0.75);
}

.breadcrumb a:hover {
    color: #ffffff;
}

.breadcrumb span {
    color: var(--secondary-color);
}

.breadcrumb .separator {
    color: rgba(255, 255, 255, 0.4);
}

/* Grade Title & Subtitle */
.grade-title {
    font-size: 2.2rem;
    color: #ffffff;
    margin-bottom: 10px;
    font-weight: 800;
    text-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.grade-icon-shell {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    margin-inline-end: 10px;
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.grade-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.78);
}

/* ===========================================
   SUBJECTS CONTAINER
   =========================================== */
.subjects-container {
    padding: 32px 20px 88px;
    background: linear-gradient(180deg, transparent 0%, var(--bg-light) 14%);
    margin-top: 0;
}

/* ===========================================
   SUBJECTS GRID
   =========================================== */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 40px;
    padding: 30px 0;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===========================================
   SUBJECT CARD - GLASSMORPHISM
   =========================================== */
.subject-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border-radius: var(--border-radius);
    padding: 30px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.1);
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--subject-color, var(--primary-gradient));
}

.subject-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.15);
}

.subject-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--subject-color, #2f5bff) 0%, transparent 100%);
    opacity: 0.9;
}

.subject-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.subject-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.subject-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ===========================================
   GRADE SUBJECT CARD - PREMIUM DESIGN
   =========================================== */
.grade-subject-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border-radius: 20px;
    padding: 25px 15px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
    height: 100%;
}

.grade-subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.05), transparent);
}

.grade-subject-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.14);
}

.subject-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    z-index: 2;
}

.subject-icon-wrapper {
    width: 100%;
    min-height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.grade-subject-card:hover .subject-icon-wrapper {
    transform: none;
}

.subject-icon-large {
    font-size: 2.5rem;
    line-height: 1;
}

.mini-book {
    --mini-book-width: 132px;
    --mini-book-height: 182px;
    position: relative;
    width: var(--mini-book-width);
    height: var(--mini-book-height);
    transform-style: preserve-3d;
    transition: transform 0.38s ease;
}

.mini-book-pages {
    position: absolute;
    top: 8px;
    left: -10px;
    width: 12px;
    height: calc(100% - 12px);
    border-radius: 6px 0 0 6px;
    background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 100%);
    box-shadow: inset -1px 0 0 rgba(15, 23, 42, 0.15);
}

.mini-book-spine {
    position: absolute;
    top: 8px;
    right: -10px;
    width: 12px;
    height: calc(100% - 12px);
    border-radius: 0 7px 7px 0;
    background: linear-gradient(180deg, color-mix(in srgb, var(--book-spine) 78%, #fff 22%), var(--book-spine));
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.2);
}

.mini-book-cover {
    position: absolute;
    inset: 0;
    border-radius: 14px 8px 8px 14px;
    border: 2px solid color-mix(in srgb, var(--book-cover) 78%, #fff 22%);
    background: linear-gradient(165deg, var(--book-cover) 0%, color-mix(in srgb, var(--book-cover) 70%, #000 30%) 100%);
    padding: 8px;
    display: grid;
    grid-template-rows: auto auto auto 1fr auto auto;
    gap: 6px;
    align-items: center;
    justify-items: center;
    box-shadow: 0 14px 22px rgba(15, 23, 42, 0.24);
    transform-origin: right center;
    transition: transform 0.36s ease, box-shadow 0.36s ease;
}

.mini-book-brand {
    width: 62px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.95;
}

.mini-book-brand-text {
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.4px;
    color: color-mix(in srgb, #ffffff 82%, var(--book-accent) 18%);
    text-shadow: 0 1px 0 rgba(15, 23, 42, 0.28), 0 3px 10px rgba(15, 23, 42, 0.2);
}

.mini-book-title {
    width: 100%;
    min-height: 2.5em;
    padding: 6px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.97);
    color: #0f172a;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.mini-book-symbol {
    width: 100%;
    height: 62px;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 2rem;
    text-shadow: 0 8px 16px rgba(15, 23, 42, 0.35);
}

.mini-book-symbol-image {
    width: 56%;
    height: 56%;
    object-fit: contain;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.28));
}

.mini-book-term {
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.94);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.mini-book-year {
    width: 74%;
    text-align: center;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 800;
    border-top: 2px solid rgba(255, 255, 255, 0.7);
    padding-top: 3px;
    letter-spacing: 0.3px;
}

.card-variant-icon .subject-icon-wrapper {
    min-height: 190px;
}

.subject-icon-alt {
    --book-cover: #2563eb;
    --book-accent: #0ea5e9;
    width: 140px;
    min-height: 182px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: linear-gradient(170deg, color-mix(in srgb, var(--book-cover) 82%, #fff 18%) 0%, color-mix(in srgb, var(--book-cover) 65%, #000 35%) 100%);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.25);
    padding: 12px 10px;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 8px;
}

.subject-icon-alt-inner {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--book-accent) 24%, #fff 76%);
    border: 2px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #ffffff;
}

.subject-icon-alt-image {
    width: 62%;
    height: 62%;
    object-fit: contain;
}

.subject-icon-alt-term {
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
}

.subject-icon-alt-year {
    width: 68%;
    text-align: center;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 800;
    border-top: 2px solid rgba(255, 255, 255, 0.75);
    padding-top: 2px;
}

.grade-subject-card:hover .mini-book {
    transform: perspective(900px) rotateY(-8deg) translateY(-3px);
}

.grade-subject-card:hover .mini-book-cover {
    box-shadow: 0 20px 30px rgba(15, 23, 42, 0.28);
}

.card-variant-icon:hover .subject-icon-alt {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 20px 32px rgba(15, 23, 42, 0.28);
}

.interactive-book-card.is-book-opening .mini-book-cover {
    transform: perspective(800px) rotateY(-36deg);
}

.interactive-book-card.is-book-closing .mini-book-cover {
    transform: perspective(800px) rotateY(0deg);
}

.subject-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
    transition: color 0.3s ease;
}

.subject-decoration {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.7;
    margin-top: auto;
}

.decoration-line {
    width: 50px;
    height: 5px;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.grade-subject-card:hover .decoration-line {
    width: 70px;
}

.decoration-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ===========================================
   RESPONSIVE - SUBJECTS PAGE
   =========================================== */
@media (max-width: 768px) {
    .subjects-hero {
        padding: 42px 14px 36px;
        margin-bottom: 12px;
    }

    .subjects-container {
        padding: 14px 14px 54px;
        margin-top: 0;
    }

    .subjects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding: 10px 0;
    }

    .subject-icon-wrapper {
        min-height: 178px;
    }

    .mini-book {
        --mini-book-width: 122px;
        --mini-book-height: 170px;
    }

    .subject-icon-alt {
        width: 126px;
        min-height: 168px;
    }

    .mini-book-title {
        font-size: 0.84rem;
    }
    
    .grade-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .subjects-hero {
        padding: 36px 12px 30px;
    }

    .subjects-container {
        padding: 10px 10px 44px;
    }

    .subjects-grid {
        grid-template-columns: 1fr;
    }
    
    .grade-title {
        font-size: 2rem;
    }
}

.grade-icon-image {
    width: var(--icon-size, 60%);
    height: var(--icon-size, 60%);
    object-fit: contain;
}

.grade-icon-emoji {
    font-size: 1.8rem;
    line-height: 1;
}

.subject-icon-image {
    width: var(--icon-size, 60%);
    height: var(--icon-size, 60%);
    object-fit: contain;
}

