/*
 * Teacher Directory – Clean & Easy on the Eyes
 * Light warm-white · Soft shadows · Readable Thai typography
 * ──────────────────────────────────────────────────────────
 */

@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

/* ══════════════════════════════════════════════
   TOKENS
══════════════════════════════════════════════ */
:root {
    --td-bg:            #f5f7fb;
    --td-surface:       #ffffff;
    --td-border:        #e6ecf4;
    --td-border-soft:   #f0f4f9;
    --td-text:          #1e2530;
    --td-muted:         #6b7a8d;
    --td-light:         #9aaabb;

    --td-blue:          #2563eb;
    --td-blue-dk:       #1d4ed8;
    --td-blue-bg:       #eff6ff;
    --td-blue-border:   #bfdbfe;
    --td-teal:          #0891b2;
    --td-gold:          #d97706;

    /* Header dark */
    --td-hdr-from:      #0f172a;
    --td-hdr-to:        #1e293b;
    --td-hdr-accent:    #38bdf8;

    --td-r:             14px;
    --td-r-sm:          9px;
    --td-r-pill:        999px;

    --td-shadow-sm:     0 1px 3px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
    --td-shadow:        0 2px 8px rgba(0,0,0,.07), 0 12px 32px rgba(0,0,0,.06);
    --td-ease:          cubic-bezier(.4,0,.2,1);
    --td-dur:           .2s;
}

/* ══════════════════════════════════════════════
   BODY
══════════════════════════════════════════════ */
.teacher-directory-body {
    background: var(--td-bg);
    font-family: 'Sarabun', sans-serif;
    font-size: 16px;
    color: var(--td-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════════
   PAGE WRAPPER
══════════════════════════════════════════════ */
.teacher-page {
    width: calc(100% - 2rem);
    max-width: 1400px;
    margin-inline: auto;
    background: var(--td-surface);
    border: 1px solid var(--td-border);
    border-radius: var(--td-r);
    box-shadow: var(--td-shadow);
    overflow: hidden;
}

/* ══════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════ */
.teacher-page__header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.75rem;
    padding: clamp(1.5rem, 2.5vw, 2.25rem) clamp(1.25rem, 3vw, 2.5rem);
    background: linear-gradient(135deg, var(--td-hdr-from) 0%, #162032 50%, var(--td-hdr-to) 100%);
    overflow: hidden;
    color: #fff;
}

/* Subtle dot grid */
.teacher-page__header::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

/* Bottom accent line */
.teacher-page__header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--td-hdr-accent) 30%, #38bdf8 60%, transparent 100%);
    opacity: .7;
}

.teacher-page__header > * { position: relative; z-index: 1; }

/* Heading group */
.teacher-page__heading {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    flex: 1 1 auto;
    min-width: 0;
}

/* Icon */
.teacher-page__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 62px;
    height: 62px;
    border-radius: 14px;
    background: rgba(56,189,248,.15);
    border: 1px solid rgba(56,189,248,.28);
    color: var(--td-hdr-accent);
    font-size: 1.7rem;
    box-shadow: 0 0 0 4px rgba(56,189,248,.07), 0 8px 24px rgba(0,0,0,.25);
}

/* Copy */
.teacher-page__copy { min-width: 0; }

.teacher-page__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .45rem;
    padding: .22rem .7rem;
    border-radius: var(--td-r-pill);
    background: rgba(56,189,248,.12);
    border: 1px solid rgba(56,189,248,.22);
    color: var(--td-hdr-accent);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.teacher-page__title {
    margin: 0;
    color: #f8fafc;
    font-weight: 700;
    font-size: clamp(1.5rem, 2.8vw, 2.1rem);
    line-height: 1.2;
    letter-spacing: -.01em;
}

.teacher-page__subtitle {
    margin: .4rem 0 0;
    color: #94a3b8;
    font-size: clamp(.88rem, 1.3vw, 1rem);
    line-height: 1.65;
}

/* Meta badge */
.teacher-page__meta {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .7rem 1.1rem;
    border-radius: 10px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    color: #e2e8f0;
    font-size: .9rem;
    font-weight: 500;
    white-space: nowrap;
}

.teacher-page__meta i {
    color: var(--td-hdr-accent);
    font-size: 1rem;
}

#teacherCount {
    font-weight: 700;
    color: #fff;
}

/* ══════════════════════════════════════════════
   DIVIDER
══════════════════════════════════════════════ */
.teacher-page > hr,
.teacher-page .row > hr {
    margin: 0;
    border: none;
    height: 1px;
    background: var(--td-border);
    opacity: 1;
}

/* ══════════════════════════════════════════════
   FILTER BAR
══════════════════════════════════════════════ */
.teacher-page .container.my-3 {
    padding: 1.25rem 1.5rem .5rem;
    max-width: none !important;
}

.teacher-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .45rem;
    padding: .85rem 1rem;
    background: var(--td-bg);
    border: 1px solid var(--td-border);
    border-radius: var(--td-r-sm);
}

.teacher-filter .btn {
    margin: 0;
    padding: .42rem .95rem;
    border-radius: var(--td-r-pill);
    border: 1px solid var(--td-border);
    background: var(--td-surface);
    color: var(--td-muted);
    font-family: 'Sarabun', sans-serif;
    font-size: .88rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: var(--td-shadow-sm);
    transition:
        background var(--td-dur) var(--td-ease),
        border-color var(--td-dur) var(--td-ease),
        color var(--td-dur) var(--td-ease),
        transform var(--td-dur) var(--td-ease),
        box-shadow var(--td-dur) var(--td-ease);
}

.teacher-filter .btn:hover,
.teacher-filter .btn:focus-visible {
    background: var(--td-blue-bg);
    border-color: var(--td-blue-border);
    color: var(--td-blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,.12);
    outline: none;
}

/* Active */
.teacher-filter .btn-success,
.teacher-filter .btn-success:hover,
.teacher-filter .btn-success:focus-visible {
    background: linear-gradient(135deg, var(--td-blue) 0%, var(--td-blue-dk) 100%);
    border-color: transparent;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 3px 12px rgba(37,99,235,.28);
    transform: none;
}

/* ══════════════════════════════════════════════
   TEACHER CARDS
══════════════════════════════════════════════ */
#teacherCards {
    padding: .75rem 1rem 1.25rem;
}

.teacher-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--td-surface);
    border: 1px solid var(--td-border);
    border-radius: var(--td-r);
    box-shadow: var(--td-shadow-sm);
    overflow: hidden;
    transition:
        transform var(--td-dur) var(--td-ease),
        box-shadow var(--td-dur) var(--td-ease),
        border-color var(--td-dur) var(--td-ease);
}

.teacher-card:hover {
    transform: translateY(-4px);
    border-color: var(--td-blue-border);
    box-shadow: 0 4px 16px rgba(0,0,0,.08), 0 20px 48px rgba(37,99,235,.1);
}

/* Photo */
.teacher-card__photo {
    display: block;
    position: relative;
    aspect-ratio: 3 / 4;
    background: linear-gradient(160deg, #eef3fa, #dce8f5);
    overflow: hidden;
}

.teacher-card__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform .3s var(--td-ease);
}

.teacher-card:hover .teacher-card__photo img {
    transform: scale(1.04);
}

/* Body */
.teacher-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem;
    background: var(--td-surface);
    text-align: center;
}

.teacher-card__name {
    margin: 0;
    color: var(--td-text);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
}

.teacher-card__position {
    margin: .25rem 0 0;
    color: var(--td-muted);
    font-size: .88rem;
    line-height: 1.55;
    min-height: 2.6em;
}

/* CTA button */
.teacher-card__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    width: 100%;
    min-height: 40px;
    border-radius: var(--td-r-sm);
    background: var(--td-blue-bg);
    border: 1px solid var(--td-blue-border);
    color: var(--td-blue);
    font-family: 'Sarabun', sans-serif;
    font-weight: 700;
    font-size: .9rem;
    text-decoration: none;
    transition:
        background var(--td-dur) var(--td-ease),
        color var(--td-dur) var(--td-ease),
        box-shadow var(--td-dur) var(--td-ease),
        transform var(--td-dur) var(--td-ease);
}

.teacher-card__link i {
    font-size: .8rem;
    transition: transform var(--td-dur) var(--td-ease);
}

.teacher-card__link:hover,
.teacher-card__link:focus-visible {
    background: var(--td-blue);
    border-color: var(--td-blue);
    color: #fff;
    box-shadow: 0 4px 16px rgba(37,99,235,.25);
    transform: translateY(-1px);
    text-decoration: none;
}

.teacher-card__link:hover i {
    transform: translateX(4px);
}

/* ══════════════════════════════════════════════
   CARD ENTRANCE ANIMATION
══════════════════════════════════════════════ */
@keyframes td-card-in {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.teacher-card { animation: td-card-in .35s var(--td-ease) both; }

#teacherCards .col-12:nth-child(1)  .teacher-card { animation-delay: .04s; }
#teacherCards .col-12:nth-child(2)  .teacher-card { animation-delay: .08s; }
#teacherCards .col-12:nth-child(3)  .teacher-card { animation-delay: .12s; }
#teacherCards .col-12:nth-child(4)  .teacher-card { animation-delay: .16s; }
#teacherCards .col-12:nth-child(5)  .teacher-card { animation-delay: .20s; }
#teacherCards .col-12:nth-child(6)  .teacher-card { animation-delay: .24s; }
#teacherCards .col-12:nth-child(7)  .teacher-card { animation-delay: .28s; }
#teacherCards .col-12:nth-child(8)  .teacher-card { animation-delay: .32s; }
#teacherCards .col-12:nth-child(9)  .teacher-card { animation-delay: .36s; }
#teacherCards .col-12:nth-child(10) .teacher-card { animation-delay: .40s; }
#teacherCards .col-12:nth-child(11) .teacher-card { animation-delay: .44s; }
#teacherCards .col-12:nth-child(12) .teacher-card { animation-delay: .48s; }

/* ══════════════════════════════════════════════
   EMPTY / LOADING
══════════════════════════════════════════════ */
.teacher-empty {
    padding: 3rem 2rem;
    border: 1px dashed var(--td-border);
    border-radius: var(--td-r);
    background: var(--td-bg);
    color: var(--td-muted);
    text-align: center;
    font-size: .95rem;
}

/* Shimmer skeleton */
.teacher-skeleton {
    height: 100%;
    min-height: 320px;
    border-radius: var(--td-r);
    background: linear-gradient(90deg, #edf2f7 25%, #f7fafc 50%, #edf2f7 75%);
    background-size: 300% 100%;
    animation: td-shimmer 1.6s ease-in-out infinite;
}

@keyframes td-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Load status */
.teacher-load-status {
    min-height: 2.5rem;
    margin: .5rem 0 1rem;
    color: var(--td-muted);
    font-size: .9rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
}

.teacher-load-status.is-loading {
    color: var(--td-blue);
    font-weight: 600;
}

.teacher-load-status.is-loading::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--td-blue-border);
    border-top-color: var(--td-blue);
    border-radius: 50%;
    animation: td-spin .65s linear infinite;
    flex-shrink: 0;
}

@keyframes td-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 991.98px) {
    .teacher-page__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.1rem;
    }

    .teacher-page__meta {
        align-self: stretch;
        justify-content: center;
    }
}

@media (max-width: 575.98px) {
    .teacher-page {
        width: 100%;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        box-shadow: none;
    }

    .teacher-page__header {
        padding: 1.35rem 1rem 1.2rem;
    }

    .teacher-page__title { font-size: 1.45rem; }

    .teacher-page__icon {
        width: 52px;
        height: 52px;
        font-size: 1.45rem;
        border-radius: 12px;
    }

    .teacher-page .container.my-3 {
        padding: 1rem .75rem .5rem;
    }

    .teacher-filter {
        justify-content: flex-start;
        gap: .35rem;
    }

    .teacher-filter .btn {
        flex: 1 1 auto;
        min-width: 44%;
        font-size: .84rem;
        padding: .4rem .7rem;
    }

    .teacher-card__photo { aspect-ratio: 3 / 3.6; }
}
