/* Teachers page (/instructor-finder): subject cards + per-subject teacher listing.
   Loaded after home-v2.css, so Tailwind's preflight reset is already applied. */
/* Colours: the defaults are sampled from the approved design; the page sets the admin's colours inline
   (Settings > Academy > Teachers page, TeachersPageSettings::cssVariables()). */
.tc-page {
    --tc-page-bg: #dce8fe;
    --tc-panel-from: #f3f6ff;
    --tc-panel-to: #dce8fe;
    --tc-card-bg: #f8faff;
    --tc-title: #0b1584;
    --tc-highlight: #3a8ffb;
    --tc-text: #101c6b;
    --tc-name: #20209a;
    --tc-muted: #6b7a99;
    --tc-accent: #1c8efe;
    --tc-badge-courses: #1e8cff;
    --tc-badge-private: #a368ec;

    --tc-navy: var(--tc-title);
    --tc-ink: var(--tc-text);
    --tc-blue: var(--tc-accent);
    --tc-blue-dark: color-mix(in srgb, var(--tc-accent) 82%, #000);
    --tc-accent-grad: linear-gradient(180deg, color-mix(in srgb, var(--tc-accent) 85%, #fff), color-mix(in srgb, var(--tc-accent) 92%, #000));
    --tc-card: color-mix(in srgb, var(--tc-card-bg) 92%, transparent);
    --tc-shadow: 0 16px 34px -18px rgba(40, 100, 210, .38), 0 2px 6px -2px rgba(40, 100, 210, .12);
    padding: 0 0 56px;
    background: var(--tc-page-bg);
}
.tc-page,
.tc-page h1,
.tc-page h2,
.tc-page p,
.tc-page a,
.tc-page span {
    font-family: 'Plus Jakarta Sans', Inter, Cairo, Tajawal, system-ui, sans-serif !important;
}

/* Full-width panel on desktop (rounded, framed card on phones) */
.tc-panel {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 36px clamp(24px, 4vw, 64px) 44px;
    overflow: hidden;
    border-bottom: 8px solid rgba(255, 255, 255, .85);
    box-shadow: inset 0 -1px 0 rgba(150, 190, 250, .35), 0 24px 50px -36px rgba(37, 92, 190, .5);
}
.tc-panel--subjects {
    background:
        radial-gradient(60% 55% at 0 0, rgba(255, 255, 255, .75), transparent 70%),
        linear-gradient(135deg, var(--tc-panel-from) 0%, var(--tc-panel-from) 30%, color-mix(in srgb, var(--tc-panel-from) 55%, var(--tc-panel-to)) 62%, var(--tc-panel-to) 100%);
}
.tc-panel--teachers {
    background:
        linear-gradient(115deg, transparent 52%, rgba(255, 255, 255, .5) 60%, transparent 68%),
        radial-gradient(60% 60% at 0 0, rgba(255, 255, 255, .7), transparent 70%),
        linear-gradient(160deg, var(--tc-panel-from) 0%, color-mix(in srgb, var(--tc-panel-from) 70%, var(--tc-panel-to)) 40%, color-mix(in srgb, var(--tc-panel-to) 70%, var(--tc-panel-from)) 100%);
}

/* Soft blue waves along the bottom of the subjects panel */
.tc-waves {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 230px;
    pointer-events: none;
}
.tc-waves svg { display: block; width: 100%; height: 100%; }

/* Campus illustration, faded into the panel like the design */
.tc-campus {
    position: absolute;
    top: 0;
    right: 0;
    width: auto;
    height: 440px;
    max-width: 60%;
    object-fit: cover;
    object-position: left bottom;
    pointer-events: none;
    -webkit-mask-image: radial-gradient(ellipse 100% 100% at 100% 0, #000 70%, transparent 99%);
    mask-image: radial-gradient(ellipse 100% 100% at 100% 0, #000 70%, transparent 99%);
}

.tc-panel__logo {
    position: absolute;
    top: 20px;
    right: 30px;
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.tc-back {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--tc-blue-dark);
    text-decoration: none;
}
.tc-back:hover { color: var(--tc-navy); text-decoration: none; }
.tc-back svg { width: 22px; height: 22px; }

/* Hero text */
.tc-hero {
    position: relative;
    margin: 56px 0 44px;
    max-width: 560px;
}
.tc-hero__title {
    margin: 0;
    font-size: clamp(2.6rem, 6.2vw, 4.4rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.01em;
    color: var(--tc-navy);
}
.tc-hero__title span {
    display: block;
    margin: calc(4px - .2em) 0 -.2em;
    padding-block: .2em;
    background: linear-gradient(180deg, color-mix(in srgb, var(--tc-highlight) 82%, #fff), var(--tc-highlight));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.tc-hero__desc {
    margin: 22px 0 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--tc-ink);
}
.tc-hero--list {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 18px 0 26px;
    max-width: none;
}
.tc-hero--list .tc-hero__desc { margin-top: 12px; color: color-mix(in srgb, var(--tc-text) 65%, var(--tc-accent)); }
.tc-hero__icon {
    flex: none;
    width: auto;
    height: 150px;
    margin: 30px clamp(0px, 4vw, 60px) 0 0;
    object-fit: contain;
    filter: drop-shadow(0 18px 22px rgba(31, 111, 230, .22));
    animation: tc-float 5s ease-in-out infinite;
}
.tc-count {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 7px 14px;
    border: 1.5px solid #fff;
    border-radius: 999px;
    background: color-mix(in srgb, var(--tc-card-bg) 80%, transparent);
    box-shadow: 0 8px 18px -12px rgba(40, 100, 210, .5);
    font-size: .92rem;
    font-weight: 700;
    color: var(--tc-blue-dark);
}
.tc-count svg { width: 18px; height: 18px; }

/* Subject cards */
.tc-groups {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 18px;
}
.tc-group {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 186px;
    padding: 18px 22px 20px;
    border: 1.5px solid #fff;
    border-radius: 22px;
    background: var(--tc-card);
    box-shadow: var(--tc-shadow);
    color: var(--tc-navy);
    text-decoration: none;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
    animation: tc-rise .6s cubic-bezier(.2, .7, .2, 1) backwards;
    animation-delay: calc(var(--i, 0) * 80ms);
}
.tc-group:hover {
    transform: translateY(-6px);
    border-color: color-mix(in srgb, var(--tc-accent) 25%, #fff);
    box-shadow: 0 26px 44px -20px color-mix(in srgb, var(--tc-accent) 55%, transparent), 0 0 0 4px color-mix(in srgb, var(--tc-accent) 8%, transparent);
    color: var(--tc-navy);
    text-decoration: none;
}
.tc-group__icon {
    display: block;
    width: auto;
    height: 84px;
    margin: 0 auto 14px;
    object-fit: contain;
    transition: transform .35s cubic-bezier(.2, .7, .2, 1), filter .35s ease;
}
.tc-group:hover .tc-group__icon {
    transform: translateY(-6px) scale(1.06);
    filter: drop-shadow(0 12px 14px rgba(31, 111, 230, .25));
}
.tc-group:hover .tc-arrow { transform: translateX(3px); }

/* Teacher faces + count on a subject card */
.tc-group__people {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
    padding-right: 44px;
}
.tc-faces { display: inline-flex; }
.tc-face {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    overflow: hidden;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--tc-accent-grad);
    box-shadow: 0 4px 10px -4px rgba(30, 60, 140, .45);
}
.tc-face + .tc-face { margin-left: -9px; }
.tc-face .tc-initials { font-size: .62rem; }
.tc-face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s ease; }
.tc-group__teachers { font-size: .9rem; font-weight: 600; color: var(--tc-blue-dark); }
.tc-group__title {
    padding-right: 44px;
    font-size: 1.28rem;
    font-weight: 700;
    line-height: 1.25;
}
.tc-group__meta {
    margin-top: 6px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--tc-muted);
}
.tc-arrow {
    position: absolute;
    right: 20px;
    bottom: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--tc-accent-grad);
    box-shadow: 0 8px 16px -8px color-mix(in srgb, var(--tc-accent) 90%, transparent);
    color: #fff;
    transition: transform .25s ease;
}
.tc-arrow svg { width: 18px; height: 18px; }

.tc-mission {
    position: relative;
    display: block;
    width: 270px;
    max-width: 70%;
    height: auto;
    margin: 30px auto 0;
}

/* Teaching-system tabs */
.tc-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 22px;
    margin-bottom: 30px;
}
.tc-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-width: 132px;
    padding: 10px 30px;
    border-radius: 999px;
    background: #fcfcfe;
    box-shadow: 0 8px 20px -10px rgba(47, 102, 196, .35);
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    color: var(--tc-navy);
    text-decoration: none;
}
.tc-tab:hover { color: var(--tc-blue-dark); text-decoration: none; }
.tc-tab.is-active {
    background: var(--tc-accent-grad);
    box-shadow: 0 12px 22px -10px color-mix(in srgb, var(--tc-accent) 80%, transparent);
    color: #fff;
}
.tc-tab__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    margin-left: 6px;
    padding: 0 7px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--tc-accent) 12%, #fff);
    font-size: .78rem;
    font-weight: 700;
    color: var(--tc-blue-dark);
}
.tc-tab.is-active .tc-tab__count { background: rgba(255, 255, 255, .25); color: #fff; }

/* Subject filter chips */
.tc-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: -8px auto 30px;
    max-width: 1100px;
}
.tc-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid color-mix(in srgb, var(--tc-accent) 22%, #fff);
    border-radius: 999px;
    background: rgba(255, 255, 255, .7);
    font-size: .86rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--tc-navy);
    text-decoration: none;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.tc-chip span { font-size: .75rem; font-weight: 700; color: var(--tc-muted); }
.tc-chip:hover { border-color: var(--tc-accent); color: var(--tc-blue-dark); text-decoration: none; }
.tc-chip.is-active { border-color: transparent; background: var(--tc-navy); color: #fff; }
.tc-chip.is-active span { color: rgba(255, 255, 255, .75); }

/* Teacher cards */
.tc-teachers {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}
.tc-teacher {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 14px 16px;
    border: 1.5px solid #fff;
    border-radius: 20px;
    background: var(--tc-card);
    box-shadow: var(--tc-shadow);
    text-align: center;
    transition: transform .25s ease, box-shadow .25s ease;
    animation: tc-rise .6s cubic-bezier(.2, .7, .2, 1) backwards;
    animation-delay: calc(var(--i, 0) * 60ms);
}
.tc-teacher:hover {
    transform: translateY(-5px);
    box-shadow: 0 24px 40px -20px color-mix(in srgb, var(--tc-accent) 50%, transparent);
}
.tc-teacher__photo {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1.12 / 1;
    overflow: hidden;
    border-radius: 16px;
    background:
        radial-gradient(80% 70% at 30% 20%, rgba(255, 255, 255, .35), transparent 60%),
        linear-gradient(140deg, color-mix(in srgb, var(--tc-accent) 55%, #fff), color-mix(in srgb, var(--tc-badge-private) 45%, var(--tc-accent)));
}
.tc-teacher__photo .tc-initials { font-size: clamp(1.8rem, 4vw, 2.8rem); }
.tc-teacher__photo img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    background: linear-gradient(180deg, #f7f9ff, #eaf0fb);
    opacity: 0;
    transition: opacity .35s ease, transform .5s cubic-bezier(.2, .7, .2, 1);
}
.tc-teacher:hover .tc-teacher__photo img { transform: scale(1.06); }
/* Lazy photos stay hidden over the initials until loaded (teacher_avatar adds .is-loaded), then fade in. */
.tc-face img.is-loaded,
.tc-teacher__photo img.is-loaded { opacity: 1; }
.tc-initials {
    font-weight: 800;
    letter-spacing: .02em;
    line-height: 1;
    color: #fff;
    text-shadow: 0 2px 8px rgba(10, 30, 90, .25);
}
.tc-badge {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 1;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    color: #fff;
    box-shadow: 0 6px 14px -8px rgba(30, 50, 120, .6);
}
.tc-badge--courses { background: linear-gradient(180deg, color-mix(in srgb, var(--tc-badge-courses) 55%, #fff), var(--tc-badge-courses)); }
.tc-badge--private { background: linear-gradient(180deg, color-mix(in srgb, var(--tc-badge-private) 65%, #fff), var(--tc-badge-private)); }
.tc-badge--both { background: linear-gradient(90deg, color-mix(in srgb, var(--tc-badge-courses) 65%, #fff), color-mix(in srgb, var(--tc-badge-courses) 50%, var(--tc-badge-private)) 55%, var(--tc-badge-private)); }

.tc-teacher__name {
    margin: 14px 0 4px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--tc-name);
}
.tc-teacher__spec {
    margin: 0 0 14px;
    font-size: .92rem;
    font-weight: 500;
    color: var(--tc-muted);
}
.tc-teacher__actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: auto;
}
.tc-teacher__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 170px;
    padding: 7px 14px;
    border: 1.5px solid var(--tc-accent);
    border-radius: 999px;
    background: #fff;
    font-size: .95rem;
    font-weight: 600;
    color: var(--tc-blue-dark);
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
}
.tc-teacher__cta svg { width: 14px; height: 14px; color: color-mix(in srgb, var(--tc-accent) 40%, #fff); }
.tc-teacher__cta:hover { background: var(--tc-blue); color: #fff; text-decoration: none; }
.tc-teacher__cta:hover svg { color: #fff; }
.tc-teacher__cta--book {
    border-color: transparent;
    background: linear-gradient(90deg, color-mix(in srgb, var(--tc-badge-private) 80%, #fff), var(--tc-badge-private));
    color: #fff;
}
.tc-teacher__cta--book:hover { filter: brightness(1.06); background: linear-gradient(90deg, color-mix(in srgb, var(--tc-badge-private) 80%, #fff), var(--tc-badge-private)); }

.tc-group:focus-visible,
.tc-tab:focus-visible,
.tc-back:focus-visible,
.tc-teacher__cta:focus-visible,
.tc-chip:focus-visible { outline: 3px solid #9cc4ff; outline-offset: 3px; }

@keyframes tc-rise {
    from { opacity: 0; transform: translateY(22px); }
    to { opacity: 1; transform: none; }
}
@keyframes tc-float {
    50% { transform: translateY(-10px); }
}

.tc-pagination { margin-top: 32px; display: flex; justify-content: center; }

.tc-empty {
    padding: 40px 20px;
    border: 1.5px solid #fff;
    border-radius: 22px;
    background: var(--tc-card);
    box-shadow: var(--tc-shadow);
    text-align: center;
}
.tc-empty img { display: block; width: auto; height: 84px; margin: 0 auto 16px; }
.tc-empty h2 { margin: 0 0 6px; font-size: 1.3rem; font-weight: 700; color: var(--tc-navy); }
.tc-empty p { margin: 0; color: var(--tc-muted); }
.tc-empty p a { color: var(--tc-blue-dark); font-weight: 600; text-decoration: underline; }

/* Wide screens */
@media (min-width: 1500px) {
    .tc-teachers { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* Tablet */
@media (max-width: 991px) {
    .tc-panel { padding: 28px 24px 32px; }
    .tc-campus { height: 340px; max-width: 70%; opacity: .8; }
    .tc-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tc-teachers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tc-hero__icon { height: 120px; margin-right: 0; }
}

/* Phone */
@media (max-width: 640px) {
    .tc-page { padding: 14px 10px 40px; }
    .tc-panel { padding: 22px 14px 26px; border: 6px solid rgba(255, 255, 255, .85); border-radius: 26px; }
    .tc-waves { height: 140px; }
    .tc-campus { height: 250px; max-width: 85%; opacity: .45; }
    .tc-panel__logo { top: 18px; right: 16px; width: 44px; height: 44px; }
    .tc-hero { margin: 34px 0 28px; }
    .tc-hero--list { margin: 14px 0 22px; }
    .tc-hero__desc { font-size: 1rem; }
    .tc-groups { gap: 12px; }
    .tc-group { min-height: 168px; padding: 14px 14px 16px; border-radius: 18px; }
    .tc-group__icon { height: 62px; margin-bottom: 10px; }
    .tc-group__title { padding-right: 0; font-size: 1rem; }
    .tc-group__meta { font-size: .85rem; }
    /* Arrow in the top corner on phones, so the teachers row gets the full width */
    .tc-arrow { top: 12px; right: 12px; bottom: auto; width: 28px; height: 28px; }
    .tc-arrow svg { width: 15px; height: 15px; }
    .tc-tabs { gap: 10px; }
    .tc-tab { min-width: 0; flex: 1; padding: 9px 6px; font-size: .92rem; }
    .tc-teachers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .tc-teacher { padding: 8px 8px 12px; border-radius: 16px; }
    .tc-teacher__photo { border-radius: 12px; }
    .tc-badge { top: 4px; right: 4px; padding: 3px 8px; font-size: .68rem; }
    .tc-teacher__name { font-size: .92rem; margin-top: 10px; }
    .tc-teacher__spec { font-size: .82rem; margin-bottom: 10px; }
    .tc-teacher__cta { font-size: .85rem; padding: 6px 8px; }
    .tc-panel__logo { width: 40px; height: 40px; }
    .tc-hero__icon { display: none; }
    .tc-count { margin-top: 12px; padding: 5px 12px; font-size: .82rem; }
    .tc-tab__count { min-width: 20px; height: 19px; margin-left: 4px; padding: 0 5px; font-size: .7rem; }
    .tc-chips { flex-wrap: nowrap; justify-content: flex-start; margin: -4px -14px 22px; padding: 2px 14px 6px; overflow-x: auto; scrollbar-width: none; }
    .tc-chips::-webkit-scrollbar { display: none; }
    .tc-group__people { padding-top: 8px; padding-right: 0; gap: 6px; }
    .tc-face { width: 24px; height: 24px; }
    .tc-face + .tc-face { margin-left: -8px; }
    .tc-group__teachers { font-size: .76rem; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
    .tc-group, .tc-teacher, .tc-hero__icon { animation: none; }
    .tc-group, .tc-group__icon, .tc-arrow, .tc-teacher, .tc-teacher__photo img, .tc-teacher__cta, .tc-chip { transition: none; }
}
