﻿/* ==========================================================
   OFOOQX - SUB LEDGER EXCLUSIVE SCOPE (مخصص للعملاء والموردين فقط)
   ========================================================== */

.sub-ledger-scope * {
    box-sizing: border-box;
}

.sub-ledger-scope {
    width: 100%;
    max-width: 100%;
    padding: 18px;
    overflow-x: hidden;
    color: var(--text-main, #ffffff);
    direction: rtl;
}

    .sub-ledger-scope button,
    .sub-ledger-scope select,
    .sub-ledger-scope input {
        font-family: inherit;
    }

    /* ================= HEADER ================= */

    .sub-ledger-scope .module-header {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 15px;
        width: 100%;
        margin-bottom: 20px;
        flex-wrap: nowrap !important;
    }

    .sub-ledger-scope .header-title {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-shrink: 0;
    }

        .sub-ledger-scope .header-title h2 {
            margin: 0;
            font-size: 1.5rem;
            font-weight: 700;
            white-space: nowrap;
            color: var(--text-main, #ffffff);
        }

    .sub-ledger-scope .action-buttons-group {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        flex-wrap: nowrap !important;
        flex-shrink: 0;
    }

    /* ================= BRANCH ================= */

    .sub-ledger-scope .branch-select-wrapper {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 170px;
        height: 42px;
        padding: 0 12px;
        background: var(--bg-side, #121814);
        border: 1px solid var(--border-color, #223026);
        border-radius: 9px;
        flex-shrink: 0;
    }

        .sub-ledger-scope .branch-select-wrapper i {
            font-size: 20px;
            color: var(--accent, #00c862);
        }

        .sub-ledger-scope .branch-select-wrapper select {
            width: 100%;
            border: none;
            outline: none;
            background: transparent;
            color: var(--text-main, #ffffff);
            cursor: pointer;
            font-weight: 600;
        }

            .sub-ledger-scope .branch-select-wrapper select option {
                background: var(--bg-side, #121814);
                color: var(--text-main, #ffffff);
            }

    /* ================= BUTTONS ================= */

    .sub-ledger-scope .premium-btn {
        min-height: 42px;
        border: none;
        border-radius: 9px;
        padding: 9px 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        font-size: 13px;
        font-weight: 700;
        cursor: pointer;
        transition: .2s ease;
        white-space: nowrap;
    }

        .sub-ledger-scope .premium-btn:hover:not(:disabled) {
            transform: translateY(-1px);
            opacity: 0.9;
        }

        .sub-ledger-scope .premium-btn:disabled {
            opacity: .45;
            cursor: not-allowed;
        }

    .sub-ledger-scope .btn-success {
        background: var(--accent, #00c862);
        color: #ffffff !important;
    }

    .sub-ledger-scope .btn-danger-action {
        background: #dc2626;
        color: #ffffff !important;
    }

    .sub-ledger-scope .btn-cancel {
        background: var(--bg-top, #18221b);
        border: 1px solid var(--border-color, #223026);
        color: var(--text-main, #ffffff);
    }

    .sub-ledger-scope .back-btn {
        border: none;
        background: transparent;
        color: var(--text-muted, #9ca3af);
        display: inline-flex;
        align-items: center;
        gap: 5px;
        cursor: pointer;
        font-weight: 700;
        font-size: 12px;
        padding: 0;
    }

        .sub-ledger-scope .back-btn:hover {
            color: var(--accent, #00c862);
        }

    /* ================= STATS ================= */

    .sub-ledger-scope .stats-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 15px;
        margin-bottom: 18px;
    }

    .sub-ledger-scope .account-details-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .sub-ledger-scope .stat-card {
        min-width: 0;
        background: var(--bg-side, #121814);
        border: 1px solid var(--border-color, #223026);
        border-radius: 12px;
        padding: 17px;
        display: flex;
        align-items: center;
        gap: 13px;
        min-height: 90px;
    }

    .sub-ledger-scope .stat-card-account {
        border-right: 4px solid var(--accent, #00c862);
    }

    .sub-ledger-scope .stat-icon {
        width: 42px;
        height: 42px;
        min-width: 42px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sub-ledger-scope .icon-account {
        background: rgba(0, 200, 98, 0.15);
        color: var(--accent, #00c862);
    }

    .sub-ledger-scope .icon-warning {
        background: rgba(249, 115, 22, 0.15);
        color: #f97316;
    }

    .sub-ledger-scope .stat-details {
        min-width: 0;
    }

    .sub-ledger-scope .stat-label {
        display: block;
        color: var(--text-muted, #9ca3af);
        font-size: 11px;
        font-weight: 600;
        margin-bottom: 5px;
    }

    .sub-ledger-scope .stat-value {
        display: block;
        font-size: 18px;
        font-weight: 800;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--text-main, #ffffff);
    }

    .sub-ledger-scope .text-account {
        color: var(--accent, #00c862);
    }

    .sub-ledger-scope .text-danger {
        color: #ef4444 !important;
    }

    .sub-ledger-scope .text-success {
        color: var(--accent, #00c862) !important;
    }

    .sub-ledger-scope .text-warning {
        color: #f59e0b !important;
    }

    .sub-ledger-scope .text-main-color {
        color: var(--text-main, #ffffff) !important;
    }

    .sub-ledger-scope .text-muted {
        color: var(--text-muted, #9ca3af) !important;
    }

    .sub-ledger-scope .balance-card {
        border-right: 4px solid #ef4444;
    }

    .sub-ledger-scope .address-value {
        white-space: nowrap;
    }

    /* ================= FILTER ================= */

    .sub-ledger-scope .filter-bar {
        width: 100%;
        display: flex;
        align-items: flex-end;
        gap: 14px;
        padding: 15px;
        background: var(--bg-side, #121814);
        border: 1px solid var(--border-color, #223026);
        border-radius: 12px;
        margin-bottom: 18px;
        flex-wrap: wrap;
    }

    .sub-ledger-scope .filter-item {
        flex: 1;
        min-width: 180px;
    }

    .sub-ledger-scope .search-filter {
        width: 100%;
    }

    .sub-ledger-scope .filter-label {
        display: block;
        font-size: 11px;
        font-weight: 800;
        color: var(--text-muted, #9ca3af);
        margin-bottom: 6px;
    }

    .sub-ledger-scope .filter-control {
        width: 100%;
        height: 42px;
        border: 1px solid var(--border-color, #223026);
        background: var(--bg-app, #0b100d);
        border-radius: 8px;
        padding: 0 11px;
        outline: none;
        color: var(--text-main, #ffffff);
        font-weight: 600;
    }

        .sub-ledger-scope .filter-control option {
            background: var(--bg-side, #121814);
            color: var(--text-main, #ffffff);
        }

        .sub-ledger-scope .filter-control:focus {
            border-color: var(--accent, #00c862);
        }

    .sub-ledger-scope .search-box {
        width: 100%;
        height: 43px;
        display: flex;
        align-items: center;
        gap: 8px;
        background: var(--bg-app, #0b100d);
        border: 1px solid var(--border-color, #223026);
        border-radius: 8px;
        padding: 0 12px;
    }

        .sub-ledger-scope .search-box i {
            color: var(--accent, #00c862);
            font-size: 20px;
        }

        .sub-ledger-scope .search-box input {
            width: 100%;
            border: none;
            outline: none;
            background: transparent;
            color: var(--text-main, #ffffff);
            font-weight: 600;
        }

    .sub-ledger-scope .accounting-filters {
        margin-top: 15px;
    }

    /* ================= TABLE ================= */

    .sub-ledger-scope .table-container {
        width: 100%;
        background: var(--bg-side, #121814);
        border: 1px solid var(--border-color, #223026);
        border-radius: 12px;
        padding: 5px;
        overflow: hidden;
    }

    .sub-ledger-scope .responsive-table-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sub-ledger-scope .data-table {
        width: 100%;
        min-width: 900px;
        border-collapse: collapse;
    }

        .sub-ledger-scope .data-table th {
            background: var(--bg-app, #0b100d);
            color: var(--text-muted, #9ca3af);
            font-size: 11px;
            font-weight: 800;
            text-align: right;
            padding: 13px 12px;
            border-bottom: 1px solid var(--border-color, #223026);
            white-space: nowrap;
        }

        .sub-ledger-scope .data-table td {
            padding: 13px 12px;
            border-bottom: 1px solid var(--border-color, #223026);
            font-size: 12px;
            vertical-align: middle;
            color: var(--text-main, #ffffff);
        }

        .sub-ledger-scope .data-table tbody tr:hover {
            background: rgba(0, 200, 98, 0.08);
        }

        .sub-ledger-scope .data-table tbody tr:last-child td {
            border-bottom: none;
        }

    .sub-ledger-scope .font-bold {
        font-weight: 800;
    }

    .sub-ledger-scope .font-semibold {
        font-weight: 700;
    }

    .sub-ledger-scope .text-center {
        text-align: center !important;
    }

    .sub-ledger-scope .blocked-tag {
        margin-right: 6px;
        font-size: 9px;
    }

    /* ================= STATUS ================= */

    .sub-ledger-scope .status-tag {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        padding: 5px 9px;
        border-radius: 6px;
        font-size: 10px;
        font-weight: 800;
        border: none;
    }

    .sub-ledger-scope .tag-primary {
        background: rgba(0, 200, 98, 0.15);
        color: var(--accent, #00c862);
    }

    .sub-ledger-scope .tag-success {
        background: rgba(16, 185, 129, 0.15);
        color: #10b981;
    }

    .sub-ledger-scope .tag-danger {
        background: rgba(239, 68, 68, 0.15);
        color: #ef4444;
    }

    .sub-ledger-scope .reconcile-btn {
        cursor: pointer;
        transition: .2s;
    }

        .sub-ledger-scope .reconcile-btn:hover {
            transform: translateY(-1px);
        }

    /* ================= ACCOUNT ACTIONS ================= */

    .sub-ledger-scope .account-actions {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        flex-wrap: wrap;
    }

        .sub-ledger-scope .account-actions .reconcile-btn {
            cursor: pointer;
        }

        .sub-ledger-scope .account-actions .tag-danger:hover {
            background: rgba(239, 68, 68, 0.25);
            color: #f87171;
        }

    /* ================= PAGINATION ================= */

    .sub-ledger-scope .pagination-container {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 18px 10px 10px;
        flex-wrap: wrap;
        background: var(--bg-side, #121814);
        border-top: 1px solid var(--border-color, #223026);
    }

    .sub-ledger-scope .pagination-pages {
        display: flex;
        align-items: center;
        gap: 5px;
    }

    .sub-ledger-scope .page-number {
        width: 34px;
        height: 34px;
        min-width: 34px;
        border: 1px solid var(--border-color, #223026);
        background: var(--bg-app, #0b100d);
        color: var(--text-muted, #9ca3af);
        border-radius: 7px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 11px;
        font-weight: 800;
        cursor: pointer;
        transition: all .2s ease;
    }

        .sub-ledger-scope .page-number:hover {
            background: rgba(0, 200, 98, 0.15);
            border-color: var(--accent, #00c862);
            color: var(--accent, #00c862);
        }

        .sub-ledger-scope .page-number.active {
            background: var(--accent, #00c862);
            color: #ffffff;
            border-color: var(--accent, #00c862);
            box-shadow: 0 3px 8px rgba(0, 200, 98, .22);
        }

    .sub-ledger-scope .pagination-arrow {
        width: 34px;
        height: 34px;
        min-width: 34px;
        border: 1px solid var(--border-color, #223026);
        background: var(--bg-app, #0b100d);
        color: var(--text-muted, #9ca3af);
        border-radius: 7px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all .2s ease;
    }

        .sub-ledger-scope .pagination-arrow:hover:not(:disabled) {
            background: rgba(0, 200, 98, 0.15);
            color: var(--accent, #00c862);
            border-color: var(--accent, #00c862);
        }

        .sub-ledger-scope .pagination-arrow:disabled {
            opacity: .4;
            cursor: not-allowed;
        }

        .sub-ledger-scope .pagination-arrow i {
            font-size: 19px;
        }

    .sub-ledger-scope .pagination-dots {
        width: 28px;
        text-align: center;
        color: var(--text-muted, #9ca3af);
        font-weight: 800;
        font-size: 12px;
    }

    .sub-ledger-scope .page-size-wrapper {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-right: 12px;
        color: var(--text-muted, #9ca3af);
        font-size: 11px;
        font-weight: 700;
    }

    .sub-ledger-scope .page-size-select {
        height: 34px;
        min-width: 55px;
        border: 1px solid var(--border-color, #223026);
        border-radius: 7px;
        padding: 0 7px;
        background: var(--bg-app, #0b100d);
        font-size: 11px;
        color: var(--text-main, #ffffff);
        outline: none;
        font-weight: 600;
    }

        .sub-ledger-scope .page-size-select option {
            background: var(--bg-side, #121814);
            color: var(--text-main, #ffffff);
        }

    /* ================= EMPTY ================= */

    .sub-ledger-scope .empty-state {
        padding: 60px 20px;
        text-align: center;
        color: var(--text-muted, #9ca3af);
    }

        .sub-ledger-scope .empty-state i {
            font-size: 50px;
            opacity: .6;
        }

        .sub-ledger-scope .empty-state h3 {
            color: var(--text-main, #ffffff);
            margin: 10px 0 5px;
        }

        .sub-ledger-scope .empty-state p {
            margin: 0;
            font-size: 12px;
        }

    /* ================= MODAL & POPUPS ================= */

    .sub-ledger-scope .ofooqx-modal {
        position: fixed;
        inset: 0;
        z-index: 9999;
        background: rgba(0, 0, 0, 0.75);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
        overflow-y: auto;
    }

    .sub-ledger-scope .backdrop-blur {
        backdrop-filter: blur(5px);
    }

    .sub-ledger-scope .modal-content {
        width: min(750px, 100%);
        max-height: 85vh;
        display: flex;
        flex-direction: column;
        background: var(--bg-side, #121814) !important;
        border: 1px solid var(--border-color, #223026);
        border-radius: 16px;
        box-shadow: 0 25px 70px rgba(0, 0, 0, .6);
        color: var(--text-main, #ffffff) !important;
        overflow: hidden;
        margin: auto;
    }

    .sub-ledger-scope .modern-modal {
        width: min(800px, 100%);
    }

    .sub-ledger-scope .modal-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 15px;
        padding: 16px 20px;
        border-bottom: 1px solid var(--border-color, #223026);
        background: var(--bg-side, #121814) !important;
        flex-shrink: 0;
    }

        .sub-ledger-scope .modal-header h3 {
            margin: 0;
            display: flex;
            align-items: center;
            gap: 8px;
            color: var(--text-main, #ffffff) !important;
            font-size: 16px;
        }

    .sub-ledger-scope .header-left {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .sub-ledger-scope .icon-wrapper {
        width: 42px;
        height: 42px;
        border-radius: 10px;
        background: rgba(0, 200, 98, 0.15);
        color: var(--accent, #00c862);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sub-ledger-scope .subtitle {
        margin: 3px 0 0;
        font-size: 10px;
        color: var(--text-muted, #9ca3af);
    }

    .sub-ledger-scope .close-icon {
        cursor: pointer;
        color: var(--text-muted, #9ca3af);
        transition: .2s;
    }

        .sub-ledger-scope .close-icon:hover {
            color: var(--text-main, #ffffff);
        }

    .sub-ledger-scope .modal-body {
        padding: 20px;
        overflow-y: auto !important;
        max-height: calc(85vh - 140px);
        flex: 1 1 auto;
        background: var(--bg-side, #121814) !important;
    }

        .sub-ledger-scope .modal-body::-webkit-scrollbar,
        .sub-ledger-scope .modal-content::-webkit-scrollbar {
            width: 8px;
        }

        .sub-ledger-scope .modal-body::-webkit-scrollbar-track,
        .sub-ledger-scope .modal-content::-webkit-scrollbar-track {
            background: var(--bg-app, #0b100d);
        }

        .sub-ledger-scope .modal-body::-webkit-scrollbar-thumb,
        .sub-ledger-scope .modal-content::-webkit-scrollbar-thumb {
            background: var(--border-color, #223026);
            border-radius: 4px;
        }

            .sub-ledger-scope .modal-body::-webkit-scrollbar-thumb:hover {
                background: var(--accent, #00c862);
            }

    .sub-ledger-scope .form-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 15px;
    }

    .sub-ledger-scope .form-group {
        min-width: 0;
    }

        .sub-ledger-scope .form-group.full-width {
            grid-column: 1 / -1;
        }

        .sub-ledger-scope .form-group label {
            display: block;
            margin-bottom: 6px;
            color: var(--text-muted, #9ca3af);
            font-size: 11px;
            font-weight: 800;
        }

    .sub-ledger-scope .required {
        color: #ef4444;
    }

    .sub-ledger-scope .form-control {
        width: 100%;
        min-height: 42px;
        border: 1px solid var(--border-color, #223026);
        border-radius: 8px;
        padding: 8px 12px;
        outline: none;
        background: var(--bg-app, #0b100d) !important;
        color: #64748b;
        font-weight: 600;
        font-size: 13px;
    }

        .sub-ledger-scope .form-control::placeholder {
            color: #6b7280;
            opacity: 1;
        }

        .sub-ledger-scope .form-control option {
            background: var(--bg-side, #121814);
            color: #ffffff !important;
        }

        .sub-ledger-scope .form-control:focus {
            border-color: var(--accent, #00c862);
        }

    /* تصحيح تداخل النص مع الـ Suffix في الـ RTL */
    .sub-ledger-scope .input-with-suffix {
        position: relative;
        display: flex;
        align-items: center;
    }

        .sub-ledger-scope .input-with-suffix .form-control {
            padding-left: 48px !important;
            padding-right: 12px !important;
        }

    .sub-ledger-scope .suffix {
        position: absolute;
        left: 12px !important;
        right: auto !important;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-muted, #9ca3af);
        font-size: 11px;
        font-weight: 700;
        pointer-events: none;
    }

    .sub-ledger-scope .highlight-control {
        border: 2px solid var(--accent, #00c862);
        font-weight: 800;
    }

    .sub-ledger-scope .modal-actions {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 14px 20px;
        border-top: 1px solid var(--border-color, #223026);
        background: var(--bg-side, #121814) !important;
        flex-shrink: 0;
    }

        .sub-ledger-scope .modal-actions .premium-btn {
            flex: 1;
            max-width: none;
            min-height: 42px;
            border-radius: 9px;
            font-weight: 700;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 7px;
            cursor: pointer;
        }

    .sub-ledger-scope .validation-message {
        color: #ef4444;
        font-size: 10px;
        margin-top: 4px;
    }

    .sub-ledger-scope .premium-alert-danger {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0 0 15px 0;
        padding: 12px;
        background: rgba(239, 68, 68, 0.15);
        border: 1px solid rgba(239, 68, 68, 0.3);
        border-radius: 9px;
        color: #f87171;
    }

    .sub-ledger-scope .alert-icon-wrapper i {
        font-size: 24px;
    }

    .sub-ledger-scope .alert-text-wrapper strong {
        font-size: 12px;
    }

    .sub-ledger-scope .alert-text-wrapper p {
        margin: 3px 0 0;
        font-size: 11px;
    }
