/* ================================================================
   Contracts Module CSS — ثمن
================================================================ */

/* ── Layout ────────────────────────────────────────────────────── */
.contract-wrap {
    display: flex;
    gap: 0;
    height: calc(100vh - 160px);
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.contract-list-pane {
    width: 380px;
    min-width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e2e8f0;
    overflow: hidden;
}

.contract-detail-pane {
    flex: 1;
    width: 0;
    overflow: hidden;
    transition: width 0.3s ease;
    background: #f8fafc;
}

.contract-detail-pane--open {
    width: 100%;
    overflow-y: auto;
}

.contract-detail-inner {
    padding: 20px;
    direction: rtl;
}

/* ── Toolbar ───────────────────────────────────────────────────── */
.contract-toolbar {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
    background: #f8fafc;
}

.contract-toolbar .acc-input {
    flex: 1;
    min-width: 120px;
}

/* ── List ──────────────────────────────────────────────────────── */
.contract-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.contract-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.15s;
    direction: rtl;
}

.contract-card:hover { border-color: #3b82f6; box-shadow: 0 2px 8px rgba(59,130,246,.12); }
.contract-card--active { border-color: #3b82f6; background: #eff6ff; }

.contract-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.contract-card__title {
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contract-card__num     { font-size: 11px; color: #94a3b8; margin-bottom: 2px; }
.contract-card__parties { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.contract-card__amount  { font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 6px; }
.contract-card__due     { font-size: 11px; color: #f59e0b; margin-top: 4px; }

.contract-card__progress-label {
    font-size: 10px;
    color: #94a3b8;
    text-align: left;
    margin-top: 2px;
}

/* ── Progress Bar ──────────────────────────────────────────────── */
.contract-progress-bar {
    background: #e2e8f0;
    border-radius: 4px;
    height: 5px;
    overflow: hidden;
    margin: 4px 0;
}

.contract-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 2px;
}

/* ── Type & Status Badges ──────────────────────────────────────── */
.contract-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

.contract-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Detail Panel ──────────────────────────────────────────────── */
.contract-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
}

.contract-detail-title {
    font-size: 17px;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.4;
}

/* ── Financial Summary ─────────────────────────────────────────── */
.contract-financial-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.contract-fin-item {
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px 12px;
    text-align: center;
    font-size: 11px;
    color: #64748b;
}

.contract-fin-item b { display: block; font-size: 13px; color: #1e293b; margin-top: 2px; }
.contract-fin-item--paid   b { color: #10b981; }
.contract-fin-item--remain b { color: #ef4444; }

/* ── Tab Body ──────────────────────────────────────────────────── */
.contract-tab-body {
    min-height: 200px;
    overflow-y: auto;
}

/* ── Party Card ────────────────────────────────────────────────── */
.contract-party-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}

/* ── Payment Row ───────────────────────────────────────────────── */
.contract-payments-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.contract-payment-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.contract-payment-row--overdue {
    background: #fef2f2;
    border-color: #fca5a5;
}

.contract-payment-row__num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    flex-shrink: 0;
}

.contract-payment-row__body { flex: 1; }

/* ── Calendar Section ──────────────────────────────────────────── */
.contract-cal-section { margin-bottom: 24px; }

.contract-cal-section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
}

.contract-cal-total { font-size: 12px; font-weight: 600; color: #64748b; }

.contract-cal-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 8px;
    direction: rtl;
}

.contract-cal-item__meta   { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.contract-cal-item__title  { font-weight: 700; font-size: 13px; color: #1e293b; }
.contract-cal-item__desc   { font-size: 12px; color: #64748b; margin-top: 2px; }

/* ── KPI Cards ─────────────────────────────────────────────────── */
.contract-kpi-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}

.contract-kpi-label { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.contract-kpi-value { font-size: 20px; font-weight: 800; margin-bottom: 2px; }
.contract-kpi-sub   { font-size: 11px; color: #94a3b8; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .contract-wrap { flex-direction: column; height: auto; }
    .contract-list-pane { width: 100%; border-left: none; border-bottom: 1px solid #e2e8f0; max-height: 40vh; }
    .contract-detail-pane--open { width: 100%; }
    .contract-financial-summary { grid-template-columns: 1fr 1fr; }
}
