/* =========================================================================
   Lawyer Directory — modern, self-contained, RTL.
   Scoped under .ld-directory (archive) / .ld-single-lawyer (single).
   ========================================================================= */

   :root {
    --ld-primary:        #16324f;
    --ld-primary-2:      #1f4e79;
    --ld-accent:         #d4a437;
    --ld-bg:             #f4f7fb;
    --ld-surface:        #ffffff;
    --ld-border:         #e5eaf1;
    --ld-text:           #1c2733;
    --ld-muted:          #69757f;
    --ld-star:           #f0b429;
    --ld-star-empty:     #d9dee6;
    --ld-radius:         16px;
    --ld-radius-sm:      10px;
    --ld-shadow:         0 4px 18px rgba(16, 40, 70, .08);
    --ld-shadow-hover:   0 12px 32px rgba(16, 40, 70, .15);
    --ld-transition:     .2s ease;
}

/* =========================================================================
   THEME LAYOUT OVERRIDE (Astra) — force full-width for LD pages.

   Root cause of the "half-width / empty side" bug: on single-lawyer pages
   the theme renders a content + sidebar split (#primary / #secondary) inside
   .ast-container, so the plugin markup only filled part of the width.
   We hide the (empty) theme sidebar and let the primary column span the full
   container. Uses :has() so it triggers ONLY on LD pages and does not depend
   on body-class names — nothing else on the site is touched.
   ========================================================================= */

.ld-single-lawyer,
.ld-directory {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.ast-container:has(.ld-single-lawyer) #secondary,
.ast-container:has(.ld-directory)     #secondary {
    display: none !important;
}

.ast-container:has(.ld-single-lawyer) #primary,
.ast-container:has(.ld-directory)     #primary {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
    margin-inline: 0 !important;
}

.ast-container:has(> .ld-single-lawyer),
.ast-container:has(> .ld-directory) {
    display: block;
}

/* ---- Archive layout shell ---------------------------------------------- */

.ld-directory {
    background: var(--ld-bg);
    color: var(--ld-text);
    padding: 2rem 1rem 3rem;
    font-family: inherit;
    line-height: 1.7;
}

.ld-directory__inner {
    max-width: 1140px;
    margin: 0 auto;
}

.ld-directory__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin: 1rem 0 1.5rem;
}

.ld-archive-title {
    font-size: clamp(1.4rem, 1rem + 1.6vw, 2rem);
    font-weight: 800;
    margin: 0;
    color: var(--ld-primary);
}

.ld-archive-title::after {
    content: "";
    display: block;
    width: 56px;
    height: 4px;
    margin-top: .6rem;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--ld-primary-2), var(--ld-accent));
}

.ld-archive-count {
    margin: 0;
    color: var(--ld-muted);
    font-size: .95rem;
    font-weight: 600;
}

/* ---- Grid -------------------------------------------------------------- */

.ld-lawyers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

/* ---- Card -------------------------------------------------------------- */

.ld-lawyer-card {
    display: flex;
    flex-direction: column;
    background: var(--ld-surface);
    border: 1px solid var(--ld-border);
    border-radius: var(--ld-radius);
    overflow: hidden;
    box-shadow: var(--ld-shadow);
    transition: transform var(--ld-transition), box-shadow var(--ld-transition);
    height: 100%;
}

.ld-lawyer-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--ld-shadow-hover);
}

.ld-card-photo {
    position: relative;
    aspect-ratio: 16 / 11;
    background: linear-gradient(135deg, #eef2f8, #e3e9f2);
    overflow: hidden;
}

.ld-card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}

.ld-lawyer-card:hover .ld-card-photo img {
    transform: scale(1.04);
}

.ld-card-photo-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-size: 2.4rem;
    background: linear-gradient(135deg, var(--ld-primary), var(--ld-primary-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.ld-card-body {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: 1rem 1.1rem .4rem;
    flex: 1 1 auto;
}

.ld-card-name {
    font-size: 1.12rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.4;
}

.ld-card-name a {
    color: var(--ld-text);
    text-decoration: none;
    transition: color var(--ld-transition);
}

.ld-card-name a:hover {
    color: var(--ld-primary-2);
}

.ld-card-grade {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: .3rem;
    font-size: .8rem;
    font-weight: 700;
    color: var(--ld-primary-2);
    background: #eaf1fb;
    padding: .22rem .6rem;
    border-radius: 999px;
}

/* ---- Tags -------------------------------------------------------------- */

.ld-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.ld-card-tag {
    font-size: .76rem;
    font-weight: 600;
    color: var(--ld-muted);
    background: #f1f4f9;
    border: 1px solid var(--ld-border);
    padding: .2rem .55rem;
    border-radius: 8px;
    text-decoration: none;
    transition: var(--ld-transition);
}

a.ld-card-tag:hover {
    color: var(--ld-primary-2);
    border-color: var(--ld-primary-2);
}

.ld-card-tag.ld-tag-city {
    color: #1b6b4c;
    background: #e7f6ee;
    border-color: #d2eede;
}

/* ---- Rating (shared by archive + single) ------------------------------- */

.ld-card-rating {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-top: auto;
    padding-top: .4rem;
    font-size: .85rem;
    color: var(--ld-muted);
}

.ld-stars {
    display: inline-flex;
    direction: ltr; /* stars read left-to-right */
    font-size: 1rem;
    line-height: 1;
}

.ld-star {
    color: var(--ld-star-empty);
}

.ld-star.filled {
    color: var(--ld-star);
}

.ld-rating-avg {
    font-weight: 800;
    color: var(--ld-text);
}

/* ---- Footer / CTA ------------------------------------------------------ */

.ld-card-footer {
    padding: .4rem 1.1rem 1.1rem;
}

.ld-card-footer a {
    display: block;
    text-align: center;
    font-weight: 700;
    font-size: .9rem;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, var(--ld-primary), var(--ld-primary-2));
    padding: .6rem;
    border-radius: var(--ld-radius-sm);
    transition: filter var(--ld-transition);
}

.ld-card-footer a:hover {
    filter: brightness(1.08);
}

/* ---- Empty state & buttons -------------------------------------------- */

.ld-no-results {
    text-align: center;
    background: var(--ld-surface);
    border: 1px dashed var(--ld-border);
    border-radius: var(--ld-radius);
    padding: 2.5rem 1rem;
    color: var(--ld-muted);
}

.ld-btn {
    display: inline-block;
    margin-top: 1rem;
    padding: .6rem 1.4rem;
    border-radius: var(--ld-radius-sm);
    font-weight: 700;
    text-decoration: none;
    transition: var(--ld-transition);
}

.ld-btn-secondary {
    color: var(--ld-primary-2);
    background: #eaf1fb;
}

.ld-btn-secondary:hover {
    background: #dbe7f8;
}

/* ---- Breadcrumb / pagination (archive shell) -------------------------- */

.ld-directory nav.ld-breadcrumb,
.ld-directory .ld-breadcrumb {
    font-size: .85rem;
    color: var(--ld-muted);
    margin-bottom: .5rem;
}

.ld-directory .ld-breadcrumb a {
    color: var(--ld-primary-2);
    text-decoration: none;
}

.ld-directory .ld-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    justify-content: center;
    margin-top: 2rem;
}

.ld-directory .ld-pagination a,
.ld-directory .ld-pagination span {
    min-width: 40px;
    text-align: center;
    padding: .45rem .7rem;
    border-radius: var(--ld-radius-sm);
    border: 1px solid var(--ld-border);
    background: var(--ld-surface);
    text-decoration: none;
    color: var(--ld-text);
    font-weight: 600;
}

.ld-directory .ld-pagination .current {
    background: var(--ld-primary-2);
    border-color: var(--ld-primary-2);
    color: #fff;
}

@media (max-width: 480px) {
    .ld-lawyers-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   SINGLE LAWYER — matches single-lawyer.php (.ld-single-* markup)
   ========================================================================= */

/* Page shell */
.ld-single-lawyer {
    background: var(--ld-bg);
    color: var(--ld-text);
    padding: 2rem 1rem 3rem;
    font-family: inherit;
    line-height: 1.7;
}

.ld-single-inner {
    max-width: 1140px;
    margin: 0 auto;
}

/* Two-column layout */
.ld-single-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}

.ld-single-main { min-width: 0; }

/* Breadcrumbs */
.ld-single-lawyer .ld-breadcrumbs ol {
    display: flex; flex-wrap: wrap; align-items: center; gap: .25rem;
    list-style: none; margin: 0 0 1rem; padding: 0;
    font-size: .85rem; color: var(--ld-muted);
}
.ld-single-lawyer .ld-breadcrumbs a { color: var(--ld-primary-2); text-decoration: none; }
.ld-single-lawyer .ld-breadcrumbs a:hover { text-decoration: underline; }
.ld-single-lawyer .ld-crumb-sep { margin: 0 .35rem; color: var(--ld-muted); }
.ld-single-lawyer .ld-crumb-current { color: var(--ld-text); font-weight: 600; }

/* Header: photo + info */
.ld-single-header {
    display: flex; gap: 1.5rem; align-items: center;
    background: var(--ld-surface); border: 1px solid var(--ld-border);
    border-radius: var(--ld-radius); box-shadow: var(--ld-shadow);
    padding: 1.5rem; margin-bottom: 1.5rem;
}
.ld-single-photo {
    width: 140px; height: 140px; flex: 0 0 auto;
    border-radius: 12px; overflow: hidden; background: #eef2f7;
}
.ld-single-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ld-photo-placeholder {
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem; font-weight: 800; color: var(--ld-primary-2);
    background: linear-gradient(135deg, #eef2f8, #e3e9f2);
}
.ld-single-headinfo { flex: 1 1 auto; min-width: 0; }

.ld-single-name {
    margin: 0 0 .5rem; font-size: 1.6rem; font-weight: 800;
    color: var(--ld-text);
}
.ld-single-grade {
    display: inline-flex; align-items: center; gap: .4rem;
    background: #eaf1fb; color: var(--ld-primary-2);
    font-weight: 700; font-size: .82rem; padding: .25rem .7rem; border-radius: 999px;
}
.ld-single-rating {
    display: flex; align-items: center; gap: .5rem;
    margin-top: .6rem; font-size: .9rem; color: var(--ld-muted);
}
.ld-single-rating .ld-stars { display: inline-flex; direction: ltr; font-size: 1.05rem; line-height: 1; }
.ld-single-rating .ld-star { color: var(--ld-star-empty); }
.ld-single-rating .ld-star.is-filled { color: var(--ld-star); }
.ld-rating-num { font-weight: 800; color: var(--ld-text); }
.ld-rating-count { color: var(--ld-muted); }

/* Chips (specialty + city) in header */
.ld-single-specs { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.ld-spec-chip {
    font-size: .8rem; font-weight: 600; color: var(--ld-primary-2);
    background: #eef2f7; padding: .3rem .75rem; border-radius: 999px;
}
.ld-city-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .8rem; font-weight: 600; color: #1b6b4c;
    background: #e7f6ee; border: 1px solid #d2eede;
    padding: .3rem .75rem; border-radius: 999px;
}

/* Content sections */
.ld-single-section {
    background: var(--ld-surface); border: 1px solid var(--ld-border);
    border-radius: var(--ld-radius); box-shadow: var(--ld-shadow);
    padding: 1.5rem; margin-bottom: 1.5rem;
}
.ld-section-title {
    font-size: 1.2rem; font-weight: 700; margin: 0 0 1.1rem;
    padding-bottom: .65rem; border-bottom: 2px solid #f0f2f5; color: var(--ld-text);
}
.ld-bio-content, .ld-education-content { color: #33414f; line-height: 2; }
.ld-bio-content p { margin: 0 0 1rem; }
.ld-bio-content :last-child { margin-bottom: 0; }

/* Sidebar */
.ld-single-sidebar {
    position: sticky; top: 20px; align-self: start;
    display: flex; flex-direction: column; gap: 1.5rem;
}
.ld-sidebar-card {
    background: var(--ld-surface); border: 1px solid var(--ld-border);
    border-radius: var(--ld-radius); box-shadow: var(--ld-shadow); padding: 1.5rem;
}
.ld-sidebar-title {
    font-size: 1.1rem; font-weight: 700; margin: 0 0 1.1rem;
    text-align: center; color: var(--ld-text);
}

/* Connect buttons — phone & muchat share the same look */
.ld-connect-btns {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.ld-connect-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .85rem 1rem;
    border-radius: var(--ld-radius-sm);
    font-weight: 700;
    text-decoration: none;
    color: #fff;
    line-height: 1.4;
    background: linear-gradient(135deg, var(--ld-primary), var(--ld-primary-2));
    transition: filter var(--ld-transition), transform var(--ld-transition);
}
.ld-connect-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
}
.ld-connect-label { font-size: 1rem; }
.ld-connect-empty {
    text-align: center;
    color: var(--ld-muted);
    font-size: .9rem;
    margin: 0;
}

/* Responsive */
@media (max-width: 992px) {
    .ld-single-grid { grid-template-columns: 1fr; }
    .ld-single-sidebar { position: static; top: auto; }
}
@media (max-width: 575.98px) {
    .ld-single-header { flex-direction: column; text-align: center; }
    .ld-single-grade, .ld-single-rating, .ld-single-specs { justify-content: center; }
}
/* ============================================================
   Lawyer Directory — Rating Stars (RTL interactive)
   ============================================================ */

/* ---- Read-only display stars (header + summary) ---- */
.ld-stars {
    display: inline-flex;
    flex-direction: row;
    gap: 2px;
    direction: rtl;
    line-height: 1;
    font-size: 20px;
}

.ld-stars .ld-star {
    color: #d8d8d8;
    transition: color .15s ease;
}

/* Support BOTH class names used across the codebase:
   - single-lawyer.php header uses .is-filled
   - rating.js updateStarsFilled() adds .filled */
.ld-stars .ld-star.is-filled,
.ld-stars .ld-star.filled {
    color: #f6b01e;
}

.ld-stars .ld-star.half {
    position: relative;
    color: #d8d8d8;
}
.ld-stars .ld-star.half::before {
    content: "★";
    position: absolute;
    inset: 0;
    width: 50%;
    overflow: hidden;
    color: #f6b01e;
    /* In RTL the filled half must start from the right edge */
    right: 0;
    left: auto;
}

/* ============================================================
   Interactive rating widget (the form)
   ============================================================ */

.ld-rating-form {
    margin: 0;
}

.ld-rating-form .ld-rating-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #555;
}

.ld-rating-form .ld-rating-avg-value {
    font-weight: 700;
    color: #222;
    font-size: 16px;
}

/* ---- The interactive radio star input ----
   Markup expected in rating-form.php:

   <div class="ld-rating-stars-input" dir="rtl">
       <input type="radio" name="ld_score" id="ld-star-5" value="5">
       <label for="ld-star-5">★</label>
       <input type="radio" name="ld_score" id="ld-star-4" value="4">
       <label for="ld-star-4">★</label>
       ... down to 1 ...
   </div>

   Stars are laid out 5→1 in the DOM so the CSS sibling
   selector (~) can highlight from the hovered star toward
   higher values. In RTL, row-reverse places 1 on the right
   and 5 on the left, and hovering fills left-to-right
   correctly. */

.ld-rating-stars-input {
    display: inline-flex;
    flex-direction: row;
    direction: ltr;          /* internal LTR so ~ sibling math is predictable */
    gap: 4px;
    font-size: 32px;
    line-height: 1;
    unicode-bidi: bidi-override;
}

.ld-rating-stars-input input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.ld-rating-stars-input label {
    color: #d8d8d8;
    cursor: pointer;
    transition: color .12s ease, transform .12s ease;
    padding: 0 1px;
}

/* Because stars are ordered 5,4,3,2,1 in the DOM and laid out
   LTR with flex-direction:row, star "5" sits on the far left.
   Hovering any star fills it AND all following siblings (which
   are the lower numbers), producing a continuous fill from the
   hovered point rightward toward 1. */
.ld-rating-stars-input label:hover,
.ld-rating-stars-input label:hover ~ label {
    color: #f6b01e;
}

/* Persist the chosen rating: the checked input + all following
   labels stay filled. */
.ld-rating-stars-input input[type="radio"]:checked ~ label {
    color: #f6b01e;
}

/* When hovering, override the checked state so preview wins. */
.ld-rating-stars-input:hover input[type="radio"]:checked ~ label {
    color: #d8d8d8;
}
.ld-rating-stars-input label:hover,
.ld-rating-stars-input label:hover ~ label {
    color: #f6b01e !important;
}

/* Slight pop on hover */
.ld-rating-stars-input label:hover {
    transform: scale(1.08);
}

/* ---- Submit button ---- */
.ld-rating-form .ld-rating-submit {
    margin-top: 14px;
}

.ld-rating-form .ld-rating-submit button {
    background: #1a5276;
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 10px 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, opacity .15s ease;
}

.ld-rating-form .ld-rating-submit button:hover {
    background: #154360;
}

.ld-rating-form .ld-rating-submit button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ---- AJAX message area ---- */
.ld-rating-message {
    margin-top: 12px;
    font-size: 14px;
    min-height: 1em;
}

.ld-rating-message.success {
    color: #1e7e34;
}

.ld-rating-message.error {
    color: #c0392b;
}

/* ---- Login prompt (anonymous users in comments) ---- */
.ld-login-prompt {
    padding: 14px 16px;
    background: #f4f7fa;
    border: 1px solid #dde6ee;
    border-radius: 8px;
    font-size: 14px;
}
.ld-login-prompt a {
    color: #1a5276;
    font-weight: 700;
}
/* ===========================================================
   Interactive star widget (.ld-star-widget)
   - Radios hidden
   - Stars hollow by default
   - Hover/checked fills from right toward left (RTL friendly)
   =========================================================== */

   .ld-star-widget {
    display: inline-flex;
    flex-direction: row-reverse;   /* inputs are rendered 5→1; reverse puts 5 on the right */
    justify-content: flex-end;
    gap: 4px;
    direction: ltr;                /* keep the row-reverse trick predictable */
    unicode-bidi: bidi-override;
}

/* Hide the radio inputs but keep them accessible/focusable */
.ld-star-widget input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Star glyph labels */
.ld-star-widget label {
    cursor: pointer;
    font-size: 2rem;
    line-height: 1;
    color: #d1d5db;                /* hollow / unselected color */
    transition: color 0.15s ease;
    margin: 0;
}

/*
 * Because of flex-direction: row-reverse, the *previous* siblings in the DOM
 * (lower star numbers) sit visually to the LEFT. The "~" sibling selector
 * targets later DOM siblings (= higher numbers, to the LEFT visually).
 *
 * Hover/checked star → itself + all lower-numbered stars get filled.
 */

/* Fill on hover: the hovered label + everything after it (DOM) = to its left */
.ld-star-widget label:hover,
.ld-star-widget label:hover ~ label {
    color: #f59e0b;                /* filled gold */
}

/* Persist the selection: checked input fills its label + following labels */
.ld-star-widget input[type="radio"]:checked ~ label {
    color: #f59e0b;
}

/*
 * When hovering, the *current selection* should not stay highlighted past the
 * hover point. This rule resets the checked color while the widget is hovered,
 * so the hover preview is clean.
 */
.ld-star-widget:hover input[type="radio"]:checked ~ label {
    color: #d1d5db;
}
.ld-star-widget:hover label:hover,
.ld-star-widget:hover label:hover ~ label {
    color: #f59e0b;
}

/* Keyboard focus visibility */
.ld-star-widget input[type="radio"]:focus + label {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* در فایل CSS قالب یا افزونه */
.single-ld_lawyer .comment-form-author,
.single-ld_lawyer .comment-form-email,
.single-ld_lawyer .comment-form-url,
.single-ld_lawyer .comment-form-cookies-consent {
    display: none !important;
}
