/*
 * Responsive fixes for phones and laptops (CLAUDE.md 59).
 * Loaded last in layouts/user so these rules win over the older page styles.
 * Checked at 360 px (Samsung Galaxy A05s, the client's phone), 384 px (Galaxy A35),
 * 412 px and laptop sizes 1280-1920. Bump the ?v= token in layouts/user when this changes.
 */

/* ---------- Every page, every size ---------- */
/* Long names (e.g. "organizationtherapisttest") wrap instead of running out of their box. */
.personal-images h1, .tt-therapist-name, .tt-product-title, .tt-org-name, .therapist-name,
.therapist-section-title, .fagt-account-type, .card-title {
    overflow-wrap: anywhere;
}

/* ---------- Every page: phones ---------- */
@media (max-width: 767px) {
    /* Long names and words (e.g. "organizationtherapisttest") wrap instead of running off the screen. */
    h1, h2, h3, h4, h5, .section-title, .title-size, .tt-section-title, .tt-therapist-name,
    .tt-product-title, .therapist-section-title, .fgt-about-heading {
        overflow-wrap: anywhere;
        word-break: normal;
    }
    /* Section titles were wider than the screen and got cut on both sides. */
    .section-title.title-size, h2.section-title, .section-subtitle.category-title, h6.store-desc {
        max-width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        letter-spacing: normal;
    }
    /* A 145 px top margin left over from an old fixed header made a white band under the header. */
    .page-wrapper > .ak-bg:first-of-type,
    .page-wrapper > div.ak-bg {
        margin-top: 0 !important;
    }
    /* Language / currency button: smaller and parked bottom-left, above the bottom bar,
       so it no longer sits on top of names, photos and buttons. */
    .enhanced-lang-currency-selector {
        top: auto !important;
        bottom: 84px !important;
        left: 10px !important;
        transform: none !important;
    }
    .enhanced-toggle-btn {
        width: 46px !important;
        height: 46px !important;
        box-shadow: 0 3px 10px rgba(246, 122, 69, .35) !important;
    }
    .enhanced-toggle-btn:hover { transform: none !important; }
    .enhanced-toggle-icon { font-size: 15px !important; margin-bottom: 0 !important; }
    .enhanced-toggle-info { font-size: 7px !important; }
    .enhanced-panel {
        left: 0 !important;
        top: auto !important;
        bottom: 56px !important;
        width: min(330px, calc(100vw - 20px)) !important;
        max-height: min(450px, calc(100vh - 170px)) !important;
        transform: translateY(10px) !important;
    }
    .enhanced-panel.active { transform: translateY(0) !important; }
    /* Back-to-top button: smaller, so it covers less of the cards under it. */
    .ak-scrollup {
        width: 40px !important;
        height: 40px !important;
        right: 12px !important;
        bottom: 84px !important;
    }
    /* Justified text on a narrow column leaves big gaps between words. */
    p[style*="justify"], div[style*="justify"], .text-justify {
        text-align: left !important;
    }
}

/* ---------- Therapist / seller profile (/therapist/{id}) ---------- */
@media (max-width: 767px) {
    .page-wrapper > .container.text-center[style*="padding-top:132px"] {
        padding-top: 20px !important;
    }
    .doctor-profile {
        flex-direction: column;
        padding: 16px 0 !important;
    }
    .personal-images {
        flex-direction: column;
        align-items: center;
        text-align: center;
        width: 100%;
    }
    .personal-images > div[style*="75%"] {
        width: 100% !important;
    }
    .personal-images .doctor-img {
        margin: 0 auto 12px !important;
        width: 110px !important;
        height: 110px !important;
    }
    .personal-images h1 {
        font-size: 24px !important;
        line-height: 1.25 !important;
    }
    .therapist-section-title {
        font-size: 22px !important;
        line-height: 1.3 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .therapist-shadow-heading {
        display: none !important;
    }
    .therapist-section-heading {
        width: 100% !important;
    }
    /* Experience and FAQ cards sat inside an extra padded container and came out
       55 px narrower than the cards above them. */
    section.bottom-content { padding: 0 !important; }
    section.bottom-content > .container { padding: 0 !important; max-width: 100% !important; }
    section.bottom-content .content { gap: 16px !important; flex-direction: column; }
    section.bottom-content .content-box { width: 100% !important; max-width: 100% !important; flex: 1 1 auto !important; }
}

/* ---------- Organization page (/organizations-detail/{id}) ---------- */
@media (max-width: 767px) {
    /* The cover image carries text; show it whole instead of cropping it. */
    .tt-hero-image {
        height: auto !important;
        background: #fff;
    }
    .tt-hero-img {
        height: auto !important;
        max-height: 420px;
        object-fit: contain !important;
    }
    .tt-hero-image:hover .tt-hero-img { transform: none; }
    .tt-products-section {
        padding: 22px 14px !important;
    }
    .tt-section-title {
        font-size: 1.6rem !important;
        line-height: 1.25 !important;
    }
    .tt-section-icon { font-size: 1.6rem !important; }
    /* Featured therapists: one full-width card, arrows beside the photo, not on it. */
    .tt-product-card {
        min-width: 0 !important;
        width: 100% !important;
        padding: 18px 14px !important;
    }
    #ttorganization .swiper-slide { padding: 14px 4px !important; height: auto !important; }
    #ttorganization .swiper, #ttorganization .swiper-wrapper { height: auto !important; }
    .tt-product-card { height: auto !important; min-height: 0 !important; overflow: visible !important; }
    .tt-carousel-nav {
        width: 34px !important;
        height: 34px !important;
        top: 70px !important;
    }
    .tt-carousel-prev { left: 4px !important; }
    .tt-carousel-next { right: 4px !important; }
    /* Therapist list cards */
    .tt-therapist-card { padding: 18px 16px !important; }
    .tt-therapist-header { gap: 12px !important; }
    .tt-therapist-name { font-size: 1.15rem !important; line-height: 1.3 !important; }
    .tt-therapist-actions {
        flex-direction: column;
        gap: 10px !important;
    }
    .tt-therapist-actions .tt-btn {
        width: 100%;
        justify-content: center;
        white-space: nowrap;
    }
    /* About block: the 48 px padding plus a side column left a 195 px text column. */
    .tt-about-section { padding: 24px 16px !important; }
    .tt-about-content { flex-direction: column !important; gap: 16px !important; }
    .tt-about-text, .tt-about-features, .tt-stats { width: 100% !important; max-width: 100% !important; }
    .tt-about-features { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
    .tt-feature { min-width: 0 !important; padding: 10px 8px !important; gap: 8px !important; }
    .tt-feature-text { font-size: .82rem !important; overflow-wrap: anywhere; }
    .tt-stats { grid-template-columns: repeat(3, 1fr) !important; gap: 8px !important; }
    .tt-stat { padding: 12px 6px !important; }
    .tt-stat-number { font-size: 1.4rem !important; }
    .tt-stat-label { font-size: .78rem !important; }
    .tt-statsimage:empty { display: none !important; }
}

/* ---------- Community hub (/community) ---------- */
@media (max-width: 767px) {
    /* The filter bar was sticky and 320 px tall: it covered 40% of the phone screen while scrolling. */
    .global-nav { position: static !important; }
    .controls-bar { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 12px !important; }
    .controls-bar .filter-group { flex-wrap: wrap; gap: 8px !important; }
    .controls-bar .filter-group > div { flex: 1 1 calc(50% - 8px); }
    .controls-bar .filter-btn { width: 100%; justify-content: space-between; }
    .controls-bar .search-box { position: relative; margin: 0 !important; width: 100% !important; padding: 0 !important; }
    .controls-bar .search-box input { width: 100% !important; padding-left: 40px !important; margin: 0 !important; }
    .controls-bar .search-box i { position: absolute !important; left: 14px !important; top: 50% !important; transform: translateY(-50%) !important; z-index: 1; }
    .section-tabs { -webkit-overflow-scrolling: touch; scrollbar-width: none; }
}

/* ---------- About page ---------- */
@media (max-width: 767px) {
    /* "Join As A Practicing Therapist" inherited justified text and spread its words apart. */
    .fgt-about-button, .fgt-about-section a.fgt-about-button {
        text-align: center !important;
        justify-content: center;
    }
}

/* ---------- Sign-up pages (therapist and all seller types) ---------- */
/* FAQ questions ran under the round "+" icon; keep room for it on every line. */
.accordion .accordion-item button:has(> .icon) { padding-right: 34px !important; }
.accordion .accordion-item button:has(> .icon) .accordion-title { padding-right: 0 !important; }

/* ---------- Therapist listings (/therapists, /hypnotherapists) ---------- */
@media (max-width: 767px) {
    /* FAQ: 2 rem of padding on the card plus 2 rem on each question left a 200 px column. */
    .faq-section { padding: 1.25rem 1rem !important; margin: 1.5rem .75rem !important; }
    .faq-section h2 { font-size: 1.5rem !important; margin-bottom: 1.25rem !important; }
    .faq-section summary { padding: 1rem 1.1rem !important; gap: 10px; }
    .faq-section details > p { padding: 1.1rem !important; }
}
