* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-dark: #0D5C45;
    --primary-mid: #137A5C;
    --primary-light: #1A9C72;
    --primary-surface: #ECFDF5;
    --primary-border: #A7F3D0;
    --mint-accent: #7FFFD4;
    --bg-main: #F4F6F5;
    --surface: #FFFFFF;
    --surface-dim: #F8FAFC;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-hint: #94A3B8;
    --border-light: #E2E8F0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    scroll-behavior: smooth;
}



/* ===== PAGE SECTION ===== */
.page-header {
    background: linear-gradient(135deg, var(--primary-surface), var(--surface));
    padding: 3rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===== SEARCH & FILTER SECTION ===== */
.search-section {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.search-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(26, 156, 114, 0.1);
}

.filter-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-surface);
    color: var(--primary-dark);
    border: 2px solid var(--primary-border);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

/* ===== SUBJECTS GRID ===== */
.subjects-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.subject-card {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    animation: slideUp 0.6s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.subject-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 24px rgba(13, 92, 69, 0.15);
}

.subject-icon-section {
    height: 150px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-mid));
    display: flex;
    align-items: center;
    justify-content: center;
}

.subject-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.subject-content {
    padding: 1.5rem;
}

.subject-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.subject-level {
    display: inline-block;
    font-size: 0.75rem;
    background: var(--primary-surface);
    color: var(--primary-dark);
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-weight: 600;
    margin-bottom: 1rem;
}

.subject-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    min-height: 50px;
}

.tutor-mini {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-light);
}

.tutor-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-mid));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
}

.tutor-info {
    flex: 1;
}

.tutor-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tutor-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.read-more-btn {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.read-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 92, 69, 0.3);
}

/* ===== PREMIUM MODAL ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-sheet {
    background: var(--white);
    border-radius: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    /* Hide scrollbar for IE, Edge and Firefox */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.modal.active .modal-sheet {
    transform: scale(1) translateY(0);
}

/* Hide scrollbar for Chrome, Safari and Opera */
.modal-sheet::-webkit-scrollbar {
    display: none;
}

.modal-drag-handle {
    display: none;
    /* Only show on mobile bottom sheet */
    width: 100%;
    padding: 12px 0;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border-radius: 24px 24px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-drag-handle span {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 4px;
}

/* Hero Section */
.modal-hero {
    position: relative;
    padding: 4rem 3rem;
    min-height: 220px;
    display: flex;
    align-items: center;
    overflow: hidden;
    border-radius: 24px 24px 0 0;
    background: var(--green-900, #062917);
    color: var(--white, #ffffff);
}

.modal-hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, var(--green-800, #0D5C45), var(--green-900, #062917));
    opacity: 1;
    z-index: 1;
}

.modal-hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(var(--green-400, #34d399) 1.5px, transparent 1.5px);
    background-size: 24px 24px;
    opacity: 0.15;
}

.modal-hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.modal-hero-icon {
    width: 80px;
    height: 80px;
    background: var(--white);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    padding: 1rem;
}

.modal-hero-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modal-hero-info {
    flex: 1;
}

.modal-level-chip {
    display: inline-block;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.modal-subject-title {
    font-family: var(--font-display, 'Playfair Display', serif);
    font-size: 2.8rem;
    font-weight: 900;
    line-height: 1.1;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.modal-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 3;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Stats Strip */
.modal-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

.modal-stat {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1.5rem;
    border-right: 1px solid var(--border);
}

.modal-stat:last-child {
    border-right: none;
}

.modal-stat i {
    font-size: 1.2rem;
    color: var(--green-600);
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--slate);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink);
}

/* Body */
.modal-body {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.modal-block {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-block-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
}

.modal-block-label i {
    color: var(--green-600);
}

.modal-block-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--slate);
}

/* Tutor Card */
.modal-tutor-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.3s ease;
}

.modal-tutor-card:hover {
    border-color: var(--green-300);
    box-shadow: 0 4px 12px rgba(13, 92, 69, 0.05);
}

.modal-tutor-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green-500), var(--green-700));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 4px 10px rgba(13, 92, 69, 0.2);
}

.modal-tutor-name {
    font-weight: 700;
    color: var(--ink);
    font-size: 1.1rem;
}

.modal-tutor-role {
    font-size: 0.85rem;
    color: var(--green-700);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.quals-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.qual-item {
    font-size: 0.75rem;
    background: var(--white);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--slate);
}

/* Topics list (assuming JS will inject pills or list items) */
.modal-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.topic-pill {
    background: var(--green-50);
    color: var(--green-800);
    border: 1px solid var(--green-200);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* CTA */
.modal-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem;
    background: var(--ink);
    color: var(--white);
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.05rem;
    text-decoration: none;
    transition: all 0.3s;
    margin-top: 0.5rem;
}

.modal-cta-btn:hover {
    background: var(--green-700);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(13, 92, 69, 0.15);
}

.modal-cta-arrow {
    transition: transform 0.3s;
}

.modal-cta-btn:hover .modal-cta-arrow {
    transform: translateX(4px);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {

    .search-container {
        flex-direction: column;
    }

    .filter-group {
        justify-content: space-between;
    }

    .page-title {
        font-size: 1.8rem;
    }

    .subjects-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }

    .modal-content {
        width: 95%;
    }

    .modal-header {
        padding: 1.5rem;
    }

    .modal-header h2 {
        font-size: 1.5rem;
    }

    .highlights-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.5rem;
    }

    .subjects-grid {
        grid-template-columns: 1fr;
    }

    .search-input {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .filter-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .tutor-large-avatar {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }
}


@media (max-width: 600px) {
    .modal {
        align-items: flex-end;
    }

    .modal-sheet {
        width: 100%;
        max-width: 100%;
        border-radius: 32px 32px 0 0;
        max-height: 92vh;
        transform: translateY(100%);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .modal.active .modal-sheet {
        transform: translateY(0);
    }

    .modal-drag-handle {
        display: flex;
        padding: 12px 0 8px;
        background: var(--white);
        border-radius: 32px 32px 0 0;
    }

    .modal-hero {
        padding: 2rem 1.5rem;
        border-radius: 0;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        min-height: 180px;
        justify-content: center;
    }

    .modal-hero-content {
        flex-direction: column;
        align-items: center;
        gap: 1.25rem;
        width: 100%;
    }

    .modal-hero-info {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .modal-subject-title {
        font-size: 2.2rem;
        color: var(--white);
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .modal-level-chip {
        margin-bottom: 0;
        background: rgba(255, 255, 255, 0.25);
    }

    .modal-hero-icon {
        width: 72px;
        height: 72px;
        border-radius: 18px;
        margin-bottom: 0.5rem;
    }

    .modal-close-btn {
        top: 1rem;
        right: 1rem;
        background: rgba(0, 0, 0, 0.2);
        border: none;
    }

    .modal-stats {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem 1rem;
        padding: 1.5rem;
        border-bottom: 1px solid var(--border);
    }

    .modal-stat {
        padding: 0;
        border-right: none !important;
        gap: 0.8rem;
    }

    .modal-stat i {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--green-50);
        color: var(--green-700);
        border-radius: 12px;
        font-size: 1.2rem;
    }

    .modal-body {
        padding: 1.5rem;
        gap: 2rem;
    }

    .modal-tutor-card {
        flex-direction: column;
        text-align: center;
        gap: 1.25rem;
        padding: 1.5rem;
        background: var(--paper);
    }

    .modal-tutor-avatar {
        width: 80px;
        height: 80px;
        font-size: 2.2rem;
    }

    .quals-list {
        justify-content: center;
    }

    .modal-cta-btn {
        padding: 1.25rem;
        font-size: 1.15rem;
        margin: 0 1.5rem 1.5rem;
        width: calc(100% - 3rem);
        border-radius: 16px;
        background: var(--green-900);
    }
}