/* ================================================================
   CRM Module Styles — مدیریت ارتباط با مشتری
   پایپ‌لاین Kanban | پانل جزئیات لید | داشبورد
================================================================ */

/* ── Wrap اصلی ─────────────────────────────────────────────── */
.crm-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
    min-height: 500px;
    background: #f8fafc;
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid #e2e8f0;
}

/* ── Toolbar ────────────────────────────────────────────────── */
.crm-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1.5px solid #e2e8f0;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* ── Board ──────────────────────────────────────────────────── */
.crm-board-wrap {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.crm-board {
    display: flex;
    gap: 10px;
    padding: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    align-items: flex-start;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.crm-board::-webkit-scrollbar        { height: 6px; }
.crm-board::-webkit-scrollbar-track  { background: transparent; }
.crm-board::-webkit-scrollbar-thumb  { background: #cbd5e1; border-radius: 3px; }

/* ── ستون Kanban ─────────────────────────────────────────────── */
.crm-col {
    min-width: 200px;
    max-width: 220px;
    flex-shrink: 0;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.crm-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.crm-col-count {
    color: #fff;
    border-radius: 12px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 800;
}

.crm-col-body {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

/* ── کارت لید ───────────────────────────────────────────────── */
.crm-lead-card {
    background: #fff;
    border-radius: 8px;
    padding: 10px;
    border: 1.5px solid #e2e8f0;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .1s;
    font-size: 12px;
    direction: rtl;
}

.crm-lead-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59,130,246,.12);
    transform: translateY(-1px);
}

.crm-lead-card--active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.2);
}

.crm-lead-card--cold {
    border-color: #fcd34d;
    background: #fffbeb;
}

.crm-lead-name {
    font-weight: 700;
    font-size: 13px;
    color: #1e293b;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-lead-phone,
.crm-lead-budget,
.crm-lead-project {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-lead-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.crm-score-badge {
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 700;
}

/* ── پانل جزئیات ────────────────────────────────────────────── */
.crm-detail-pane {
    width: 0;
    overflow: hidden;
    background: #fff;
    border-left: 1.5px solid #e2e8f0;
    transition: width .25s ease;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.crm-detail-pane--open {
    width: 380px;
}

.crm-detail-inner {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    direction: rtl;
    scrollbar-width: thin;
}

.crm-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.crm-detail-name {
    font-size: 16px;
    font-weight: 800;
    color: #1e293b;
}

.crm-quick-info {
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px;
    font-size: 12px;
    color: #475569;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    line-height: 1.7;
}

/* ── انتخاب مرحله ───────────────────────────────────────────── */
.crm-stage-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}

.crm-stage-btn {
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #475569;
    transition: all .12s;
    white-space: nowrap;
}

.crm-stage-btn:hover {
    opacity: .85;
    transform: scale(1.03);
}

.crm-stage-btn--active {
    font-weight: 800;
}

/* ── تایم‌لاین فعالیت‌ها ────────────────────────────────────── */
.crm-timeline {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.crm-tl-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 8px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 12px;
}

.crm-tl-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.crm-tl-body {
    flex: 1;
    min-width: 0;
}

/* ── یادآور ─────────────────────────────────────────────────── */
.crm-reminder-card {
    background: #fff;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    font-size: 12px;
    border: 1px solid #e2e8f0;
}

/* ── واحد پیشنهادی ──────────────────────────────────────────── */
.crm-unit-card {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    font-size: 12px;
}

/* ── داشبورد KPI ─────────────────────────────────────────────── */
.crm-dash-wrap {
    padding: 16px;
    direction: rtl;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}
