/* ================================================================
   Treasury Module CSS — خزانه پروژه ثمن
================================================================ */

/* ── KPI Grid ──────────────────────────────────────────────────── */
.treasury-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.treasury-kpi {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.treasury-kpi--expense { border-top: 3px solid #ef4444 !important; }
.treasury-kpi--income  { border-top: 3px solid #10b981 !important; }

.treasury-kpi-icon  { font-size: 22px; margin-bottom: 4px; }
.treasury-kpi-label { font-size: 11px; color: #64748b; margin-bottom: 6px; }
.treasury-kpi-value { font-size: 20px; font-weight: 800; color: #1e293b; }
.treasury-kpi-sub   { font-size: 10px; color: #94a3b8; margin-top: 2px; }

/* ── Two Column Layout ─────────────────────────────────────────── */
.treasury-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* ── Card ──────────────────────────────────────────────────────── */
.treasury-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.treasury-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

/* ── Progress Bar ──────────────────────────────────────────────── */
.treasury-bar-track {
    background: #e2e8f0;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.treasury-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: #3b82f6;
    transition: width 0.5s ease;
    min-width: 2px;
}

.treasury-bar-fill--warn { background: #f59e0b; }
.treasury-bar-fill--over { background: #ef4444; }

/* ── Entry Row ─────────────────────────────────────────────────── */
.treasury-entry-row {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 12px;
    direction: rtl;
}

.treasury-entry-row:last-child { border-bottom: none; }

/* ── Monthly Chart ─────────────────────────────────────────────── */
.treasury-monthly-chart {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    padding: 8px 0;
}

.treasury-month-col { display: flex; flex-direction: column; align-items: center; }

/* ── Ledger Table ──────────────────────────────────────────────── */
.treasury-ledger {
    direction: rtl;
    width: 100%;
    overflow-x: auto;
}

.treasury-ledger-header,
.treasury-ledger-row {
    display: grid;
    grid-template-columns: 90px 2fr 1fr 1fr 1fr 1fr 1fr 80px;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    font-size: 12px;
}

.treasury-ledger-header {
    background: #f8fafc;
    border-radius: 8px 8px 0 0;
    font-weight: 700;
    color: #64748b;
    font-size: 11px;
    border-bottom: 2px solid #e2e8f0;
}

.treasury-ledger-row {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}

.treasury-ledger-row:hover { background: #f8fafc; }
.treasury-ledger-row--in  { background: rgba(16,185,129,.03); }
.treasury-ledger-row--out { background: rgba(239,68,68,.03); }

/* ── Overview Table ────────────────────────────────────────────── */
.treasury-overview-table { direction: rtl; }

.treasury-overview-header,
.treasury-overview-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr 1.5fr 1fr 80px;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    font-size: 12px;
}

.treasury-overview-header {
    background: #f8fafc;
    border-radius: 8px;
    font-weight: 700;
    color: #64748b;
    font-size: 11px;
    margin-bottom: 4px;
}

.treasury-overview-row {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 6px;
    transition: box-shadow 0.15s;
}

.treasury-overview-row:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }

/* ── Direction Buttons ─────────────────────────────────────────── */
.treasury-dir-opt { cursor: pointer; border-radius: 8px; padding: 8px 16px; border: 2px solid #e2e8f0; font-size: 13px; transition: all 0.15s; }
.treasury-dir-opt--in  { background: #f0fdf4; }
.treasury-dir-opt--out { background: #fef2f2; }
.treasury-dir-opt--active.treasury-dir-opt--in  { border-color: #10b981; }
.treasury-dir-opt--active.treasury-dir-opt--out { border-color: #ef4444; }

/* ── Empty States ──────────────────────────────────────────────── */
.treasury-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    font-size: 14px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px dashed #e2e8f0;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .treasury-kpi-grid { grid-template-columns: repeat(2,1fr); }
    .treasury-two-col  { grid-template-columns: 1fr; }
    .treasury-ledger-header, .treasury-ledger-row { grid-template-columns: 80px 1fr 1fr 1fr 80px; }
    .treasury-ledger-header span:nth-child(3),
    .treasury-ledger-header span:nth-child(4),
    .treasury-ledger-row   span:nth-child(3),
    .treasury-ledger-row   span:nth-child(4) { display: none; }
    .treasury-overview-header,
    .treasury-overview-row { grid-template-columns: 2fr 1fr 1fr 80px; }
    .treasury-overview-header span:nth-child(4),
    .treasury-overview-header span:nth-child(5),
    .treasury-overview-row   span:nth-child(4),
    .treasury-overview-row   span:nth-child(5) { display: none; }
}
