/**
 * dsprodirectory.css — Phase 10, task 10.3
 *
 * Styles for the Professional Directory module (PS 8 Classic / Bootstrap 4).
 * All selectors are prefixed with .dspro- to avoid conflicts with the Classic theme.
 * No !important is used; specificity is kept low and compatible with Bootstrap overrides.
 *
 * Sections:
 *   1. Banner (consent / profile-status)
 *   2. Persuasion modal
 *   3. Directory page (search form + results)
 *   4. Result cards
 *   5. Contact panel (reveal — phone + email direct links)
 *   6. Account block (My Account page)
 *   7. Profile form (injected dynamically)
 *   8. Utility / shared
 *
 * @author Borja P.
 */

/* =============================================================================
 * 1. BANNER — consent, warning, success variants
 * ============================================================================= */

/*
 * NOTE: the banner is injected by JS (injectBannerFromTemplate) as the first child
 * of #wrapper or another full-width container, so it already spans the full content
 * width. We use width:100% (not the 100vw negative-margin trick) to avoid horizontal
 * overflow/scrollbars when the container has overflow:hidden or a fixed width.
 * On themes with a coloured header (this shop's header is red with white text), we
 * FORCE the banner's own background + text colours with !important — scoped strictly
 * to .dspro-banner. This is a deliberate exception to the "no !important" rule.
 */

.dspro-banner {
    box-sizing: border-box;
    /* Span the full width of the injected container (typically #wrapper). */
    position: relative;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding: 0;
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0;             /* full-width top strip, not a floating card */
    text-align: left;
    background-color: #e8f4fd !important;
    color: #1a3a5c !important;
}

.dspro-banner__inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0.9rem 1.25rem;
}

/* Force readable text regardless of the theme header's colour rules. */
.dspro-banner .dspro-banner__title,
.dspro-banner .dspro-banner__body,
.dspro-banner .dspro-banner__legal {
    color: inherit !important;
    text-shadow: none !important;
}

.dspro-banner__title {
    font-weight: 700;
    margin: 0 0 0.3rem;
    font-size: 1.05rem;
    line-height: 1.3;
}

.dspro-banner__body {
    margin: 0 0 0.3rem;
    font-size: 0.9rem;
    line-height: 1.45;
    max-width: 80ch;
}

.dspro-banner__legal {
    margin: 0 0 0.75rem;
    font-size: 0.78rem;
    opacity: 0.75;
}

.dspro-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

/* Consent variant (no_preguntado / rechazo_blando) — light brand red (was blue) */
.dspro-banner--consent {
    background-color: #ffeaec !important;
    border-bottom-color: #ffc7cc !important;
    color: #c20f1a !important;
}

/* Re-consent variant (accepted pro, outdated consent version) */
.dspro-banner--reconsent {
    background-color: #fff3e0 !important;
    border-bottom-color: #ffcc80;
    color: #5d4037 !important;
}

/* Warning variant (aceptado + profile incomplete) */
.dspro-banner--warning {
    background-color: #fff8e1 !important;
    border-bottom-color: #ffe082;
    color: #5d4037 !important;
}

/* Success variant (aceptado + profile complete) */
.dspro-banner--success {
    background-color: #f1f8e9 !important;
    border-bottom-color: #aed581;
    color: #2e5f1a !important;
}

/* Force readable dark text via high specificity (id + classes) so a coloured theme
   header cannot override the banner copy with white text. */
#dspro-consent-banner.dspro-banner .dspro-banner__inner p,
#dspro-profile-notice.dspro-banner .dspro-banner__inner p,
#dspro-manage-notice.dspro-banner .dspro-banner__inner p {
    color: #2b2b2b !important;
    text-shadow: none !important;
}

/* Inline error notice appended dynamically by JS */
.dspro-banner-error {
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

/* =============================================================================
 * 2. PERSUASION MODAL
 * ============================================================================= */

.dspro-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9050;
    /* Hidden by default; shown via .dspro-modal--visible */
}

.dspro-modal.dspro-modal--visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dspro-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.55);
    cursor: pointer;
}

.dspro-modal__dialog {
    position: relative;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    max-width: 460px;
    width: 90%;
    padding: 2rem;
    z-index: 1;
}

.dspro-modal__title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #1a1a2e;
}

.dspro-modal__body {
    font-size: 0.9375rem;
    color: #444;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.dspro-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dspro-modal__actions .btn {
    width: 100%;
}

@media (min-width: 480px) {
    .dspro-modal__actions {
        flex-direction: row;
        justify-content: flex-end;
    }
    .dspro-modal__actions .btn {
        width: auto;
    }
}

/* =============================================================================
 * 3. DIRECTORY PAGE — search panel
 * ============================================================================= */

.dspro-directory {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

.dspro-search-panel {
    max-width: 620px;
    margin-bottom: 2rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.dspro-search-panel .card-body {
    padding: 1.5rem;
}

.dspro-search-panel__title {
    margin-bottom: 0.375rem;
    color: #1a1a2e;
}

.dspro-search-panel__subtitle {
    color: #6c757d;
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
}

.dspro-turnstile-wrapper {
    margin-bottom: 1rem;
}

/* Results header */
.dspro-results-title {
    color: #1a1a2e;
}

.dspro-results-title .badge {
    font-size: 0.875rem;
    vertical-align: middle;
    margin-left: 0.375rem;
}

/* =============================================================================
 * 3b. SPLIT-SCREEN LAYOUT (widget) — sticky form left, branded intro/results right
 *
 * Authoritative copy of these rules is also inlined in Dsprodirectory::getFrontInlineStyle()
 * so the layout is immune to CCC/JS cache. Keep both in sync. Brand red: #ff2330.
 * ============================================================================= */

.dspro-split {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
}

.dspro-split__left {
    flex: 1 1 320px;
    max-width: 420px;
    position: sticky;
    top: 1rem;
}

.dspro-split__right {
    flex: 1.4 1 380px;
    min-width: 0;
}

@media (max-width: 991px) {
    .dspro-split__left {
        position: static;
        max-width: none;
        flex-basis: 100%;
    }
    .dspro-split__right {
        flex-basis: 100%;
    }
}

/* Left: search card */
.dspro-search-card {
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.dspro-search-card__title {
    font-weight: 800;
    font-size: 1.3rem;
    line-height: 1.25;
    margin: 0 0 0.4rem;
    color: #1a1a2e;
}

.dspro-search-card__subtitle {
    color: #6c757d;
    font-size: 0.92rem;
    margin: 0 0 1.25rem;
    line-height: 1.45;
}

.dspro-search-card label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
    margin-bottom: 0.3rem;
    display: block;
}

.dspro-search-card .form-control {
    border-radius: 10px;
}

.dspro-search-card #dspro-search-btn {
    width: 100%;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font-weight: 700;
}

/* Right: branded value-prop intro panel (hidden once results render) */
.dspro-intro {
    background: linear-gradient(160deg, #ff2330 0%, #c20f1a 100%);
    color: #fff;
    border-radius: 16px;
    padding: 2.25rem;
    box-shadow: 0 16px 40px rgba(255, 35, 48, 0.24);
}

.dspro-intro__headline {
    color: #fff;
    font-weight: 800;
    font-size: 1.5rem;
    line-height: 1.22;
    margin: 0 0 1.6rem;
}

.dspro-feature-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.dspro-feature {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin: 0;
}

.dspro-feature__icon {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.dspro-feature__icon svg {
    width: 22px;
    height: 22px;
}

.dspro-feature__title {
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    margin: 0 0 0.25rem;
}

.dspro-feature__text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1.45;
    margin: 0;
}

/* Interactive Spain province map card (front directory) */
.dspro-map-card {
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 16px;
    padding: 1.25rem 1.25rem 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
}

.dspro-map-card__title {
    font-weight: 800;
    font-size: 1.1rem;
    margin: 0 0 0.75rem;
    color: #1a1a2e;
}

.dspro-map {
    width: 100%;
    height: 400px;
}

/* ── Front layout v2: hero band → tools (form + map) → results.
 * Authoritative copy is inlined in Dsprodirectory::getFrontInlineStyle() (cache-proof).
 * Keep both in sync. ── */
.dspro-hero {
    background: linear-gradient(135deg, #ff2330 0%, #c20f1a 100%);
    color: #fff;
    border-radius: 16px;
    padding: 1.4rem 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 14px 36px rgba(255, 35, 48, 0.22);
}

.dspro-hero__title {
    color: #fff;
    font-weight: 800;
    font-size: 1.35rem;
    line-height: 1.2;
    margin: 0 0 1.1rem;
}

.dspro-hero__features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem 1.4rem;
}

.dspro-hero__feature {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    margin: 0;
}

.dspro-hero__icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.dspro-hero__icon svg {
    width: 18px;
    height: 18px;
}

.dspro-hero__ftitle {
    display: block;
    color: #fff;
    font-weight: 700;
    font-size: 0.92rem;
    line-height: 1.2;
}

.dspro-hero__ftext {
    display: block;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    line-height: 1.25;
    margin-top: 0.12rem;
}

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

@media (max-width: 479px) {
    .dspro-hero__features { grid-template-columns: 1fr; }
}

.dspro-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.dspro-tools__form {
    flex: 1 1 300px;
    max-width: 380px;
}

.dspro-tools__map {
    flex: 1.7 1 380px;
    min-width: 0;
}

@media (max-width: 991px) {
    .dspro-tools__form { max-width: none; flex-basis: 100%; }
    .dspro-tools__map { flex-basis: 100%; }
}

.dspro-results-zone {
    clear: both;
}

.dspro-map-card__hint {
    font-size: 0.85rem;
    color: #777;
    margin: 0.6rem 0 0;
    text-align: center;
}

/* =============================================================================
 * 4. RESULT CARDS
 * ============================================================================= */

.dspro-results-list {
    /* row class handles flex layout; gap provided by mb-4 on each card */
}

.dspro-card {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    transition: box-shadow 0.15s ease;
}

.dspro-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

/* Featured card — gold/amber border + tinted background + elevated shadow */
.dspro-card--featured {
    border: 2px solid #ffce3a;
    background-color: #fffdf0;
    box-shadow: 0 4px 14px rgba(184, 134, 11, 0.18);
}

.dspro-card--featured:hover {
    box-shadow: 0 8px 24px rgba(184, 134, 11, 0.28);
}

/* Featured badge — small amber pill shown next to the professional's name */
.dspro-badge-featured {
    display: inline-block;
    background-color: #ffce3a;
    color: #7a5700;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15em 0.5em;
    border-radius: 3px;
    margin-left: 0.4rem;
    vertical-align: middle;
}

/* "Nuevo" badge (≤30 days) + category chips + category checkboxes + radius selector.
 * Authoritative copies are inlined in Dsprodirectory::getFrontInlineStyle(). Keep in sync. */
.dspro-badge-new {
    display: inline-block;
    background-color: #1aa64b;
    color: #fff;
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.18em 0.55em;
    border-radius: 5px;
    margin-left: 0.45rem;
    vertical-align: middle;
}

.dspro-card__cats { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0 0 0.5rem; }
.dspro-cat-chip {
    display: inline-block;
    background: #fff0f1;
    color: #c20f1a;
    border: 1px solid #ffc7cc;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.12em 0.55em;
    border-radius: 999px;
}

.dspro-cat-filter, .dspro-cat-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.dspro-cat-check {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid #e2e2e2;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
    cursor: pointer;
    margin: 0;
    background: #fff;
    transition: border-color 0.12s, background 0.12s;
}
.dspro-cat-check.is-selected { border-color: #ff2330; background: #fff0f1; color: #c20f1a; font-weight: 600; }
.dspro-cat-check input { margin: 0; }

.dspro-radius-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; }
.dspro-radius-opt {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    border: 1px solid #e2e2e2;
    border-radius: 12px;
    padding: 0.6rem 0.4rem;
    cursor: pointer;
    text-align: center;
    margin: 0;
    background: #fff;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.dspro-radius-opt.is-selected { border-color: #ff2330; box-shadow: 0 0 0 2px rgba(255, 35, 48, 0.15); }
.dspro-radius-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.dspro-radius-svg { width: 54px; height: 54px; }
.dspro-radius-km { font-weight: 700; font-size: 0.9rem; color: #1a1a2e; }
.dspro-radius-desc { font-size: 0.72rem; color: #777; line-height: 1.2; }
@media (max-width: 560px) { .dspro-radius-grid { grid-template-columns: repeat(2, 1fr); } }

.dspro-card__name {
    color: #1a1a2e;
    margin-bottom: 0.25rem;
    font-size: 1.0625rem;
}

.dspro-card__location {
    font-size: 0.8125rem;
    margin-bottom: 0.375rem;
}

.dspro-card__specialty {
    font-size: 0.875rem;
    color: #555;
    margin-bottom: 0.375rem;
}

.dspro-card__description {
    font-size: 0.875rem;
    color: #444;
    margin-bottom: 0.5rem;
    /* Clamp long descriptions to keep cards uniform */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dspro-card-error {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

/* =============================================================================
 * 5. CONTACT PANEL — revealed phone + email (direct contact links)
 * ============================================================================= */

.dspro-contact-panel {
    padding-top: 0.75rem;
    border-top: 1px solid #dee2e6;
}

.dspro-contact-phone,
.dspro-contact-email {
    font-size: 0.9375rem;
    margin-bottom: 0.375rem;
}

.dspro-phone-link,
.dspro-email-link {
    font-weight: 600;
    color: #007bff;
    text-decoration: none;
}

.dspro-phone-link:hover,
.dspro-email-link:hover {
    text-decoration: underline;
}

/* =============================================================================
 * 6. ACCOUNT BLOCK — professional + client + order confirmation
 * ============================================================================= */

.dspro-account-block {
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background-color: #fafafa;
}

.dspro-block-title {
    font-size: 1.0625rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #1a1a2e;
}

.dspro-professional-block .dspro-status-indicator {
    margin-bottom: 0.5rem;
}

.dspro-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.dspro-order-confirmation-block p {
    color: #555;
    font-size: 0.9375rem;
    margin-bottom: 0.75rem;
}

/* Client CTA banner — My Account (relocated to the top by dsprodirectory.js).
 * Authoritative copy also inlined in Dsprodirectory::getFrontInlineStyle(). Keep in sync. */
.dspro-client-block {
    margin: 0 0 1.5rem;
    border: 0;
    background: transparent;
    padding: 0;
}

.dspro-order-confirmation-block {
    margin: 1.5rem 0;
}

/* Gate messages (visitor not logged / no purchase) — light brand red */
.dspro-directory--gate {
    padding: 1.5rem 0;
}

.dspro-gate-msg {
    background: #ffeaec;
    border: 1px solid #ffc7cc;
    color: #c20f1a;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 0 1rem;
}

.dspro-directory--gate .btn {
    border-radius: 10px;
    font-weight: 700;
}

.dspro-client-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
    background: linear-gradient(135deg, #ff2330 0%, #c20f1a 100%);
    color: #fff;
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 10px 28px rgba(255, 35, 48, 0.22);
}

.dspro-client-cta__title {
    color: #fff;
    font-weight: 800;
    font-size: 1.2rem;
    margin: 0 0 0.2rem;
}

.dspro-client-cta__sub {
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.92rem;
    margin: 0;
    line-height: 1.4;
}

.dspro-client-cta__btn {
    flex: 0 0 auto;
    background: #fff;
    color: #ff2330;
    font-weight: 700;
    border-radius: 10px;
    padding: 0.7rem 1.4rem;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.dspro-client-cta__btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    color: #c20f1a;
    text-decoration: none;
}

@media (max-width: 575px) {
    .dspro-client-cta {
        flex-direction: column;
        align-items: flex-start;
    }
    .dspro-client-cta__btn {
        width: 100%;
        text-align: center;
    }
}

/* =============================================================================
 * 7. PROFILE FORM (injected into #dspro-profile-form-container)
 * ============================================================================= */

.dspro-profile-form-wrapper {
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
    margin-top: 1rem;
}

#dspro-profile-form .form-group {
    margin-bottom: 1rem;
}

#dspro-profile-form label {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

#dspro-profile-form .form-text {
    font-size: 0.8rem;
}

.dspro-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.dspro-form-error {
    font-size: 0.875rem;
}

/* =============================================================================
 * 8. UTILITY / SHARED
 * ============================================================================= */

/* Hide utility — toggled by JS */
[style*="display:none"] {
    /* no override needed; let inline style win */
}

/* Spinner animation placeholder (used if loading state is added in future) */
@keyframes dspro-spin {
    to { transform: rotate(360deg); }
}

/* Responsive: on small screens, stack banner actions vertically */
@media (max-width: 575.98px) {
    .dspro-banner__actions {
        flex-direction: column;
    }
    .dspro-banner__actions .btn {
        width: 100%;
    }
    .dspro-action-buttons {
        flex-direction: column;
    }
    .dspro-action-buttons .btn {
        width: 100%;
    }
}
