/* ============================================================
   Path: src/RichRich.Web/wwwroot/css/journals-classical.css
   Session: J-AMERICAN-FONT-FIX  MODIFIED — Original from JE-CLASSICAL-UX
   LastModified: 2026-06-25
   J-AMERICAN-FONT-FIX: إعادة خط الجدول الأمريكي لحجم الكلاسيكي (أُزيل 0.86rem)
     + تضييق عمودَي المبلغ (مدين/دائن، nth-last-child) اللذين كانا عريضين.
   J-JOURNAL-UX-FIX: + rr-american-table (nowrap هيدر + تاريخ/رقم، خط أصغر).
   Module: M06 Accounting — modern UI redesign
   ============================================================
   Changes (JE-UX-V2):
   - Tabs: segmented-control modern style (Apple/Stripe-like) — pill
     container with elevated active tab + soft shadow
   - Modern table: card-style rows مع borders صريحة (لا dependence على
     CSS tokens خفيفة) + uppercase headers + hover ملوّن واضح + striping
   - Classical: borders قوية كما كانت
   ============================================================ */

/* ─────────────────────────────────────────────────────────
   Tabs — Segmented Control (modern Apple/Stripe style)
   ───────────────────────────────────────────────────────── */
.rr-view-tabs {
    display: inline-flex;
    background-color: #f1f3f5;
    border-radius: 12px;
    padding: 4px;
    gap: 2px;
    margin-bottom: 1.5rem;
    list-style: none;
    border: none;
}

[data-bs-theme="dark"] .rr-view-tabs {
    background-color: rgba(255, 255, 255, 0.06);
}

.rr-view-tabs .nav-item {
    margin: 0;
}

.rr-view-tabs .nav-link {
    border: none;
    border-radius: 9px;
    padding: 0.55rem 1.3rem;
    color: #6b7280;
    background-color: transparent;
    font-weight: 500;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.rr-view-tabs .nav-link:hover:not(.active) {
    color: #1f2937;
    background-color: rgba(255, 255, 255, 0.5);
}

.rr-view-tabs .nav-link.active {
    background-color: #ffffff;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    font-weight: 600;
}

.rr-view-tabs .nav-link i {
    font-size: 1.05rem;
}

[data-bs-theme="dark"] .rr-view-tabs .nav-link {
    color: rgba(255, 255, 255, 0.65);
}
[data-bs-theme="dark"] .rr-view-tabs .nav-link:hover:not(.active) {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.06);
}
[data-bs-theme="dark"] .rr-view-tabs .nav-link.active {
    background-color: rgba(255, 255, 255, 0.12);
    color: #60a5fa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ─────────────────────────────────────────────────────────
   Modern table — card-style rows with explicit borders
   ───────────────────────────────────────────────────────── */
.rr-journals-modern .table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

[data-bs-theme="dark"] .rr-journals-modern .table {
    background-color: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.12);
}

.rr-journals-modern .table > thead > tr > th {
    background-color: #f9fafb !important;
    border-top: none !important;
    border-bottom: 1px solid #e5e7eb !important;
    padding: 0.85rem 1rem !important;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

[data-bs-theme="dark"] .rr-journals-modern .table > thead > tr > th {
    background-color: rgba(255, 255, 255, 0.04) !important;
    border-bottom-color: rgba(255, 255, 255, 0.12) !important;
    color: rgba(255, 255, 255, 0.7);
}

.rr-journals-modern .table > tbody > tr > td {
    border-top: none !important;
    border-bottom: 1px solid #e5e7eb !important;
    padding: 0.95rem 1rem !important;
    vertical-align: middle;
    color: var(--text-default, #111827);
}

[data-bs-theme="dark"] .rr-journals-modern .table > tbody > tr > td {
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

.rr-journals-modern .table > tbody > tr:last-child > td {
    border-bottom: none !important;
}

.rr-journals-modern .table > tbody > tr {
    transition: background-color 0.15s ease;
}

.rr-journals-modern .table > tbody > tr:hover {
    background-color: rgba(37, 99, 235, 0.05) !important;
}

[data-bs-theme="dark"] .rr-journals-modern .table > tbody > tr:hover {
    background-color: rgba(96, 165, 250, 0.08) !important;
}

/* أرقام مالية واضحة. */
.rr-journals-modern .table td.text-end {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

/* ─────────────────────────────────────────────────────────
   Classical view — traditional accounting layout (strong borders)
   ───────────────────────────────────────────────────────── */
.rr-classical-wrapper {
    padding: 0;
}

.rr-classical-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
    border: 2px solid #1a1a1a;
    font-size: 0.95rem;
}

[data-bs-theme="dark"] .rr-classical-table {
    background-color: var(--card-bg);
    border: 2px solid #c0c0c0;
}

.rr-classical-table th {
    border: 1px solid #1a1a1a;
    padding: 0.65rem 0.8rem;
    text-align: center;
    background-color: #e6e6e6;
    font-weight: 700;
    color: #1a1a1a;
}

[data-bs-theme="dark"] .rr-classical-table th {
    border: 1px solid #c0c0c0;
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-default);
}

.rr-classical-table td {
    border: 1px solid #555;
    padding: 0.55rem 0.8rem;
    text-align: right;
    color: var(--text-default, #111827);
}

[data-bs-theme="dark"] .rr-classical-table td {
    border: 1px solid #888;
}

.rr-classical-table td.text-end {
    text-align: end;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.rr-classical-table td.text-center {
    text-align: center;
}

/* J-JOURNAL-UX-FIX + J-AMERICAN-FONT-FIX: الجدول الأمريكي.
   nowrap للهيدر وعمودَي التاريخ/الرقم (منع التفاف لصفّين).
   J-AMERICAN-FONT-FIX: الخط = حجم الكلاسيكي (يرث 0.95rem، أُزيل 0.86rem) +
   تضييق عمودَي المبلغ (مدين/دائن = آخر عمودين) اللذين كانا عريضين بمحتوى صغير. */
.rr-american-table th {
    white-space: nowrap;
    padding: 0.55rem 0.5rem;
}
.rr-american-table td { padding: 0.5rem 0.5rem; }
/* J-AMJ-UX2 (بلاغ طه): أعمدة متساوية. table-layout:fixed + أصناف عرض صريحة على
   رأس الجدول تُحدّد الأعمدة:
     • التاريخ: ثابت ضيّق.
     • البيان: أوسع (16rem).
     • كل حساب (colspan=2): 11rem ⇒ مدين=دائن=5.5rem (متساويان دائماً، وكل
       الحسابات متساوية لأن جميعها 11rem).
     • البيان: 22rem = ضعف عمود الحساب. التاريخ: 8rem. «حسابات أخرى»: 20rem. */
/* J-AMJ-UX3 (بلاغ طه): عروض محسّنة.
     • عمود المبلغ الواحد (مدين/دائن) = 5.5rem — متساويان دائماً.
     • كل حساب (colspan=2) = 11rem (مدين 5.5 + دائن 5.5).
     • البيان = 22rem ⇒ ضعف عرض عمود الحساب (وأربعة أضعاف عمود مبلغ مفرد).
     • التاريخ = 8rem (يسع «2026-07-31» بلا التفاف).
     • «حسابات أخرى» = 20rem (أوسع). */
.rr-american-table {
    table-layout: fixed;
}
.rr-american-table .rr-am-col-date {
    width: 8rem;
    white-space: nowrap;
}
.rr-american-table .rr-am-col-statement {
    width: 22rem;
}
.rr-american-table .rr-am-col-acc {
    width: 11rem;    /* 5.5rem مدين + 5.5rem دائن */
}
.rr-american-table .rr-am-general {
    width: 20rem;
}
/* عمود البيان: التفاف مناسب. */
.rr-american-table tbody td:nth-child(2) {
    white-space: normal;
    word-break: break-word;
}
/* خلايا المبالغ + رأس مدين/دائن: عرض صريح متساوٍ (5.5rem) + بلا التفاف. */
.rr-american-table td.text-end,
.rr-american-table th.rr-classical-amount-col {
    width: 5.5rem;
    white-space: nowrap;
}

.rr-classical-date-col    { width: 13%; white-space: nowrap; }
.rr-classical-account-col { width: 47%; }
.rr-classical-ref-col     { width: 12%; }
.rr-classical-amount-col  { width: 14%; }

.rr-classical-table .rr-indented {
    padding-right: 2.5rem;
}

.rr-classical-table .rr-from-account {
    font-weight: 700;
}

.rr-classical-table .rr-description-row td {
    font-style: italic;
    border-top: 2px dashed #666;
    padding: 0.5rem 0.8rem 0.65rem;
    color: var(--text-muted, #6b7280);
    text-align: center;
    background-color: transparent;
}

[data-bs-theme="dark"] .rr-classical-table .rr-description-row td {
    border-top: 2px dashed #999;
}

/* 5 ألوان متناوبة. */
.rr-classical-table .rr-group-1 { background-color: #ffffff; }
.rr-classical-table .rr-group-2 { background-color: #f2f8fd; }
.rr-classical-table .rr-group-3 { background-color: #fff8f2; }
.rr-classical-table .rr-group-4 { background-color: #f2fff8; }
.rr-classical-table .rr-group-5 { background-color: #f7f7ff; }

[data-bs-theme="dark"] .rr-classical-table .rr-group-1 { background-color: var(--card-bg); }
[data-bs-theme="dark"] .rr-classical-table .rr-group-2 { background-color: rgba(13, 110, 253, 0.08); }
[data-bs-theme="dark"] .rr-classical-table .rr-group-3 { background-color: rgba(255, 152, 0, 0.07); }
[data-bs-theme="dark"] .rr-classical-table .rr-group-4 { background-color: rgba(40, 167, 69, 0.07); }
[data-bs-theme="dark"] .rr-classical-table .rr-group-5 { background-color: rgba(111, 66, 193, 0.07); }

.rr-classical-table .rr-total-row {
    background-color: #ececec;
    font-weight: 800;
}

.rr-classical-table .rr-total-row td {
    border-top: 4px double #1a1a1a;
    padding: 0.75rem 0.8rem;
    color: #1a1a1a;
}

[data-bs-theme="dark"] .rr-classical-table .rr-total-row {
    background-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .rr-classical-table .rr-total-row td {
    border-top: 4px double #c0c0c0;
    color: var(--text-default);
}

/* ─────────────────────────────────────────────────────────
   Detail page — hero header + meta row (DETAIL-UX-FIX)
   ───────────────────────────────────────────────────────── */
.rr-detail-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

[data-bs-theme="dark"] .rr-detail-hero {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.rr-detail-hero-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.rr-entry-number {
    color: #6b7280;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    font-weight: 500;
}

[data-bs-theme="dark"] .rr-entry-number {
    color: rgba(255, 255, 255, 0.55);
}

.rr-detail-hero-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.rr-detail-hero-actions .btn {
    padding: 0.5rem 1rem;
    font-weight: 500;
}

.rr-detail-hero-actions .btn i {
    margin-inline-end: 0.35rem;
}

/* Meta card — single horizontal row + description below */
.rr-detail-meta .rr-meta-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
    border-bottom: 1px dashed #e5e7eb;
    margin-bottom: 1rem;
}

[data-bs-theme="dark"] .rr-detail-meta .rr-meta-row {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.rr-detail-meta .rr-meta-badge {
    font-size: 0.85rem;
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
}

.rr-detail-meta .rr-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-default, #111827);
    font-size: 0.93rem;
}

.rr-detail-meta .rr-meta-item i {
    color: #6b7280;
    font-size: 1.05rem;
}

.rr-detail-meta .rr-meta-label {
    color: #6b7280;
    font-size: 0.85rem;
}

.rr-detail-meta .rr-meta-description {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
}

.rr-detail-meta .rr-meta-description i {
    color: #6b7280;
    font-size: 1.1rem;
    margin-top: 0.15rem;
}

.rr-detail-meta .rr-meta-description-content {
    flex: 1;
    color: var(--text-default, #111827);
    line-height: 1.6;
}

/* ─────────────────────────────────────────────────────────
   PaginationBar — shared pagination toolbar (PAGINATION-SHARED)
   ───────────────────────────────────────────────────────── */
.rr-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.9rem;
}

[data-bs-theme="dark"] .rr-pagination-bar {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.rr-page-info {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    color: var(--text-default, #111827);
}

.rr-page-info strong {
    color: #2563eb;
    font-weight: 600;
}

[data-bs-theme="dark"] .rr-page-info strong {
    color: #60a5fa;
}

.rr-info-muted {
    color: #6b7280;
}

[data-bs-theme="dark"] .rr-info-muted {
    color: rgba(255, 255, 255, 0.6);
}

.rr-info-sep {
    color: #d1d5db;
    margin: 0 0.25rem;
}

.rr-page-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.rr-page-size-selector {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 3px;
}

[data-bs-theme="dark"] .rr-page-size-selector {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.rr-page-size-label {
    padding: 0 0.5rem;
    color: #6b7280;
    font-size: 0.85rem;
}

.rr-page-size-btn {
    border: none;
    background: transparent;
    color: #6b7280;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
    min-width: 38px;
}

.rr-page-size-btn:hover:not(.active) {
    background-color: #f3f4f6;
    color: #1f2937;
}

.rr-page-size-btn.active {
    background-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

[data-bs-theme="dark"] .rr-page-size-btn:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

/* ─────────────────────────────────────────────────────────
   Modern table — footer totals row (PAGINATION-SHARED)
   ───────────────────────────────────────────────────────── */
.rr-journals-modern .table > tfoot > tr.rr-totals-row > td {
    background-color: #f3f4f6 !important;
    border-top: 2px solid #d1d5db !important;
    padding: 0.85rem 1rem !important;
    font-weight: 700;
    color: #111827;
}

[data-bs-theme="dark"] .rr-journals-modern .table > tfoot > tr.rr-totals-row > td {
    background-color: rgba(255, 255, 255, 0.08) !important;
    border-top-color: rgba(255, 255, 255, 0.15) !important;
    color: var(--text-default);
}

.rr-journals-modern .table > tfoot > tr.rr-totals-row > td.text-end {
    font-variant-numeric: tabular-nums;
    color: #2563eb;
}

[data-bs-theme="dark"] .rr-journals-modern .table > tfoot > tr.rr-totals-row > td.text-end {
    color: #60a5fa;
}

/* ============================================================
   J-AMJ-UX — الدفتر الأمريكي (columnar): شريط التحكم + الرقائق +
   overflow أفقي على الجدول فقط + عمود «حسابات أخرى».
   ============================================================ */

/* شريط التحكم: الأزرار عند البداية (يمين RTL)، الملاحظة عند أقصى اليسار. */
.rr-am-controls {
    display: flex;
    justify-content: space-between;   /* أزرار يمين · ملاحظة أقصى اليسار */
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.rr-am-controls-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
/* الملاحظة داخل السطر (بجانب الأزرار) — بلا هامش سفلي، تتمدّد لتملأ اليسار. */
.rr-am-note-inline {
    flex: 1 1 auto;
    min-width: 14rem;
    margin-bottom: 0;
}
/* قائمة عدد الأعمدة بمحاذاة الزرّين. */
.rr-am-topn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.rr-am-topn-label {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
    white-space: nowrap;
}
.rr-am-topn-select {
    width: auto;
    min-width: 5rem;
}

/* الملاحظة الإرشادية. */
.rr-am-note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.75rem;
    background: #f3f6fb;
    border: 1px solid #dbe4f0;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted, #475569);
}
[data-bs-theme="dark"] .rr-am-note {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
}
.rr-am-note i { margin-top: 0.15rem; color: #4a6da8; }

/* رقائق الأعمدة. */
.rr-am-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}
.rr-am-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.7rem;
    border-radius: 20px;
    background: #fbf3e2;
    border: 1px solid #c5a55a;
    color: #1a2b4a;
    font-size: 0.82rem;
    font-weight: 600;
    user-select: none;
}
[data-bs-theme="dark"] .rr-am-chip {
    background: rgba(197, 165, 90, 0.14);
    color: var(--text-default);
}
.rr-am-chip.clickable { cursor: pointer; }
.rr-am-chip.clickable:hover { filter: brightness(0.97); }
.rr-am-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #b8892b;
}
.rr-am-count {
    font-size: 0.72rem;
    background: rgba(26, 43, 74, 0.08);
    padding: 0.05rem 0.45rem;
    border-radius: 9px;
    color: var(--text-muted, #5b6472);
    font-weight: 700;
}

/* ⭐ overflow أفقي على الجدول فقط (بلاغ طه) — لا على الصفحة. */
.rr-am-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}
/* داخل السكرول: الجدول يأخذ مجموع عروض أعمدته الصريحة (max-content) فلا ينكمش
   أيّ عمود عند زيادة عدد الأعمدة — والزائد يذهب للتمرير الأفقي وحده (بلاغ طه).
   min-width:100% يملأ الحاوية حين تكون الأعمدة قليلة. */
.rr-am-scroll > .rr-american-table {
    width: max-content;
    min-width: 100%;
}

/* عمود «حسابات أخرى». */
.rr-am-general {
    text-align: start;
    white-space: normal;
    min-width: 12rem;
    font-size: 0.78rem;
    color: var(--text-muted, #5b6472);
}
.rr-am-gitem { display: block; margin: 0.1rem 0; }
.rr-am-tag {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 800;
    padding: 0.03rem 0.35rem;
    border-radius: 4px;
    margin-inline-end: 0.25rem;
}
.rr-am-tag.d { background: #e8eef7; color: #1a2b4a; }
.rr-am-tag.c { background: #e4f2eb; color: #166a4d; }
.rr-am-credit { color: #166a4d; }
[data-bs-theme="dark"] .rr-am-credit { color: #6ee7b7; }

/* J-AMJ-NET (بلاغ طه): عمودا التحقق (إجمالي مدين/دائن القيد) في نهاية الجدول. */
.rr-american-table .rr-am-col-net { width: 11rem; }
.rr-american-table td.rr-am-net {
    width: 5.5rem;
    white-space: nowrap;
    font-weight: 600;
    background: rgba(26, 43, 74, 0.03);
}
[data-bs-theme="dark"] .rr-american-table td.rr-am-net {
    background: rgba(255, 255, 255, 0.03);
}
