/* ════════════════════════════════════════════════════════════
   Sanidalia Directorio - "Find your psychologist" quiz
   Every rule is scoped to .sani-match and prefixed sani-match__.
   Default theme: Psicodir (navy, lavender, warm cream, orange only
   for the main action). Re-theme by overriding the --sm-* variables.
   Contrast notes: navy on white/lavender/cream is > 7:1; the orange
   CTA carries dark text (> 5:1) because white on #eb672a is only 3.4:1.
   Mobile first.
   ════════════════════════════════════════════════════════════ */

.sani-match,
.sani-directorio.sani-match {
    --sm-primary:      var(--sani-primary, #094b7f);
    --sm-accent:       #094b7f;   /* brand navy: titles, selection, focus, secondary buttons */
    --sm-accent-dark:  #06375f;
    --sm-pale:         #dee3ff;   /* lavender */
    --sm-mid:          #b9c3f5;
    --sm-text:         #191919;
    --sm-muted:        #4a5361;
    --sm-border:       #cdd3ea;
    --sm-bg:           #fbf7f0;   /* warm cream */
    --sm-card:         #ffffff;
    --sm-cta:          #eb672a;   /* orange: main action only */
    --sm-cta-hover:    #ff8247;
    --sm-cta-text:     #191919;
    --sm-highlight:    #ffe258;   /* yellow: hand-picked emphasis */
    --sm-warn:         #8a1c00;
    --sm-radius:       14px;
    --sm-radius-lg:    22px;
    --sm-shadow:       0 6px 24px rgba(9,75,127,.08), 0 1px 3px rgba(9,75,127,.06);
    --sm-font:         'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    display: block;
    max-width: 44rem;
    margin: 0 auto;
    padding: 1.1rem 1rem 1.25rem;
    background: var(--sm-bg);
    border-radius: var(--sm-radius-lg);
    color: var(--sm-text);
    font-family: var(--sm-font);
    font-size: 1rem;
    line-height: 1.6;
}

.sani-match *,
.sani-match *::before,
.sani-match *::after { box-sizing: border-box; }
.sani-match button, .sani-match input, .sani-match textarea, .sani-match summary { font-family: var(--sm-font); }

.sani-match .sani-match__sr {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.sani-match .sani-match__stage { outline: none; }
.sani-match p { margin: 0 0 0.8rem; }
.sani-match ul { margin: 0; padding: 0; list-style: none; }
.sani-match li { margin: 0; padding: 0; }

/* Focus: visible ring on every interactive element */
.sani-match :focus-visible { outline: 3px solid var(--sm-accent); outline-offset: 3px; }
.sani-match .sani-match__stage :focus:not(:focus-visible) { outline: none; }

/* Headings */
.sani-match .sani-match__title { font-size: 1.35rem; line-height: 1.3; margin: 0.5rem 0 0.6rem; color: var(--sm-accent); font-weight: 700; letter-spacing: -0.01em; outline: none; text-wrap: balance; }
.sani-match .sani-match__h3 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 0.2rem; color: var(--sm-accent); font-weight: 700; }
.sani-match .sani-match__h4 { font-size: 0.9rem; margin: 0 0 0.45rem; color: var(--sm-accent); font-weight: 700; text-transform: none; letter-spacing: 0; }
.sani-match .sani-match__hint { color: var(--sm-muted); font-size: 0.95rem; margin: 0 0 1.1rem; }
.sani-match .sani-match__small { font-size: 0.875rem; line-height: 1.55; color: var(--sm-muted); }
.sani-match .sani-match__meta { color: var(--sm-muted); font-size: 0.9rem; line-height: 1.45; margin: 0; }

.sani-match .sani-match__card {
    background: var(--sm-card); border: 1px solid var(--sm-border); border-radius: var(--sm-radius-lg);
    padding: 1.15rem; margin-bottom: 1rem; box-shadow: var(--sm-shadow);
}
.sani-match .sani-match__notice {
    display: block; border: 0; background: var(--sm-pale); color: var(--sm-accent-dark); font-size: 0.9rem;
    padding: 0.75rem 1rem; border-radius: var(--sm-radius); margin: 1rem 0;
}
.sani-match .sani-match__banner {
    background: #fff; border: 2px dashed var(--sm-mid); color: var(--sm-accent-dark); border-radius: var(--sm-radius);
    padding: 0.75rem 1rem; margin-bottom: 1rem; font-size: 0.95rem;
}

/* Top bar and progress */
.sani-match .sani-match__top { display: flex; align-items: center; gap: 0.75rem; min-height: 2.75rem; }
.sani-match .sani-match__step { margin-left: auto; font-weight: 700; font-size: 0.8rem; letter-spacing: .02em; color: var(--sm-accent); background: var(--sm-pale); border-radius: 999px; padding: 0.2rem 0.75rem; }
.sani-match .sani-match__progress { height: 0.6rem; background: var(--sm-pale); border-radius: 999px; overflow: hidden; margin: 0.35rem 0 1.25rem; }
.sani-match .sani-match__progress > span { display: block; height: 100%; background: var(--sm-accent); border-radius: 999px; transition: width 0.3s ease; }

/* Buttons (selectors doubled-up to beat theme button styles, incl. hover/active colours) */
.sani-match .sani-match__btn,
.sani-match a.sani-match__btn {
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    width: 100%; min-height: 3.25rem; padding: 0.7rem 1.25rem; margin: 0;
    border-radius: 999px; border: 2px solid var(--sm-accent);
    background: #fff; color: var(--sm-accent);
    font: inherit; font-family: var(--sm-font); font-weight: 700; font-size: 1rem; line-height: 1.25; text-align: center; text-decoration: none;
    cursor: pointer; box-shadow: none; text-transform: none; letter-spacing: normal;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}
.sani-match .sani-match__btn:hover:not([disabled]),
.sani-match .sani-match__btn:focus:not([disabled]),
.sani-match .sani-match__btn:active:not([disabled]),
.sani-match a.sani-match__btn:hover { background: var(--sm-pale); color: var(--sm-accent-dark); border-color: var(--sm-accent); }
.sani-match .sani-match__btn--primary,
.sani-match a.sani-match__btn--primary { background: var(--sm-cta); border-color: var(--sm-cta); color: var(--sm-cta-text); box-shadow: 0 4px 14px rgba(235,103,42,.32); }
.sani-match .sani-match__btn--primary:hover:not([disabled]),
.sani-match .sani-match__btn--primary:focus:not([disabled]),
.sani-match .sani-match__btn--primary:active:not([disabled]),
.sani-match a.sani-match__btn--primary:hover { background: var(--sm-cta-hover); border-color: var(--sm-cta-hover); color: var(--sm-cta-text); }
.sani-match .sani-match__btn--primary:hover:not([disabled]) { transform: translateY(-1px); }
.sani-match .sani-match__btn[disabled] { opacity: 1; background: #e9ebf3; border-color: #e9ebf3; color: #5d6575; box-shadow: none; cursor: not-allowed; }
.sani-match .sani-match__btn--link,
.sani-match .sani-match__btn--link:hover:not([disabled]),
.sani-match .sani-match__btn--link:focus:not([disabled]),
.sani-match .sani-match__btn--link:active:not([disabled]) {
    width: auto; min-height: 2.75rem; border: 0; background: none; text-decoration: underline; text-underline-offset: 3px;
    padding: 0.4rem 0.25rem; font-weight: 600; font-size: 0.95rem; justify-content: flex-start; color: var(--sm-accent); box-shadow: none;
}
.sani-match .sani-match__btn--link:hover:not([disabled]) { color: var(--sm-accent-dark); text-decoration-thickness: 2px; }
.sani-match .sani-match__linkbtn,
.sani-match .sani-match__linkbtn:hover,
.sani-match .sani-match__linkbtn:focus {
    background: none; border: 0; padding: 0.5rem 0.25rem; margin: 0; min-height: 2.75rem; font: inherit; font-family: var(--sm-font);
    font-weight: 700; color: inherit; text-decoration: underline; cursor: pointer; box-shadow: none;
}
.sani-match .sani-match__actions { display: grid; gap: 0.7rem; margin-top: 1rem; }

/* Options: tactile cards with a round marker; selected = navy frame, lavender fill, filled marker */
.sani-match .sani-match__fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.sani-match .sani-match__legend { padding: 0; width: 100%; }
.sani-match .sani-match__options { display: grid; gap: 0.7rem; margin: 0; padding: 0; list-style: none; }
.sani-match .sani-match__options > li { min-width: 0; margin: 0; padding: 0; list-style: none; }
/* WordPress themes may leave content-box: width 100% + padding would overflow the panel on phones. */
.sani-match, .sani-match *, .sani-match *::before, .sani-match *::after { box-sizing: border-box; }
.sani-match .sani-match__option {
    position: relative; display: flex; align-items: center; gap: 0.85rem; width: 100%; min-height: 3.5rem; margin: 0;
    padding: 0.8rem 1rem; background: var(--sm-card); color: var(--sm-text);
    border: 2px solid var(--sm-border); border-radius: var(--sm-radius);
    font: inherit; font-family: var(--sm-font); font-size: 1rem; font-weight: 500; line-height: 1.4; text-align: left; cursor: pointer;
    box-shadow: 0 1px 2px rgba(9,75,127,.05); text-transform: none; letter-spacing: normal;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.sani-match button.sani-match__option::before {
    content: ""; flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--sm-mid); background: #fff center / 0.9rem no-repeat;
}
.sani-match .sani-match__option:hover,
.sani-match .sani-match__option:focus,
.sani-match .sani-match__option:active { border-color: var(--sm-accent); background: #f5f7ff; color: var(--sm-text); box-shadow: 0 2px 8px rgba(9,75,127,.1); }
.sani-match .sani-match__option[aria-pressed="true"],
.sani-match .sani-match__option.is-checked,
.sani-match .sani-match__option[aria-pressed="true"]:hover,
.sani-match .sani-match__option.is-checked:hover { border-color: var(--sm-accent); background: var(--sm-pale); color: var(--sm-accent-dark); font-weight: 700; box-shadow: 0 0 0 1px var(--sm-accent); }
.sani-match button.sani-match__option[aria-pressed="true"]::before {
    border-color: var(--sm-accent); background-color: var(--sm-accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.8'/%3E%3C/svg%3E");
}
/* Multi-select (label + native checkbox, drawn as a rounded square) */
.sani-match .sani-match__option input[type="checkbox"] {
    -webkit-appearance: none; appearance: none; flex: none; width: 1.5rem; height: 1.5rem; margin: 0;
    border: 2px solid var(--sm-mid); border-radius: 7px; background: #fff center / 0.95rem no-repeat; cursor: pointer;
}
.sani-match .sani-match__option input[type="checkbox"]:checked {
    border-color: var(--sm-accent); background-color: var(--sm-accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.8'/%3E%3C/svg%3E");
}
.sani-match .sani-match__option:focus-within { outline: 3px solid var(--sm-accent); outline-offset: 3px; }
.sani-match .sani-match__option input[type="checkbox"]:focus-visible { outline: none; }
.sani-match .sani-match__option.is-disabled { opacity: 0.55; cursor: not-allowed; background: #f1f2f7; }
.sani-match .sani-match__option.is-disabled:hover { border-color: var(--sm-border); background: #f1f2f7; box-shadow: none; }
.sani-match .sani-match__group { font-weight: 700; color: var(--sm-accent); font-size: 0.9rem; letter-spacing: .02em; margin: 1.1rem 0 0.2rem; }

.sani-match .sani-match__field { margin-top: 1.1rem; }
.sani-match .sani-match__field label { display: block; font-weight: 700; color: var(--sm-accent); margin-bottom: 0.4rem; }
.sani-match .sani-match__input {
    display: block; width: 100%; min-height: 3.25rem; padding: 0.7rem 1rem; margin: 0; font: inherit; font-family: var(--sm-font); color: var(--sm-text);
    background: var(--sm-card); border: 2px solid var(--sm-border); border-radius: var(--sm-radius); box-shadow: none;
}
.sani-match .sani-match__input:focus { border-color: var(--sm-accent); outline: 3px solid var(--sm-pale); outline-offset: 0; }
.sani-match .sani-match__error { color: var(--sm-warn); font-weight: 600; margin-top: 0.4rem; }
.sani-match .sani-match__textarea {
    display: block; width: 100%; min-height: 9rem; padding: 0.9rem 1rem; margin: 0.6rem 0; font: inherit; font-family: var(--sm-font); line-height: 1.6;
    color: var(--sm-text); background: var(--sm-card); border: 2px solid var(--sm-border); border-radius: var(--sm-radius-lg);
    box-shadow: inset 0 1px 3px rgba(9,75,127,.06); resize: vertical;
}
.sani-match .sani-match__textarea::placeholder { color: #6b7280; opacity: 1; }
.sani-match .sani-match__textarea:focus { border-color: var(--sm-accent); outline: 3px solid var(--sm-pale); outline-offset: 0; }
.sani-match .sani-match__lead {
    font-size: 1rem; font-weight: 600; line-height: 1.55; color: var(--sm-accent-dark);
    background: var(--sm-pale); border-radius: var(--sm-radius); padding: 0.8rem 1rem; margin: 0.5rem 0 0.75rem;
}

.sani-match .sani-match__check { display: flex; gap: 0.8rem; align-items: flex-start; margin: 1rem 0; font-size: 0.95rem; }
.sani-match .sani-match__check input {
    -webkit-appearance: none; appearance: none; width: 1.5rem; height: 1.5rem; flex: none; margin: 0.05rem 0 0; cursor: pointer;
    border: 2px solid var(--sm-accent); border-radius: 7px; background: #fff center / 0.95rem no-repeat;
}
.sani-match .sani-match__check input:checked {
    background-color: var(--sm-accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.8'/%3E%3C/svg%3E");
}
.sani-match .sani-match__check label { cursor: pointer; display: block; margin: 0; font-weight: 500; }

.sani-match .sani-match__sticky {
    position: sticky; bottom: 0; z-index: 2; padding: 0.8rem 0 0.6rem; margin-top: 0.8rem;
    background: linear-gradient(to top, var(--sm-bg) 72%, rgba(251,247,240,0));
}

/* Results */
.sani-match .sani-match__tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1.1rem; }
.sani-match .sani-match__tag,
.sani-match .sani-match__tag:hover,
.sani-match .sani-match__tag:focus,
.sani-match .sani-match__tag:active {
    min-height: 2.75rem; max-width: 100%; padding: 0.4rem 1rem; margin: 0; border-radius: 999px; border: 2px solid var(--sm-pale);
    background: var(--sm-pale); color: var(--sm-accent-dark); font: inherit; font-family: var(--sm-font); font-size: 0.85rem; font-weight: 600; line-height: 1.3;
    text-align: left; cursor: pointer; box-shadow: none; text-transform: none; letter-spacing: normal;
}
.sani-match .sani-match__tag:hover { background: #fff; border-color: var(--sm-accent); color: var(--sm-accent-dark); }
.sani-match .sani-match__pro { display: grid; gap: 0.85rem; position: relative; border-top: 6px solid var(--sm-accent); }
.sani-match .sani-match__pro-head { display: flex; gap: 1rem; align-items: center; }
.sani-match .sani-match__pro-head > div { min-width: 0; }
.sani-match .sani-match__avatar {
    position: relative; flex: none; width: 4.75rem; height: 4.75rem; border-radius: 50%; overflow: hidden;
    background: var(--sm-pale); color: var(--sm-accent); display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.4rem; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--sm-pale);
}
.sani-match .sani-match__avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; margin: 0; }
.sani-match .sani-match__avatar--clinic svg { width: 2.2rem; height: 2.2rem; }
.sani-match .sani-match__badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.sani-match .sani-match__badge { background: var(--sm-pale); color: var(--sm-accent-dark); border-radius: 999px; padding: 0.2rem 0.8rem; font-size: 0.8rem; font-weight: 600; line-height: 1.5; }
.sani-match .sani-match__badge--free { background: var(--sm-highlight); color: #191919; font-weight: 700; }
.sani-match .sani-match__pro > .sani-match__meta { font-size: 0.9rem; }
.sani-match .sani-match__pro > .sani-match__meta:not(:first-of-type) { font-weight: 700; color: var(--sm-text); font-size: 1rem; }
.sani-match .sani-match__slot { font-weight: 600; margin: 0; padding: 0.6rem 0.9rem; background: var(--sm-bg); border-radius: var(--sm-radius); color: var(--sm-accent-dark); font-size: 0.95rem; }
.sani-match .sani-match__slot span { font-weight: 700; }
.sani-match .sani-match__why { background: var(--sm-bg); border-radius: var(--sm-radius); padding: 0.9rem 1rem 0.5rem; }
.sani-match .sani-match__why ul { padding: 0; }
.sani-match .sani-match__why li { position: relative; padding-left: 1.6rem; margin: 0 0 0.45rem; font-size: 0.925rem; line-height: 1.5; }
.sani-match .sani-match__why li::before {
    content: ""; position: absolute; left: 0; top: 0.2rem; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: var(--sm-pale) center / 0.7rem no-repeat;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23094b7f' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.8'/%3E%3C/svg%3E");
}
.sani-match .sani-match__details { margin: 0.5rem 0 1rem; }
.sani-match .sani-match__details summary { cursor: pointer; font-weight: 600; color: var(--sm-accent); min-height: 2.75rem; display: flex; align-items: center; }
.sani-match .sani-match__send { background: #fff; border-color: var(--sm-mid); }
.sani-match .sani-match__send label { display: block; font-weight: 700; color: var(--sm-accent); margin: 0.9rem 0 0.4rem; }
.sani-match .sani-match__send .sani-match__check label { color: var(--sm-text); font-weight: 500; margin: 0; }

.sani-match .sani-match__loading { text-align: center; padding: 3rem 1rem; }
.sani-match .sani-match__loading .sani-match__title { text-align: center; }
.sani-match .sani-match__spinner {
    width: 3rem; height: 3rem; margin: 0 auto 1.25rem; border-radius: 50%;
    border: 5px solid var(--sm-pale); border-top-color: var(--sm-cta); animation: sani-match-spin 0.9s linear infinite;
}
@keyframes sani-match-spin { to { transform: rotate(360deg); } }

/* Emergency note: part of the widget, present on every screen */
.sani-match .sani-match__emergency {
    margin-top: 1.5rem; padding: 0.85rem 1rem; border-radius: var(--sm-radius);
    background: var(--sm-accent); color: #fff; font-size: 0.875rem; line-height: 1.55; text-align: center;
}
.sani-match .sani-match__emergency:empty { display: none; }
.sani-match .sani-match__emergency *{line-height:inherit}
.sani-match .sani-match__emergency :focus-visible { outline-color: #fff; }

@media (min-width: 40rem) {
    .sani-match, .sani-directorio.sani-match { padding: 1.75rem 2rem 2rem; }
    .sani-match .sani-match__title { font-size: 1.7rem; }
    .sani-match .sani-match__card { padding: 1.5rem; }
    .sani-match .sani-match__actions--row { grid-template-columns: 1fr 1fr; }
    .sani-match .sani-match__pro .sani-match__actions { grid-template-columns: 1fr 1fr; }
    .sani-match .sani-match__option { padding: 0.9rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    .sani-match *, .sani-match *::before, .sani-match *::after {
        transition: none !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    }
}

/* Voice dictation button, inside the writing box (bottom right) */
.sani-match .sani-match__write { position: relative; }
.sani-match .sani-match__write .sani-match__textarea { padding-bottom: 4rem; }
.sani-match .sani-match__mic {
    position: absolute; right: 0.75rem; bottom: 0.75rem; display: inline-flex; align-items: center; gap: 0.45rem;
    min-height: 44px; padding: 0.5rem 1rem; border-radius: 999px; border: 2px solid var(--sm-accent);
    background: #fff; color: var(--sm-accent); font: inherit; font-family: var(--sm-font); font-weight: 700; font-size: 0.92rem; cursor: pointer;
}
.sani-match .sani-match__mic:hover { background: var(--sm-pale); }
.sani-match .sani-match__mic:focus-visible { outline: 3px solid var(--sm-accent); outline-offset: 2px; }
.sani-match .sani-match__mic.is-listening { background: var(--sm-accent); color: #fff; }
.sani-match .sani-match__mic.is-listening svg { animation: sani-mic-pulse 1.2s ease-in-out infinite; }
.sani-match .sani-match__mic-note { color: var(--sm-accent); font-weight: 600; min-height: 1.2em; }
@keyframes sani-mic-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .sani-match .sani-match__mic.is-listening svg { animation: none; } }

