/**
 * before-after.css — استایل پنل و اجزای نمونه‌کارهای قبل/بعد.
 * هماهنگ با style-guide (رنگ برند rgb(37,60,137)، فاصله‌ی ۸px، فونت iransansxv).
 * RTL و ریسپانسیو (موبایل/تبلت/دسکتاپ).
 */
:root {
    --ba-primary: rgb(37, 60, 137);
    --ba-primary-hover: rgb(45, 75, 170);
    --ba-success: #00A699;
    --ba-warning: #FFB400;
    --ba-error: #DC2626;
    --ba-info: #3B82F6;
    --ba-text: #1a1a1a;
    --ba-text-muted: #6b7280;
    --ba-border: #e5e7eb;
    --ba-bg-light: #f9fafb;
    --ba-radius: 12px;
    --ba-radius-sm: 8px;
}

.ba-panel {
    font-family: 'iransansxv', sans-serif;
    color: var(--ba-text);
    padding: 24px 0 64px;
    direction: rtl;
}

/* --- Header --- */
.ba-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.ba-header-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ba-header-title h1 i { color: var(--ba-primary); }
.ba-header-title p { color: var(--ba-text-muted); margin: 0; font-size: 0.9rem; }
.ba-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Buttons --- */
.ba-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--ba-radius-sm);
    border: 1px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s ease;
    line-height: 1.2;
}
.ba-btn-sm { padding: 6px 10px; font-size: 0.8rem; }
.ba-btn-primary { background: var(--ba-primary); color: #fff; }
.ba-btn-primary:hover:not(:disabled) { background: var(--ba-primary-hover); color: #fff; }
.ba-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.ba-btn-secondary { background: #eef1fb; color: var(--ba-primary); }
.ba-btn-secondary:hover { background: #e2e7f7; color: var(--ba-primary); }
.ba-btn-light { background: #fff; color: var(--ba-text); border-color: var(--ba-border); }
.ba-btn-light:hover { background: var(--ba-bg-light); color: var(--ba-text); }
.ba-btn-danger { background: #fff; color: var(--ba-error); border-color: #f3c9c9; }
.ba-btn-danger:hover { background: #fdecec; color: var(--ba-error); }

/* --- Alerts / notes --- */
.ba-alert { border-radius: var(--ba-radius-sm); padding: 12px 16px; margin-bottom: 16px; display: flex; gap: 8px; align-items: flex-start; }
.ba-note { border-radius: var(--ba-radius-sm); padding: 12px 16px; margin-bottom: 20px; font-size: 0.875rem; display: flex; gap: 8px; align-items: flex-start; }
.ba-note-info { background: #eef4ff; color: #1e40af; border: 1px solid #d3e0ff; }
.ba-error-list { margin: 0; padding-right: 18px; }

/* --- Empty state --- */
.ba-empty { text-align: center; padding: 48px 24px; background: var(--ba-bg-light); border-radius: var(--ba-radius); border: 1px dashed var(--ba-border); }
.ba-empty i { font-size: 3rem; color: #cbd5e1; margin-bottom: 12px; }
.ba-empty h4 { font-weight: 700; margin: 8px 0; }
.ba-empty p { color: var(--ba-text-muted); margin-bottom: 16px; }

/* --- Cases grid (index) --- */
.ba-cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.ba-case-card {
    background: #fff;
    border: 1px solid var(--ba-border);
    border-radius: var(--ba-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s ease;
}
.ba-case-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.ba-case-thumb { position: relative; background: #000; }
.ba-thumb-split { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; aspect-ratio: 16/9; }
.ba-thumb-split img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ba-case-thumb.is-sensitive .ba-thumb-split img { filter: blur(14px); }
.ba-thumb-badge { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,.65); color: #fff; font-size: .72rem; padding: 3px 8px; border-radius: 20px; }
.ba-thumb-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 16/9; background: var(--ba-bg-light); color: #9ca3af; gap: 6px; }

.ba-case-body { padding: 14px 16px; flex: 1; }
.ba-case-status { display: inline-block; font-size: .72rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; margin-bottom: 8px; }
.ba-status-pending { background: #fff7e6; color: #b45309; }
.ba-status-approved { background: #e6f7f4; color: #047857; }
.ba-status-rejected { background: #fdecec; color: var(--ba-error); }
.ba-case-title { font-size: 1rem; font-weight: 700; margin: 0 0 6px; }
.ba-case-service { font-size: .8rem; color: var(--ba-text-muted); display: flex; align-items: center; gap: 5px; }
.ba-reject-reason { margin-top: 8px; font-size: .78rem; color: var(--ba-error); background: #fdf2f2; padding: 6px 10px; border-radius: 6px; }
.ba-inactive-tag { margin-top: 8px; display: inline-block; font-size: .72rem; color: var(--ba-text-muted); background: #f1f5f9; padding: 2px 8px; border-radius: 6px; }
.ba-case-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--ba-border); background: var(--ba-bg-light); }
.ba-inline-form { display: inline; margin: 0; }

/* --- Form --- */
.ba-form { max-width: 820px; }
.ba-form-section { background: #fff; border: 1px solid var(--ba-border); border-radius: var(--ba-radius); padding: 20px; margin-bottom: 20px; }
.ba-form-section-title { font-size: 1rem; font-weight: 700; margin: 0 0 16px; color: var(--ba-primary); }
.ba-form-group { margin-bottom: 16px; flex: 1; }
.ba-form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.ba-form-group label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 6px; }
.ba-req { color: var(--ba-error); }
.ba-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--ba-border);
    border-radius: var(--ba-radius-sm);
    font-family: inherit;
    font-size: .9rem;
    background: #fff;
}
.ba-input:focus { outline: none; border-color: var(--ba-primary); box-shadow: 0 0 0 3px rgba(37,60,137,.12); }
.ba-hint { display: block; color: var(--ba-text-muted); font-size: .75rem; margin-top: 4px; }
.ba-checkbox-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; cursor: pointer; }
.ba-checkbox-row input[type=checkbox] { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; }
.ba-consent-row { background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--ba-radius-sm); padding: 12px; }
.ba-consent-text { line-height: 1.6; }
.ba-form-footer { display: flex; gap: 10px; align-items: center; }

/* --- Manage pairs: add box --- */
.ba-add-pair { background: #fff; border: 1px solid var(--ba-border); border-radius: var(--ba-radius); padding: 20px; margin-bottom: 24px; }
.ba-add-pair-slots { display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; }
.ba-slot { flex: 1; min-width: 200px; text-align: center; }
.ba-slot-label { font-weight: 600; font-size: .85rem; margin-bottom: 8px; }
.ba-slot-preview {
    aspect-ratio: 4/3;
    border: 2px dashed var(--ba-border);
    border-radius: var(--ba-radius-sm);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #9ca3af; gap: 6px; background: var(--ba-bg-light); margin-bottom: 8px; overflow: hidden;
}
.ba-slot-preview i { font-size: 2rem; }
.ba-slot-preview.has-image { border-style: solid; border-color: var(--ba-primary); }
.ba-slot-preview img { width: 100%; height: 100%; object-fit: cover; }
.ba-slot-arrow { color: var(--ba-primary); font-size: 1.6rem; flex: 0 0 auto; }
.ba-add-pair-meta { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.ba-add-pair-meta .ba-input { flex: 1; min-width: 160px; }

/* --- Manage pairs: existing list --- */
.ba-pairs-list { display: flex; flex-direction: column; gap: 14px; }
.ba-pair-item {
    display: flex; gap: 16px; align-items: center;
    background: #fff; border: 1px solid var(--ba-border); border-radius: var(--ba-radius); padding: 12px 16px;
    flex-wrap: wrap;
}
.ba-pair-images { display: flex; gap: 10px; flex: 0 0 auto; }
.ba-pair-images figure { margin: 0; text-align: center; }
.ba-pair-images img { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; display: block; }
.ba-pair-images figcaption { font-size: .72rem; color: var(--ba-text-muted); margin-top: 4px; }
.ba-pair-meta { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; }
.ba-chip { background: #eef1fb; color: var(--ba-primary); font-size: .74rem; padding: 3px 10px; border-radius: 20px; }

/* --- Crop modal --- */
.ba-crop-modal { display: none; position: fixed; inset: 0; z-index: 10000; align-items: center; justify-content: center; }
.ba-crop-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.7); }
.ba-crop-dialog { position: relative; background: #fff; border-radius: var(--ba-radius); width: min(92vw, 640px); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.ba-crop-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--ba-border); font-weight: 700; }
.ba-crop-close { background: none; border: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--ba-text-muted); }
.ba-crop-body { padding: 12px; background: #111; max-height: 60vh; overflow: hidden; }
.ba-crop-body img { max-width: 100%; display: block; }
.ba-crop-toolbar { display: flex; gap: 6px; justify-content: center; padding: 10px; border-top: 1px solid var(--ba-border); flex-wrap: wrap; }
.ba-crop-toolbar button { width: 40px; height: 40px; border: 1px solid var(--ba-border); background: #fff; border-radius: 8px; cursor: pointer; color: var(--ba-text); }
.ba-crop-toolbar button:hover { background: var(--ba-bg-light); }
.ba-crop-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--ba-border); }

/* --- Toast --- */
.ba-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: #1f2937; color: #fff; padding: 12px 20px; border-radius: 10px; font-size: .9rem;
    z-index: 11000; opacity: 0; transition: all .25s ease; box-shadow: 0 6px 24px rgba(0,0,0,.2);
}
.ba-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ba-toast-error { background: var(--ba-error); }

/* ============================================================
   نمایش عمومی (فاز۲): اسلایدر مقایسه، گالری عمومی، فیلتر
   ============================================================ */

/* --- Before/After comparison slider --- */
.ba-slider {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: var(--ba-radius);
    user-select: none;
    touch-action: pan-y;
    background: #000;
    cursor: ew-resize;
}
.ba-slider img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ba-slider-after { position: absolute; inset: 0; }
.ba-slider-before { position: absolute; inset: 0; will-change: clip-path; }
.ba-slider-label {
    position: absolute; top: 10px; z-index: 3; font-size: .72rem; font-weight: 700;
    padding: 3px 10px; border-radius: 20px; color: #fff; background: rgba(0,0,0,.55);
}
.ba-slider-label-before { right: 10px; }
.ba-slider-label-after { left: 10px; }
.ba-slider-handle {
    position: absolute; top: 0; bottom: 0; width: 3px; background: #fff; z-index: 4;
    transform: translateX(-50%); cursor: ew-resize; box-shadow: 0 0 6px rgba(0,0,0,.4);
}
.ba-slider-handle::after {
    content: '\f337'; font-family: 'Font Awesome 7 Pro', 'Font Awesome 6 Free', 'Font Awesome 5 Free'; font-weight: 900;
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: 38px; height: 38px; background: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: var(--ba-primary);
    box-shadow: 0 2px 10px rgba(0,0,0,.3); font-size: 14px;
}
.ba-slider-active .ba-slider-handle { background: var(--ba-primary); }

/* بلورِ محتوای حساس تا کلیک کاربر */
.ba-sensitive-wrap { position: relative; }
.ba-sensitive-wrap.blurred .ba-slider img { filter: blur(22px); }
.ba-sensitive-overlay {
    position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px; text-align: center;
    background: rgba(0,0,0,.35); color: #fff; cursor: pointer; border-radius: var(--ba-radius); padding: 16px;
}
.ba-sensitive-wrap:not(.blurred) .ba-sensitive-overlay { display: none; }
.ba-sensitive-overlay i { font-size: 1.8rem; }
.ba-sensitive-overlay span { font-size: .85rem; font-weight: 600; }
.ba-sensitive-overlay small { font-size: .72rem; opacity: .85; }

/* --- Public single-case page --- */
.ba-public { direction: rtl; font-family: 'iransansxv', sans-serif; padding: 24px 0 64px; }
.ba-public-head { margin-bottom: 20px; }
.ba-public-title { font-size: 1.6rem; font-weight: 800; margin: 0 0 8px; }
.ba-public-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ba-public-desc { color: #374151; line-height: 1.9; margin: 16px 0; }
.ba-doctor-card {
    display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--ba-border);
    border-radius: var(--ba-radius); padding: 14px 16px; margin: 20px 0;
}
.ba-doctor-card img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.ba-doctor-card .ba-doc-name { font-weight: 700; }
.ba-doctor-card .ba-doc-spec { font-size: .82rem; color: var(--ba-text-muted); }
.ba-doctor-card a { margin-right: auto; }
.ba-pairs-public { display: flex; flex-direction: column; gap: 24px; }
.ba-pair-public { background: #fff; border: 1px solid var(--ba-border); border-radius: var(--ba-radius); padding: 16px; }
.ba-pair-public-labels { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* --- Public gallery grid + filters --- */
.ba-gallery { direction: rtl; font-family: 'iransansxv', sans-serif; padding: 24px 0 64px; }
.ba-filters { display: flex; gap: 12px; flex-wrap: wrap; background: #fff; border: 1px solid var(--ba-border); border-radius: var(--ba-radius); padding: 16px; margin-bottom: 24px; }
.ba-filters .ba-input { flex: 1; min-width: 160px; }
.ba-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.ba-gallery-card { background: #fff; border: 1px solid var(--ba-border); border-radius: var(--ba-radius); overflow: hidden; text-decoration: none; color: inherit; transition: box-shadow .15s; display: block; }
.ba-gallery-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.08); color: inherit; }
.ba-gallery-card .ba-gc-body { padding: 12px 14px; }
.ba-gallery-card .ba-gc-title { font-weight: 700; font-size: .95rem; margin: 0 0 6px; }
.ba-gallery-card .ba-gc-meta { font-size: .78rem; color: var(--ba-text-muted); }
.ba-gallery-empty { text-align: center; padding: 48px; color: var(--ba-text-muted); background: var(--ba-bg-light); border-radius: var(--ba-radius); }

/* --- Profile tab section --- */
.ba-profile-section { margin: 24px 0; }
.ba-profile-section h2 { font-size: 1.2rem; font-weight: 800; margin: 0 0 16px; display: flex; align-items: center; gap: 8px; }
.ba-profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }

/* --- Responsive --- */
@media (max-width: 640px) {
    .ba-header { flex-direction: column; }
    .ba-add-pair-slots { flex-direction: column; }
    .ba-slot-arrow { transform: rotate(-90deg); }
    .ba-pair-images img { width: 90px; height: 68px; }
    .ba-case-actions { justify-content: space-between; }
    .ba-filters .ba-input { min-width: 100%; }
}
