/* ══════════════════════════════════════════════════
   داشبورد حرفه‌ای تحلیل املاک  — realestate.css
   ══════════════════════════════════════════════════ */

/* ─── wrapper ─── */
.red-wrap {
    font-family: Tahoma, 'Segoe UI', sans-serif;
    direction: rtl;
    background: #f1f5f9;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ─── HERO / KPI bar ─── */
.red-hero {
    background: #1e293b;
    padding: 20px 24px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}
.red-hero-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}
.red-hero-icon { font-size: 32px; line-height: 1; }
.red-hero-name { font-size: 18px; font-weight: 700; color: #f1f5f9; }
.red-hero-sub  { font-size: 12px; color: #94a3b8; margin-top: 2px; }

.red-kpis {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.red-kpi {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    padding: 8px 16px;
    text-align: center;
    min-width: 80px;
    transition: background .2s;
}
.red-kpi:hover { background: rgba(255,255,255,.14); }
.red-kpi-val {
    font-size: 20px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -.3px;
    direction: ltr;
}
.red-kpi-lbl { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.red-kpi--bldg  { border-top: 3px solid #6366f1; }
.red-kpi--apt   { border-top: 3px solid #0ea5e9; }
.red-kpi--shop  { border-top: 3px solid #f59e0b; }
.red-kpi--land  { border-top: 3px solid #10b981; }
.red-kpi--area  { border-top: 3px solid #8b5cf6; }
.red-kpi--bldg  .red-kpi-val { color: #a5b4fc; }
.red-kpi--apt   .red-kpi-val { color: #7dd3fc; }
.red-kpi--shop  .red-kpi-val { color: #fcd34d; }
.red-kpi--land  .red-kpi-val { color: #6ee7b7; }
.red-kpi--area  .red-kpi-val { color: #c4b5fd; }

/* ─── TOOLBAR ─── */
.red-toolbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.red-search-wrap {
    position: relative;
    flex: 1;
    min-width: 160px;
    max-width: 320px;
}
.red-search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    pointer-events: none;
}
.red-search {
    width: 100%;
    padding: 8px 34px 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    direction: rtl;
    background: #f8fafc;
    outline: none;
    box-sizing: border-box;
    transition: border-color .2s;
}
.red-search:focus { border-color: #6366f1; background: #fff; }

.red-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.red-sel, .red-fp-sel {
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: #f8fafc;
    outline: none;
    cursor: pointer;
    direction: rtl;
}
.red-sel:focus, .red-fp-sel:focus { border-color: #6366f1; }

.red-btn {
    padding: 7px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: #f8fafc;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.red-btn:hover { background: #e2e8f0; }
.red-btn--icon { padding: 7px 10px; font-size: 15px; }
.red-btn--primary {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}
.red-btn--primary:hover { background: #4f46e5; border-color: #4f46e5; }
.red-btn--ghost { background: transparent; color: #64748b; }
.red-btn--ghost:hover { background: #f1f5f9; }
.red-btn--filter { position: relative; }
.red-filter-dot {
    position: absolute;
    top: 5px;
    left: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
}
.red-count { font-size: 12px; color: #94a3b8; white-space: nowrap; }

/* ─── BODY (sidebar + main) ─── */
.red-body {
    display: flex;
    flex: 1;
    gap: 0;
    position: relative;
}

/* ─── FILTER PANEL ─── */
.red-filter-panel {
    width: 0;
    overflow: hidden;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    transition: width .25s ease;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.red-filter-panel--open { width: 280px; overflow-y: auto; }

.red-fp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    font-weight: 700;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}
.red-fp-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #94a3b8;
    padding: 2px 6px;
    border-radius: 6px;
}
.red-fp-close:hover { background: #f1f5f9; color: #334155; }

.red-fp-section { padding: 14px 16px; border-bottom: 1px solid #f1f5f9; }
.red-fp-title { font-size: 12px; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 10px; }
.red-fp-hint  { font-size: 11px; color: #94a3b8; margin-bottom: 8px; }

.red-def-row { display: flex; gap: 8px; }
.red-def-box { flex: 1; }
.red-def-lbl { font-size: 11px; font-weight: 600; margin-bottom: 4px; }

.red-num-input, .red-fp-inp {
    width: 100%;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    text-align: center;
    outline: none;
    box-sizing: border-box;
    background: #f8fafc;
    transition: border-color .2s;
}
.red-num-input:focus, .red-fp-inp:focus { border-color: #6366f1; background: #fff; }

.red-def-preview {
    margin-top: 10px;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    font-size: 12px;
    text-align: center;
    color: #475569;
}

.red-checks { display: flex; flex-direction: column; gap: 6px; }
.red-check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background .15s;
}
.red-check-item:hover { background: #f8fafc; }
.red-check-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.red-range-row { display: flex; align-items: center; gap: 8px; }
.red-range-sep { color: #94a3b8; font-size: 14px; }
.red-fp-inp { text-align: center; }

.red-fp-footer {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}
.red-fp-footer .red-btn { width: 100%; text-align: center; }

/* ─── MAIN (cards grid) ─── */
.red-main {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}
.red-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* ─── CARD ─── */
.red-card {
    background: #fff;
    border-radius: 12px;
    border-top: 3px solid #e2e8f0;
    padding: 16px;
    cursor: pointer;
    transition: box-shadow .2s, transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.red-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    transform: translateY(-2px);
}

.red-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}
.red-card-name { flex: 1; min-width: 0; }
.red-card-title {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.red-card-dist {
    display: inline-block;
    margin-top: 4px;
    font-size: 11px;
    color: #fff;
    background: #64748b;
    padding: 2px 8px;
    border-radius: 20px;
}
.red-card-total { text-align: center; flex-shrink: 0; }
.red-total-n {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
    direction: ltr;
}
.red-total-u { font-size: 11px; color: #94a3b8; }

/* 4 stats row */
.red-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}
.red-stat {
    background: var(--sb, #f8fafc);
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 8px;
    padding: 6px 4px;
    text-align: center;
}
.red-stat-n {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--sc, #334155);
    direction: ltr;
    line-height: 1.2;
}
.red-stat-l { font-size: 10px; color: #64748b; }

/* progress bar */
.red-bbar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.red-bbar {
    flex: 1;
    height: 5px;
    background: #f1f5f9;
    border-radius: 99px;
    overflow: hidden;
}
.red-bbar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width .5s;
}
.red-bbar-pct { font-size: 11px; font-weight: 600; min-width: 30px; text-align: left; }

/* card footer */
.red-card-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.red-accent-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}
.red-avg { font-size: 11px; color: #64748b; margin-right: auto; }
.red-sbar {
    display: flex;
    border-radius: 20px;
    overflow: hidden;
    height: 6px;
    min-width: 60px;
    flex: 1;
    max-width: 120px;
    background: #f1f5f9;
}

/* ─── loading / empty / error ─── */
.red-loading, .red-empty, .red-error {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    font-size: 16px;
    width: 100%;
}
.red-error { color: #ef4444; }

/* ─── DETAIL OVERLAY ─── */
.red-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    backdrop-filter: blur(2px);
}
.red-detail-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.red-dm-hdr {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 20px 14px;
    border-bottom: 1px solid #f1f5f9;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
    border-radius: 16px 16px 0 0;
}
.red-dm-title { font-size: 18px; font-weight: 700; color: #1e293b; margin: 0 0 4px; }
.red-dm-sub   { font-size: 13px; color: #64748b; }
.red-dm-close {
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    color: #64748b;
    flex-shrink: 0;
}
.red-dm-close:hover { background: #e2e8f0; color: #1e293b; }

.red-dm-body { padding: 16px 20px 24px; }
.red-dm-bigstats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.red-dm-bs {
    flex: 1;
    min-width: 80px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
    background: #f8fafc;
}
.red-dm-bsv { font-size: 20px; font-weight: 800; color: #1e293b; direction: ltr; }
.red-dm-bsl { font-size: 11px; color: #64748b; margin-top: 2px; }

.red-dm-section {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 16px 0 8px;
}
.red-dm-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid #f8fafc;
    font-size: 13px;
    color: #475569;
}
.red-dm-row:last-child { border-bottom: none; }
.red-dm-row b { color: #1e293b; }
