/**
 * Athlete & Coach Finder Page Styles
 *
 * Loaded on: single-athletes.php (athlete profile pages)
 *            page-templates/coach-finder-templete.php
 * Depends on: main.css (--primary-color, --text-dark, --text-light,
 *             --bg-light, --border-color, --font-primary, etc. are inherited)
 */

/* =============================================================================
   Local CSS Variables
   Athlete profile pages use a teal/ocean palette that is distinct from the
   site-wide orange brand colour. Defining them here avoids scattering raw hex
   values throughout the file and makes future rebranding a single-line change.
   ============================================================================= */

:root {
    --athlete-card-bg:       linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(250, 250, 250, 0.9));
    --athlete-card-shadow:   0 8px 30px rgba(21, 32, 43, 0.08);
    --athlete-name:          #0b2b40;
    --athlete-role:          #2f5461;
    --athlete-body:          #3b4f56;
    --athlete-muted:         #6b8790;
    --athlete-value:         #102630;
    --athlete-accent:        #0d6b5a;
    --athlete-accent-hover:  #118ab2;
    --athlete-attr-bg:       #eef6f2;
    --athlete-attr-text:     #0b5b45;
    --athlete-btn-border:    #dbeff5;
    --athlete-btn-text:      #0b3b45;
}

/* =============================================================================
   Athlete Profile Layout
   ============================================================================= */

.athlete-page {
    padding: 48px 0;
    display: block;
}

/* Profile card and achievements section share the same card treatment */
.profile-card,
.achievements-section {
    background: var(--athlete-card-bg);
    border-radius: 14px;
    padding: 28px;
    box-shadow: var(--athlete-card-shadow);
    overflow: hidden;
}

.profile-card {
    display: flex;
    gap: 60px;
    align-items: center;
}

.achievements-section {
    margin-top: 20px;
    align-items: center;
}

.achievements-section p {
    padding: 10px 0;
}

.achievements-content {
    display: block;
}

.achievements-text {
    margin-bottom: 20px;
}

/* =============================================================================
   Profile Media (Avatar Column)
   ============================================================================= */

.profile-media {
    flex: 0 0 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.avatar {
    width: 350px;
    height: 350px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    box-shadow: 0 12px 40px rgba(16, 24, 40, 0.15);
    /* Colourful ring via conic-gradient border trick */
    border: 8px solid transparent;
    background: conic-gradient(from 180deg at 50% 50%, #ffd166, #ef476f, #06d6a0, #118ab2);
    padding: 4px;
}

/* Larger variant when the avatar sits inside the dedicated media column */
.profile-media .avatar {
    width: 400px;
    height: 400px;
}

/* The <img> that sits inside the .avatar circular frame */
.avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    object-fit: cover;
    display: block;
}

.badge {
    position: absolute;
    left: 20px;
    bottom: 18px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* =============================================================================
   Profile Body (Text Column)
   ============================================================================= */

.profile-body {
    flex: 1 1 auto;
    min-width: 220px;
}

.profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 10px;
}

.athlete-name {
    margin: 0 0 6px;
    font-size: 28px;
    line-height: 1.05;
    font-weight: 700;
    color: var(--athlete-name);
}

.athlete-role {
    margin: 0;
    color: var(--athlete-role);
    font-weight: 600;
    opacity: 0.9;
}

.bio {
    margin: 14px 0 18px;
    color: var(--athlete-body);
    font-size: 15px;
    line-height: 1.6;
}

/* =============================================================================
   Stats Grid & Attribute Pills
   ============================================================================= */

.stats-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.stat {
    background: #fff;
    border-radius: 10px;
    padding: 12px 14px;
    min-width: 110px;
    box-shadow: 0 4px 18px rgba(12, 34, 56, 0.06);
    text-align: center;
}

.stat .label {
    display: block;
    color: var(--athlete-muted);
    font-size: 12px;
}

.stat .value {
    font-weight: 700;
    font-size: 16px;
    color: var(--athlete-value);
}

.attributes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.attribute {
    background: var(--athlete-attr-bg);
    color: var(--athlete-attr-text);
    padding: 8px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 13px;
}

/* =============================================================================
   CTA Row & Inline Buttons
   ============================================================================= */

.cta-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Locally scoped .btn-primary / .btn-ghost variants for the athlete profile.
   These do not conflict with WooCommerce or the site-wide button styles. */
.cta-row .btn-primary {
    background: var(--athlete-accent);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    cursor: pointer;
}

.cta-row .btn-ghost {
    background: transparent;
    border: 2px solid var(--athlete-btn-border);
    padding: 8px 14px;
    border-radius: 8px;
    color: var(--athlete-btn-text);
    cursor: pointer;
}

/* =============================================================================
   Social Links (inside profile header)
   ============================================================================= */

.profile-header .social-links {
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--athlete-accent);
}

.profile-header .social-links .social-link {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    color: inherit;
    text-decoration: none;
}

.profile-header .social-links svg {
    width: 20px;
    height: 20px;
    display: block;
}

.profile-header .social-links .social-link:hover {
    color: var(--athlete-accent-hover);
    background: none;
    border: 1px solid #ccc;
    transform: translateY(-2px);
    transition: color 0.15s ease, transform 0.15s ease;
}

/* =============================================================================
   Website Link
   ============================================================================= */

.website-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--athlete-accent);
    text-decoration: none;
    padding: 8px 12px;
    border: 1px solid var(--athlete-accent);
    border-radius: 6px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.website-link:hover {
    background-color: var(--athlete-accent);
    color: #fff;
}

.website-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* =============================================================================
   Showcase Gallery & Lightbox
   ============================================================================= */

.showcase-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 100%;
    box-sizing: border-box;
}

.showcase-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    object-position: center;
    border-radius: 12px;
    display: block;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.showcase-image:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    visibility: visible;
    opacity: 1;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
}

/* =============================================================================
   Recommended Products Section
   ============================================================================= */

.recommended-products-section {
    margin-top: 40px;
    background: var(--athlete-card-bg);
    border-radius: 14px;
    padding: 32px;
    box-shadow: var(--athlete-card-shadow);
}

.recommended-products-section h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 8px;
    text-align: center;
}

.recommended-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 16px;
    margin: 0 0 32px;
}

/* Make product cards fill height evenly in the grid */
.recommended-products-section .product-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.recommended-products-section .product-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Override WooCommerce float layout with a CSS grid */
.recommended-products-section ul.products {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    gap: 24px !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    float: none !important;
}

.recommended-products-section ul.products::before,
.recommended-products-section ul.products::after {
    content: none !important;
    display: none !important;
}

.recommended-products-section ul.products li.product {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    float: none !important;
    clear: none !important;
}

/* Hide the "View basket" link WooCommerce appends after AJAX add-to-cart */
.recommended-products-section ul.products li.product a.added_to_cart.wc-forward {
    display: none !important;
}

/* Show a checkmark on the Add to Basket button once a product has been added.
   Uses a plain Unicode tick — works even though woocommerce-general.css (which
   embeds the WooCommerce icon font) is dequeued on non-WooCommerce pages. */
.recommended-products-section ul.products li.product a.button.added::after {
    font-family: inherit !important;
    content: " ✓" !important;
    margin-left: 0 !important;
    vertical-align: middle !important;
}

/* =============================================================================
   Get-Started Modal (Coach Finder)
   ============================================================================= */

.gs-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gs-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.gs-modal__dialog {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 8px;
    padding: 40px 32px 32px;
    width: 95%;
    max-width: 860px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
}

.gs-modal__close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #555;
    padding: 0 4px;
}

.gs-modal__close:hover {
    color: #000;
}

.gs-modal__title {
    margin: 0 0 20px;
    font-size: 1.5rem;
}

/* =============================================================================
   Coach Finder Page Layout
   ============================================================================= */

.coach-finder-section {
    background: var(--bg-light);
    padding: 48px 0 80px;
}

.coach-finder-header {
    text-align: center;
    margin-bottom: 32px;
}

.coach-finder-header h1 {
    font-size: 42px;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0 0 10px;
}

.coach-finder-header p {
    font-size: 16px;
    color: var(--text-light);
    margin: 0;
}

/* CTA Banner */
.coach-cta-banner {
    background: var(--primary-color);
    border-radius: 10px;
    padding: 16px 24px;
    margin-bottom: 24px;
}

.coach-cta-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.coach-cta-banner-text {
    color: white;
    font-size: 15px;
}

.coach-cta-banner-text strong {
    font-weight: 700;
}

.coach-cta-banner-btn {
    background: transparent;
    border: 2px solid white;
    color: white;
    padding: 10px 24px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}

.coach-cta-banner-btn:hover {
    background: white;
    color: var(--primary-color);
}

/* Search & Filter Bar */
.coach-search-filter {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 32px;
    overflow: hidden;
}

.coach-search-toggle {
    display: none;
    width: 100%;
    background: none;
    border: none;
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    align-items: center;
    gap: 10px;
    text-align: left;
    font-family: var(--font-primary);
}

.coach-search-filter-content {
    padding: 20px;
}

.coach-search-box {
    position: relative;
    margin-bottom: 16px;
}

.coach-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.coach-search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: var(--font-primary);
}

.coach-search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.coach-search-input::placeholder {
    color: #bbb;
}

.coach-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 18px;
    border-radius: 25px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: var(--font-primary);
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

/* Results Count */
.results-count {
    font-size: 15px;
    color: var(--text-dark);
    font-weight: 500;
    margin-bottom: 24px;
}

.results-count #resultsCount {
    color: var(--primary-color);
    font-weight: 700;
}

/* Coach Grid */
.coach-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

/* Coach Card */
.coach-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.coach-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
    border-color: transparent;
}

.coach-card.hidden {
    display: none;
}

.coach-image {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--bg-light);
}

.coach-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}

.coach-card:hover .coach-image img {
    transform: scale(1.05);
}

.coach-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.coach-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 4px;
}

.coach-title {
    font-size: 13px;
    color: var(--text-light);
    margin: 0 0 12px;
}

.coach-specialties {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    max-height: calc((1em + 8px + 6px) * 2); /* Cap at 2 rows of tags */
    overflow: hidden;
}

.specialty-tag {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 999px;
    background: #e8f5e9;
    color: #2e7d32;
}

.coach-bio {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
    margin: 0 0 16px;
    min-height: calc(1.5em * 4); /* Reserve exactly 4 lines */
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.coach-cta-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: background 0.3s ease;
    font-family: var(--font-primary);
    margin-top: auto;
}

.coach-cta-btn:hover {
    background: var(--primary-dark);
}

/* =============================================================================
   Coach Finder — Join Our Community CTA Section
   ============================================================================= */

.coach-cta-section {
    margin-top: 60px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #ff8c42 100%);
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Decorative background circles */
.coach-cta-section::before,
.coach-cta-section::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.coach-cta-section::before {
    width: 280px;
    height: 280px;
    bottom: -80px;
    left: -60px;
}

.coach-cta-section::after {
    width: 200px;
    height: 200px;
    top: -60px;
    right: -40px;
}

.coach-cta-content {
    position: relative;
    z-index: 1;
    max-width: 640px;
    margin: 0 auto;
}

.coach-cta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    margin-bottom: 24px;
    color: white;
}

.coach-cta-content h2 {
    font-size: 32px;
    font-weight: 800;
    color: white;
    margin: 0 0 16px;
    line-height: 1.2;
}

.coach-cta-content p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    margin: 0 0 32px;
}

.coach-cta-get-started {
    display: inline-block;
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-primary);
}

.coach-cta-get-started:hover {
    background: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* =============================================================================
   Athlete Contact Form (WPForms 10937)
   Match the compact form style used directly below the shortcode.
   ============================================================================= */

.athlete-page #contactForm .wpforms-container {
    margin: 0;
}

.athlete-page #contactForm .wpforms-form {
    margin: 0;
}

.athlete-page #contactForm .wpforms-field-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.athlete-page #contactForm .wpforms-field {
    width: 100%;
    margin: 0;
    padding: 0;
}

.athlete-page #contactForm .coach_form_name,
.athlete-page #contactForm .coach_form_email {
    flex: 1 1 calc(50% - 4px);
    min-width: 200px;
}

.athlete-page #contactForm .coach_form_subject,
.athlete-page #contactForm .coach_form_message {
    flex: 1 1 100%;
}

/* Keep the honeypot fields hidden if plugin defaults are overridden elsewhere. */
.athlete-page #contactForm [aria-hidden="true"] {
    display: none !important;
}

.athlete-page #contactForm .wpforms-field-label {
    display: block;
    margin: 0 0 6px;
    color: #536b71;
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.athlete-page #contactForm .wpforms-field input[type="text"],
.athlete-page #contactForm .wpforms-field input[type="email"],
.athlete-page #contactForm .wpforms-field textarea {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e6eef0;
    background: #fff;
    box-shadow: none;
    color: var(--text-dark);
    font-family: var(--font-primary);
    font-size: 14px;
    line-height: 1.4;
}

.athlete-page #contactForm .wpforms-field textarea {
    min-height: 120px;
    resize: vertical;
}

.athlete-page #contactForm .wpforms-field input:focus,
.athlete-page #contactForm .wpforms-field textarea:focus {
    outline: none;
    border-color: #d3e6ea;
}

.athlete-page #contactForm .wpforms-submit-container {
    margin-top: 12px;
}

.athlete-page #contactForm .wpforms-submit {
    min-height: 50px;
    padding: 13px 28px;
    border: none;
    border-radius: 10px;
    background: var(--primary-color);
    color: #fff;
    font-family: var(--font-primary);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.athlete-page #contactForm .wpforms-submit:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 1200px) {
    .recommended-products-section ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 1024px) {
    .coach-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* At 900px the profile card stacks vertically — reduce avatar to fit */
@media (max-width: 900px) {
    .profile-card {
        flex-direction: column;
        gap: 20px;
        padding: 22px;
    }

    .profile-media {
        flex-basis: unset;
    }

    /* ".profile-media .avatar" has higher specificity than ".avatar", so both
       selectors are listed here to ensure the size is reduced at this breakpoint. */
    .avatar,
    .profile-media .avatar {
        width: 200px;
        height: 200px;
    }

    .athlete-name {
        font-size: 22px;
    }
}

@media (max-width: 768px) {
    .achievements-section .showcase-gallery {
        grid-template-columns: 1fr;
    }

    .achievements-section .showcase-image {
        height: 220px;
    }

    .coach-finder-header h1 {
        font-size: 30px;
    }

    .coach-cta-banner-content {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .coach-cta-section {
        padding: 48px 24px;
    }

    .coach-cta-content h2 {
        font-size: 24px;
    }

    .coach-search-toggle {
        display: flex;
    }

    .coach-search-filter-content {
        padding: 0 20px 20px;
        display: none;
    }

    .coach-search-filter-content.active {
        display: block;
    }

    .coach-filters {
        gap: 8px;
    }

    .filter-btn {
        font-size: 13px;
        padding: 7px 14px;
    }

    .athlete-page #contactForm .coach_form_name,
    .athlete-page #contactForm .coach_form_email {
        flex-basis: 100%;
        min-width: 0;
    }
}

@media (max-width: 640px) {
    .gs-modal__dialog {
        padding: 28px 16px 20px;
    }

    .recommended-products-section {
        padding: 24px 16px;
    }

    .recommended-products-section ul.products {
        grid-template-columns: 1fr !important;
        max-width: 400px !important;
        margin: 0 auto !important;
    }
}

@media (max-width: 600px) {
    .coach-grid {
        grid-template-columns: 1fr;
    }

    .coach-finder-section {
        padding: 32px 0 60px;
    }
}

@media (min-width: 1200px) {
    .recommended-products-section ul.products {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}
