/* ==========================================================================
   ValueStats · Coach directory and profile
   ========================================================================== */

.coach-directory,
.coach-profile {
    --coach-canvas: #edf2ef;
    --coach-surface: #fff;
    --coach-surface-muted: #f3f7f5;
    --coach-border: #d2ded8;
    --coach-border-strong: #bfcec6;
    --coach-ink: #15231b;
    --coach-muted: #697a71;
    --coach-primary: #087a55;
    --coach-primary-strong: #075f45;
    min-height: 100vh;
    color: var(--coach-ink);
    background: var(--coach-canvas);
}

/* Directory hero */
.coach-directory-hero,
.coach-profile-hero {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(61, 108, 86, .18);
    background:
        radial-gradient(circle at 82% 12%, rgba(21, 150, 106, .13), transparent 29%),
        linear-gradient(142deg, #f4f7f5 0%, #e7eee9 62%, #dfe9e3 100%);
    box-shadow: 0 10px 28px rgba(25, 52, 38, .08);
}

.coach-directory-hero::before,
.coach-profile-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: .06;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(8, 74, 49, .3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(8, 74, 49, .3) 1px, transparent 1px);
    background-size: 54px 54px;
    -webkit-mask-image: linear-gradient(90deg, #000, transparent 88%);
    mask-image: linear-gradient(90deg, #000, transparent 88%);
}

.coach-directory-hero::after,
.coach-profile-hero::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 1px;
    background: linear-gradient(90deg, #15966a, rgba(21, 150, 106, .18) 42%, transparent 82%);
}

.coach-directory-hero-inner,
.coach-profile-hero-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: clamp(1.8rem, 3.4vw, 3.15rem) clamp(1rem, 3.4vw, 3rem);
}

.coach-directory-hero-inner {
    display: flex;
    min-height: 12.5rem;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.coach-directory-hero-copy {
    max-width: 52rem;
}

.coach-directory-kicker,
.coach-profile-kicker {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .65rem;
    color: var(--coach-primary);
    font-size: .68rem;
    font-weight: 760;
    letter-spacing: .085em;
    text-transform: uppercase;
}

.coach-directory-kicker svg {
    width: 1rem;
    height: 1rem;
}

.coach-directory-hero h1,
.coach-profile-heading h1 {
    margin: 0;
    color: #14241b;
    font-size: clamp(2rem, 4vw, 3.4rem);
    font-weight: 720;
    letter-spacing: -.055em;
    line-height: 1;
}

.coach-directory-hero p {
    max-width: 46rem;
    margin: .95rem 0 0;
    color: #607168;
    font-size: clamp(.9rem, 1.2vw, 1rem);
    line-height: 1.65;
}

.coach-directory-hero-mark {
    display: grid;
    width: clamp(6rem, 10vw, 9rem);
    height: clamp(6rem, 10vw, 9rem);
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(8, 122, 85, .16);
    border-radius: .55rem;
    color: rgba(8, 122, 85, .4);
    background: rgba(255, 255, 255, .42);
    box-shadow: 0 18px 42px rgba(25, 55, 39, .08);
}

.coach-directory-hero-mark svg {
    width: 55%;
    height: 55%;
}

/* Directory table */
.coach-directory-shell,
.coach-profile-shell {
    width: 100%;
    padding: 1rem clamp(.75rem, 1.7vw, 1.5rem) 2.5rem;
}

.coach-directory-card,
.coach-profile-panel {
    overflow: hidden;
    border: 1px solid var(--coach-border);
    border-radius: .52rem;
    background: var(--coach-surface);
    box-shadow: 0 8px 24px rgba(25, 45, 35, .055), 0 1px 2px rgba(25, 45, 35, .04);
}

.coach-directory-toolbar {
    display: flex;
    min-height: 4.5rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--coach-border);
    background: var(--coach-surface-muted);
}

.coach-directory-toolbar > div {
    display: flex;
    align-items: baseline;
    gap: .6rem;
}

.coach-directory-toolbar-label {
    color: var(--coach-ink);
    font-size: .86rem;
    font-weight: 690;
}

.coach-directory-toolbar strong {
    color: var(--coach-muted);
    font-size: .7rem;
    font-weight: 700;
}

.coach-directory-filter {
    position: relative;
    width: min(18rem, 48vw);
}

.coach-directory-filter select {
    width: 100%;
    min-height: 2.45rem;
    padding: .48rem 2.25rem .48rem .75rem;
    border: 1px solid var(--coach-border-strong);
    border-radius: .32rem;
    color: #304139;
    background: #fff;
    font-size: .76rem;
    font-weight: 600;
    outline: none;
    appearance: none;
}

.coach-directory-filter select:focus {
    border-color: #15966a;
    box-shadow: 0 0 0 3px rgba(21, 150, 106, .12);
}

.coach-directory-filter > svg {
    position: absolute;
    top: 50%;
    right: .75rem;
    width: .9rem;
    height: .9rem;
    color: #718078;
    pointer-events: none;
    transform: translateY(-50%);
}

.coach-directory-table-wrap {
    overflow-x: auto;
    width: 100%;
    overscroll-behavior-x: contain;
}

.coach-directory-table-wrap table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
}

.coach-directory-table-wrap thead,
.coach-directory-table-wrap thead tr,
.coach-directory-table-wrap thead th {
    border-color: #d6e0db !important;
    background: #f0f4f2 !important;
}

.coach-directory-table-wrap thead th {
    height: 2.75rem;
    padding: .65rem 1rem !important;
    color: #65766d !important;
    font-size: .64rem !important;
    font-weight: 740 !important;
    letter-spacing: .05em !important;
}

.coach-directory-table-wrap thead th:first-child,
.coach-directory-table-wrap tbody td:first-child {
    width: 29%;
    min-width: 14rem;
}

.coach-directory-table-wrap thead th:nth-child(2),
.coach-directory-table-wrap tbody td:nth-child(2) {
    width: 27%;
    min-width: 13rem;
}

.coach-directory-table-wrap tbody tr,
.coach-directory-table-wrap tbody td {
    border-color: #e0e7e3 !important;
    background: var(--coach-surface) !important;
}

.coach-directory-table-wrap tbody td {
    height: 3.85rem;
    padding: .52rem 1rem !important;
}

.coach-directory-table-wrap tbody tr:hover td {
    background: #eff6f2 !important;
}

.coach-directory-table-wrap .coach-directory-sticky {
    box-shadow: 1px 0 0 #dce5e0, 8px 0 16px rgba(32, 54, 42, .025);
}

.coach-directory-table-wrap tbody a {
    transition: color .15s ease;
}

.coach-directory-table-wrap tbody a:hover {
    color: var(--coach-primary) !important;
}

.coach-directory-table-wrap tbody .text-gray-900 {
    color: #1e2d25 !important;
}

.coach-directory-table-wrap tbody .text-gray-500 {
    color: #78877f !important;
}

.coach-directory-table-wrap img {
    object-fit: contain;
}

.coach-directory-pagination {
    border-color: var(--coach-border) !important;
    background: var(--coach-surface-muted) !important;
}

.coach-directory-pagination p {
    color: var(--coach-muted) !important;
    font-size: .73rem !important;
}

.coach-directory-pagination nav > * {
    min-width: 2.25rem;
    min-height: 2.25rem;
    justify-content: center;
    border-color: var(--coach-border-strong) !important;
    border-radius: 0 !important;
    color: #54665c !important;
    background: var(--coach-surface) !important;
    font-size: .72rem !important;
}

.coach-directory-pagination nav > span.border-green-500 {
    border-color: #15966a !important;
    color: #075f45 !important;
    background: #e9f5ef !important;
}

/* Coach profile hero */
.coach-profile-hero-inner {
    min-height: 15rem;
}

.coach-profile-back {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-bottom: 1.45rem;
    color: #607168;
    font-size: .7rem;
    font-weight: 680;
}

.coach-profile-back:hover {
    color: var(--coach-primary);
}

.coach-profile-back svg {
    width: .9rem;
    height: .9rem;
}

.coach-profile-identity {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(13rem, auto);
    gap: 1.25rem;
    align-items: center;
}

.coach-profile-identity--no-photo {
    grid-template-columns: minmax(0, 1fr) minmax(13rem, auto);
}

.coach-profile-photo,
.coach-profile-monogram {
    display: grid;
    overflow: hidden;
    width: 6rem;
    height: 6rem;
    place-items: center;
    border: 1px solid rgba(8, 122, 85, .16);
    border-radius: .5rem;
    background: rgba(255, 255, 255, .75);
    box-shadow: 0 12px 28px rgba(22, 48, 34, .09);
}

.coach-profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.coach-profile-monogram {
    color: #0b7553;
    background: linear-gradient(145deg, #fff, #e1eee7);
    font-size: 2rem;
    font-weight: 720;
}

.coach-profile-heading {
    min-width: 0;
}

.coach-profile-kicker {
    margin-bottom: .45rem;
}

.coach-profile-heading h1 {
    overflow-wrap: anywhere;
}

.coach-profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem 1rem;
    align-items: center;
    margin-top: .8rem;
    color: #63746b;
    font-size: .76rem;
}

.coach-profile-meta > span {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
}

.coach-profile-meta img {
    width: 1.25rem;
    height: .86rem;
    object-fit: cover;
    border: 1px solid rgba(42, 71, 56, .12);
}

.coach-profile-meta svg {
    width: .9rem;
    height: .9rem;
    color: var(--coach-primary);
}

.coach-profile-current-team {
    min-width: 14rem;
    padding: .9rem 1rem;
    border: 1px solid rgba(8, 122, 85, .16);
    border-radius: .45rem;
    background: rgba(255, 255, 255, .52);
}

.coach-profile-current-team > span {
    display: block;
    margin-bottom: .55rem;
    color: #73847b;
    font-size: .6rem;
    font-weight: 730;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.coach-profile-current-team > div {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.coach-profile-current-team img {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
}

.coach-profile-current-team strong {
    color: #23342b;
    font-size: .82rem;
    font-weight: 680;
}

/* Profile content */
.coach-profile-shell {
    display: grid;
    gap: 1rem;
}

.coach-profile-panel > header {
    display: flex;
    min-height: 3.65rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--coach-border);
    background: var(--coach-surface-muted);
}

.coach-profile-panel > header h2 {
    margin: 0;
    color: #1b2c23;
    font-size: .92rem;
    font-weight: 690;
    letter-spacing: -.018em;
}

.coach-profile-panel > header > span {
    display: inline-flex;
    min-width: 1.6rem;
    min-height: 1.35rem;
    align-items: center;
    justify-content: center;
    padding: 0 .4rem;
    border-radius: .25rem;
    color: var(--coach-primary);
    background: #e5f2eb;
    font-size: .65rem;
    font-weight: 720;
}

.coach-profile-prose {
    max-width: none !important;
    padding: 1.2rem 1.25rem 1.35rem;
    color: #4f6157;
    font-size: .86rem;
    line-height: 1.75;
}

.coach-profile-prose > :first-child {
    margin-top: 0;
}

.coach-profile-prose > :last-child {
    margin-bottom: 0;
}

.coach-profile-history-body,
.coach-profile-fixtures-body {
    padding: 1rem;
}

.coach-profile-team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: .65rem;
}

.coach-profile-team-card {
    display: grid;
    min-height: 5.75rem;
    grid-template-columns: 3rem minmax(0, 1fr);
    gap: .8rem;
    align-items: start;
    padding: .8rem;
    border: 1px solid var(--coach-border);
    border-radius: .36rem;
    background: var(--coach-surface-muted);
}

.coach-profile-team-logo {
    display: grid;
    width: 3rem;
    height: 3rem;
    place-items: center;
    padding: .3rem;
    border: 1px solid #dbe4df;
    border-radius: .3rem;
    background: #fff;
}

.coach-profile-team-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.coach-profile-team-name {
    display: block;
    margin: .08rem 0 .25rem;
    color: #203128;
    font-size: .78rem;
    font-weight: 690;
    line-height: 1.25;
}

a.coach-profile-team-name:hover {
    color: var(--coach-primary);
}

.coach-profile-team-card p {
    margin: 0;
    color: var(--coach-muted);
    font-size: .65rem;
    line-height: 1.4;
}

.coach-profile-team-leagues {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-top: .45rem;
}

.coach-profile-team-leagues img {
    width: 1.1rem;
    height: 1.1rem;
    object-fit: contain;
}

.coach-profile-fixtures-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.coach-profile-fixtures-body {
    min-height: 8rem;
}

.coach-profile-fixtures-body > div.divide-y {
    border: 1px solid var(--coach-border);
    border-radius: .32rem;
}

.coach-profile-fixtures-body > div.divide-y > div {
    border-color: var(--coach-border) !important;
}

.coach-profile-fixtures-body > div.divide-y > div:hover {
    background: #f1f6f3 !important;
}

.coach-profile-empty {
    display: grid;
    min-height: 6.5rem;
    place-items: center;
    padding: 1rem;
    color: var(--coach-muted);
    font-size: .76rem;
    text-align: center;
}

/* Dark mode */
[data-theme="dark"] .coach-directory,
[data-theme="dark"] .coach-profile {
    --coach-canvas: #09130f;
    --coach-surface: #101d17;
    --coach-surface-muted: #0c1813;
    --coach-border: #2a4035;
    --coach-border-strong: #344a3e;
    --coach-ink: #e5eee9;
    --coach-muted: #91a39a;
    --coach-primary: #34d399;
    --coach-primary-strong: #6ee7b7;
    color-scheme: dark;
    background: var(--coach-canvas);
}

[data-theme="dark"] .coach-directory-hero,
[data-theme="dark"] .coach-profile-hero {
    border-bottom-color: rgba(151, 190, 171, .17);
    background:
        radial-gradient(circle at 82% 10%, rgba(52, 211, 153, .15), transparent 28%),
        linear-gradient(142deg, #0b241b 0%, #081c15 62%, #061711 100%);
    box-shadow: 0 12px 32px rgba(3, 18, 13, .18);
}

[data-theme="dark"] .coach-directory-hero::before,
[data-theme="dark"] .coach-profile-hero::before {
    opacity: .09;
    background-image:
        linear-gradient(rgba(255, 255, 255, .16) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .16) 1px, transparent 1px);
}

[data-theme="dark"] .coach-directory-hero h1,
[data-theme="dark"] .coach-profile-heading h1 {
    color: #f6fbf8;
}

[data-theme="dark"] .coach-directory-hero p,
[data-theme="dark"] .coach-profile-back,
[data-theme="dark"] .coach-profile-meta {
    color: #a9bbb1;
}

[data-theme="dark"] .coach-directory-kicker,
[data-theme="dark"] .coach-profile-kicker,
[data-theme="dark"] .coach-profile-meta svg {
    color: #6ee7b7;
}

[data-theme="dark"] .coach-directory-hero-mark,
[data-theme="dark"] .coach-profile-current-team {
    border-color: rgba(207, 229, 218, .15);
    color: rgba(110, 231, 183, .55);
    background: rgba(255, 255, 255, .045);
}

[data-theme="dark"] .coach-directory-toolbar-label,
[data-theme="dark"] .coach-profile-panel > header h2,
[data-theme="dark"] .coach-profile-current-team strong,
[data-theme="dark"] .coach-profile-team-name {
    color: #e6f0eb;
}

[data-theme="dark"] .coach-directory-filter select {
    border-color: var(--coach-border-strong);
    color: #d6e3dc;
    background: #101d17;
}

[data-theme="dark"] .coach-directory-table-wrap thead,
[data-theme="dark"] .coach-directory-table-wrap thead tr,
[data-theme="dark"] .coach-directory-table-wrap thead th {
    border-color: #2a4035 !important;
    color: #93a59b !important;
    background: #0c1813 !important;
}

[data-theme="dark"] .coach-directory-table-wrap tbody,
[data-theme="dark"] .coach-directory-table-wrap tbody tr,
[data-theme="dark"] .coach-directory-table-wrap tbody td {
    border-color: #263b31 !important;
    background: #101d17 !important;
}

[data-theme="dark"] .coach-directory-table-wrap tbody tr:hover td {
    background: #13281e !important;
}

[data-theme="dark"] .coach-directory-table-wrap .coach-directory-sticky {
    box-shadow: 1px 0 0 #30463a, 8px 0 16px rgba(0, 0, 0, .12);
}

[data-theme="dark"] .coach-directory-table-wrap tbody .text-gray-900,
[data-theme="dark"] .coach-directory-table-wrap tbody a {
    color: #dce8e1 !important;
}

[data-theme="dark"] .coach-directory-table-wrap tbody .text-gray-500 {
    color: #8fa198 !important;
}

[data-theme="dark"] .coach-directory-pagination nav > * {
    border-color: var(--coach-border-strong) !important;
    color: #a5b6ad !important;
    background: #101d17 !important;
}

[data-theme="dark"] .coach-directory-pagination nav > span.border-green-500 {
    border-color: #34d399 !important;
    color: #9af2c8 !important;
    background: #143526 !important;
}

[data-theme="dark"] .coach-profile-photo,
[data-theme="dark"] .coach-profile-monogram {
    border-color: rgba(207, 229, 218, .2);
    background: #eef5f1;
}

[data-theme="dark"] .coach-profile-monogram {
    color: #087a55;
}

[data-theme="dark"] .coach-profile-current-team > span {
    color: #95a89e;
}

[data-theme="dark"] .coach-profile-panel > header > span {
    color: #8cf0c2;
    background: rgba(52, 211, 153, .11);
}

[data-theme="dark"] .coach-profile-prose,
[data-theme="dark"] .coach-profile-prose p,
[data-theme="dark"] .coach-profile-prose li {
    color: #b5c5bd !important;
}

[data-theme="dark"] .coach-profile-prose strong,
[data-theme="dark"] .coach-profile-prose h2,
[data-theme="dark"] .coach-profile-prose h3 {
    color: #e6f0eb !important;
}

[data-theme="dark"] .coach-profile-team-card {
    border-color: var(--coach-border);
    background: #0c1813;
}

[data-theme="dark"] .coach-profile-team-logo {
    border-color: #30463a;
    background: rgba(255, 255, 255, .92);
}

[data-theme="dark"] .coach-profile-fixtures-body > div.divide-y > div:hover {
    background: #13281e !important;
}

[data-theme="dark"] .coach-profile-fixtures-body .text-gray-900,
[data-theme="dark"] .coach-profile-fixtures-body a.text-gray-900 {
    color: #dce8e1 !important;
}

[data-theme="dark"] .coach-profile-fixtures-body .text-gray-500,
[data-theme="dark"] .coach-profile-fixtures-body .text-gray-600,
[data-theme="dark"] .coach-profile-fixtures-body .text-gray-700 {
    color: #91a39a !important;
}

[data-theme="dark"] .coach-profile-fixtures-body .bg-gray-50,
[data-theme="dark"] .coach-profile-fixtures-body .bg-gray-100 {
    background: #14261d !important;
}

@media (max-width: 767px) {
    .coach-directory-hero-inner {
        min-height: 0;
        padding: 1.55rem 1rem 1.7rem;
    }

    .coach-directory-hero h1 {
        font-size: 2rem;
    }

    .coach-directory-hero p {
        margin-top: .65rem;
        font-size: .82rem;
        line-height: 1.55;
    }

    .coach-directory-hero-mark {
        display: none;
    }

    .coach-directory-shell,
    .coach-profile-shell {
        padding: .75rem .6rem 5.5rem;
    }

    .coach-directory-toolbar {
        min-height: 0;
        align-items: stretch;
        flex-direction: column;
        padding: .75rem;
    }

    .coach-directory-filter {
        width: 100%;
    }

    .coach-directory-table-wrap table {
        min-width: 690px;
    }

    .coach-directory-table-wrap thead th:first-child,
    .coach-directory-table-wrap tbody td:first-child {
        width: 12rem;
        min-width: 12rem;
        max-width: 12rem;
    }

    .coach-directory-table-wrap tbody td {
        height: 3.6rem;
        padding: .45rem .75rem !important;
    }

    .coach-directory-pagination {
        padding: .8rem .65rem !important;
    }

    .coach-directory-pagination nav > * {
        min-width: 2rem;
        min-height: 2rem;
        padding: .4rem .55rem !important;
    }

    .coach-profile-hero-inner {
        min-height: 0;
        padding: 1rem 1rem 1.55rem;
    }

    .coach-profile-back {
        margin-bottom: 1rem;
    }

    .coach-profile-identity,
    .coach-profile-identity--no-photo {
        grid-template-columns: auto minmax(0, 1fr);
        gap: .85rem;
        align-items: start;
    }

    .coach-profile-identity--no-photo {
        grid-template-columns: minmax(0, 1fr);
    }

    .coach-profile-photo,
    .coach-profile-monogram {
        width: 4.5rem;
        height: 4.5rem;
    }

    .coach-profile-heading h1 {
        font-size: clamp(1.65rem, 8vw, 2.15rem);
        line-height: 1.05;
    }

    .coach-profile-kicker {
        margin-bottom: .35rem;
        font-size: .58rem;
    }

    .coach-profile-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: .35rem;
        margin-top: .65rem;
        font-size: .68rem;
    }

    .coach-profile-current-team {
        min-width: 0;
        grid-column: 1 / -1;
        padding: .7rem .8rem;
    }

    .coach-profile-current-team > span {
        margin-bottom: .4rem;
    }

    .coach-profile-current-team img {
        width: 1.65rem;
        height: 1.65rem;
    }

    .coach-profile-panel > header {
        min-height: 3.3rem;
        padding: .72rem .8rem;
    }

    .coach-profile-prose,
    .coach-profile-history-body,
    .coach-profile-fixtures-body {
        padding: .8rem;
    }

    .coach-profile-team-grid,
    .coach-profile-fixtures-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .coach-profile-team-card {
        min-height: 5.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .coach-directory *,
    .coach-profile * {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
