/* ============================================================
   DZCounter
   Transactions - Gestion des opérations
   ============================================================ */


/* ============================================================
   SECTION
   ============================================================ */

.transactions-section {
    width: 100%;
    min-height: calc(100vh - 75px);

    padding: 45px 0 70px;

    background: #f4f7fb;
}

.transactions-container {
    width: 100%;
    max-width: 1180px;

    margin: 0 auto;

    padding: 0 25px;
}


/* ============================================================
   EN-TÊTE
   ============================================================ */

.transactions-page-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 30px;

    margin-bottom: 30px;
}

.transactions-label {
    display: block;

    margin-bottom: 5px;

    color: #1769aa;

    font-size: 13px;
    font-weight: 700;

    text-transform: uppercase;

    letter-spacing: 0.6px;
}

.transactions-page-header h1 {
    margin: 0 0 5px;

    color: #111827;

    font-size: 32px;

    line-height: 1.25;

    letter-spacing: -0.5px;
}

.transactions-page-header p {
    margin: 0;

    color: #6b7280;

    font-size: 14px;
}


/* ============================================================
   BOUTONS
   ============================================================ */

.transactions-primary-button,
.transactions-secondary-button {
    min-height: 44px;

    padding: 10px 18px;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 7px;

    border-radius: 8px;

    font-size: 13px;
    font-weight: 600;

    text-decoration: none;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.1s ease;
}

.transactions-primary-button {
    color: #ffffff;

    background: #1769aa;

    border: 1px solid #1769aa;
}

.transactions-primary-button:hover {
    color: #ffffff;

    background: #12598f;

    border-color: #12598f;
}

.transactions-primary-button:active,
.transactions-secondary-button:active {
    transform: translateY(1px);
}

.transactions-primary-button span {
    font-size: 18px;

    line-height: 1;
}

.transactions-secondary-button {
    color: #374151;

    background: #ffffff;

    border: 1px solid #d7dee6;
}

.transactions-secondary-button:hover {
    color: #1769aa;

    border-color: #1769aa;

    background: #f8fafc;
}


/* ============================================================
   ALERTES
   ============================================================ */

.transactions-alert {
    margin-bottom: 20px;

    padding: 13px 16px;

    border-radius: 8px;

    font-size: 13px;

    line-height: 1.5;
}

.transactions-alert-error {
    color: #a42639;

    background: #fff1f2;

    border: 1px solid #fecdd3;
}

.transactions-alert-success {
    color: #176b45;

    background: #edf9f2;

    border: 1px solid #c7ead6;
}


/* ============================================================
   RÉSUMÉ
   ============================================================ */

.transactions-summary {
    display: grid;

    grid-template-columns:
        repeat(2, 1fr);

    gap: 16px;

    margin-bottom: 25px;
}

.transaction-summary-card {
    min-height: 105px;

    padding: 20px;

    display: flex;

    align-items: center;

    gap: 14px;

    background: #ffffff;

    border: 1px solid #e3e8ee;

    border-radius: 12px;

    box-shadow:
        0 5px 18px rgba(17, 24, 39, 0.035);
}

.transaction-summary-icon {
    width: 45px;
    height: 45px;

    flex: 0 0 45px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 10px;

    font-size: 20px;
    font-weight: 700;
}

.transaction-summary-icon.income {
    color: #087443;

    background: #e9f7ef;
}

.transaction-summary-icon.expense {
    color: #d43c52;

    background: #fff0f2;
}

.transaction-summary-card span {
    display: block;

    margin-bottom: 4px;

    color: #6b7280;

    font-size: 12px;
}

.transaction-summary-card strong {
    display: block;

    color: #111827;

    font-size: 18px;

    line-height: 1.3;
}


/* ============================================================
   FILTRE
   ============================================================ */

.transactions-filter {
    margin-bottom: 20px;

    padding: 18px 20px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    background: #ffffff;

    border: 1px solid #e1e7ed;

    border-radius: 12px;

    box-shadow:
        0 5px 18px rgba(17, 24, 39, 0.035);
}

.transactions-filter form {
    display: flex;

    align-items: center;

    gap: 12px;

    margin: 0;
}

.transactions-filter label {
    color: #374151;

    font-size: 13px;
    font-weight: 600;
}

.transactions-filter select {
    min-width: 230px;

    height: 42px;

    padding: 8px 12px;

    color: #111827;

    background: #ffffff;

    border: 1px solid #d8e0e7;

    border-radius: 8px;

    outline: none;

    font-size: 13px;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.transactions-filter select:focus {
    border-color: #1769aa;

    box-shadow:
        0 0 0 3px rgba(23, 105, 170, 0.09);
}

.transactions-filter-selected {
    color: #8a94a3;

    font-size: 12px;
}

.transactions-filter-selected strong {
    color: #1769aa;
}


/* ============================================================
   CARTE PRINCIPALE
   ============================================================ */

.transactions-card {
    overflow: hidden;

    background: #ffffff;

    border: 1px solid #e1e7ed;

    border-radius: 12px;

    box-shadow:
        0 5px 18px rgba(17, 24, 39, 0.035);
}

.transactions-card-header {
    padding: 22px 24px;

    border-bottom: 1px solid #edf0f3;
}

.transactions-card-header h2 {
    margin: 0 0 5px;

    color: #111827;

    font-size: 19px;
}

.transactions-card-header p {
    margin: 0;

    color: #8a94a3;

    font-size: 12px;
}


/* ============================================================
   TABLEAU
   ============================================================ */

.transactions-table-wrapper {
    width: 100%;

    overflow-x: auto;
}

.transactions-table {
    width: 100%;

    border-collapse: collapse;

    font-size: 13px;
}

.transactions-table thead {
    background: #f8fafc;
}

.transactions-table th {
    padding: 14px 16px;

    color: #6b7280;

    border-bottom: 1px solid #e5e9ee;

    font-size: 11px;
    font-weight: 700;

    text-align: left;

    white-space: nowrap;
}

.transactions-table td {
    padding: 16px;

    color: #374151;

    border-bottom: 1px solid #edf0f3;

    vertical-align: middle;
}

.transactions-table tbody tr:last-child td {
    border-bottom: 0;
}

.transactions-table tbody tr {
    transition:
        background 0.15s ease;
}

.transactions-table tbody tr:hover {
    background: #fafcfe;
}


/* ============================================================
   DATE
   ============================================================ */

.transaction-date {
    color: #374151;

    font-size: 12px;
    font-weight: 600;

    white-space: nowrap;
}

.transaction-date small {
    display: block;

    margin-top: 3px;

    color: #9aa3af;

    font-size: 11px;

    font-weight: 400;
}


/* ============================================================
   COMPTE
   ============================================================ */

.transaction-account-name {
    color: #111827;

    font-size: 13px;

    white-space: nowrap;
}


/* ============================================================
   TYPE
   ============================================================ */

.transaction-type {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-width: 68px;

    padding: 5px 9px;

    border-radius: 6px;

    font-size: 11px;
    font-weight: 700;
}

.transaction-type-income {
    color: #087443;

    background: #e9f7ef;
}

.transaction-type-expense {
    color: #c73349;

    background: #fff0f2;
}


/* ============================================================
   DESCRIPTION
   ============================================================ */

.transaction-description {
    max-width: 260px;

    overflow: hidden;

    color: #4b5563;

    text-overflow: ellipsis;

    white-space: nowrap;
}


/* ============================================================
   MONTANT
   ============================================================ */

.amount-column {
    text-align: right !important;

    white-space: nowrap;
}

.transaction-income {
    color: #087443;

    font-size: 13px;
}

.transaction-expense {
    color: #d43c52;

    font-size: 13px;
}


/* ============================================================
   ACTIONS
   ============================================================ */

.transaction-actions {
    display: flex;

    align-items: center;

    gap: 10px;

    white-space: nowrap;
}

.transaction-action-edit,
.transaction-action-delete {
    padding: 3px 0;

    background: transparent;

    border: 0;

    font-family: inherit;

    font-size: 11px;
    font-weight: 600;

    text-decoration: none;

    cursor: pointer;
}

.transaction-action-edit {
    color: #1769aa;
}

.transaction-action-edit:hover {
    text-decoration: underline;
}

.transaction-action-delete {
    color: #c73349;
}

.transaction-action-delete:hover {
    text-decoration: underline;
}

.transaction-actions form {
    margin: 0;
}


/* ============================================================
   AUCUNE OPÉRATION
   ============================================================ */

.transactions-empty {
    min-height: 330px;

    padding: 45px 25px;

    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    text-align: center;
}

.transactions-empty-icon {
    width: 60px;
    height: 60px;

    margin-bottom: 16px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 13px;

    background: #eef3f7;

    font-size: 27px;
}

.transactions-empty h3 {
    margin: 0 0 7px;

    color: #111827;

    font-size: 19px;
}

.transactions-empty p {
    max-width: 480px;

    margin: 0 0 22px;

    color: #8a94a3;

    font-size: 13px;

    line-height: 1.7;
}


/* ============================================================
   RETOUR
   ============================================================ */

.transactions-back {
    margin-top: 20px;
}

.transactions-back a {
    color: #1769aa;

    font-size: 12px;
    font-weight: 600;

    text-decoration: none;
}

.transactions-back a:hover {
    text-decoration: underline;
}


/* ============================================================
   MODALE
   ============================================================ */

.transaction-modal {
    position: fixed;

    inset: 0;

    z-index: 1000;

    display: none;

    align-items: center;
    justify-content: center;

    padding: 20px;
}

.transaction-modal.active {
    display: flex;
}

.transaction-modal-overlay {
    position: absolute;

    inset: 0;

    background: rgba(15, 23, 42, 0.52);

    backdrop-filter: blur(2px);
}

.transaction-modal-box {
    width: 100%;
    max-width: 570px;

    max-height: calc(100vh - 40px);

    position: relative;
    z-index: 1;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background: #ffffff;
    border-radius: 14px;

    box-shadow:
        0 25px 70px rgba(15, 23, 42, 0.20);

    animation:
        transactionModalIn 0.18s ease;
}

@keyframes transactionModalIn {

    from {
        opacity: 0;

        transform:
            translateY(8px)
            scale(0.98);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }

}


/* ============================================================
   BODY
   ============================================================ */

body.modal-open {
    overflow: hidden;
}


/* ============================================================
   HEADER MODALE
   ============================================================ */

.transaction-modal-header {
    padding: 22px 24px;

    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;

    border-bottom: 1px solid #edf0f3;
}

.transaction-modal-header h2 {
    margin: 0 0 5px;

    color: #111827;

    font-size: 20px;
}

.transaction-modal-header p {
    margin: 0;

    color: #8a94a3;

    font-size: 12px;
}

.transaction-modal-close {
    width: 32px;
    height: 32px;

    flex: 0 0 32px;

    display: flex;

    align-items: center;
    justify-content: center;

    border: 0;

    border-radius: 8px;

    background: #f3f5f7;

    color: #6b7280;

    font-size: 22px;

    line-height: 1;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.transaction-modal-close:hover {
    background: #e9edf1;

    color: #111827;
}


/* ============================================================
   FORMULAIRE
   ============================================================ */

.transaction-form {
    padding: 24px;

    overflow-y: auto;
    overflow-x: hidden;

    min-height: 0;
}

.transaction-form-group {
    margin-bottom: 18px;
}

.transaction-form-group:last-child {
    margin-bottom: 0;
}

.transaction-form-group label {
    display: block;

    margin-bottom: 7px;

    color: #374151;

    font-size: 13px;
    font-weight: 600;
}

.transaction-form-group label span {
    color: #9aa3af;

    font-size: 11px;

    font-weight: 400;
}

.transaction-form-group input,
.transaction-form-group select,
.transaction-form-group textarea {
    width: 100%;

    box-sizing: border-box;

    padding: 11px 13px;

    color: #111827;

    background: #ffffff;

    border: 1px solid #d8e0e7;

    border-radius: 8px;

    outline: none;

    font-family: inherit;

    font-size: 13px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.transaction-form-group input,
.transaction-form-group select {
    height: 44px;
}

.transaction-form-group textarea {
    min-height: 85px;

    resize: vertical;

    line-height: 1.6;
}

.transaction-form-group input:focus,
.transaction-form-group select:focus,
.transaction-form-group textarea:focus {
    border-color: #1769aa;

    box-shadow:
        0 0 0 3px rgba(23, 105, 170, 0.09);
}


/* ============================================================
   LIGNE TYPE / MONTANT
   ============================================================ */

.transaction-form-row {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 15px;
}


/* ============================================================
   ACTIONS FORMULAIRE
   ============================================================ */

.transaction-form-actions {
    position: static;
    display: flex;
    width: 100%;
    box-sizing: border-box;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;

    margin: 20px 0 0;
    padding: 16px 0 0;

    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.transaction-form-actions .transactions-primary-button,
.transaction-form-actions .transactions-secondary-button {
    min-width: 125px;
}


/* ============================================================
   RTL - ARABE
   ============================================================ */

html[dir="rtl"] .transactions-section,
html[dir="rtl"] .transactions-container {
    direction: rtl;
}

html[dir="rtl"] .transactions-page-header,
html[dir="rtl"] .transactions-filter,
html[dir="rtl"] .transaction-modal-box {
    direction: rtl;
}

html[dir="rtl"] .transactions-table th,
html[dir="rtl"] .transactions-table td {
    text-align: right;
}

html[dir="rtl"] .transactions-table .amount-column {
    text-align: left !important;
}

.transactions-table .amount-column bdi,
.transaction-summary-card bdi {
    direction: ltr;
    unicode-bidi: isolate;
    white-space: nowrap;
}

html[dir="rtl"] #transaction_amount,
html[dir="rtl"] #transaction_date,
html[dir="rtl"] #transaction_reference {
    direction: ltr;
    text-align: left;
    unicode-bidi: plaintext;
}

html[dir="rtl"] .transactions-filter form {
    flex-direction: row-reverse;
}

html[dir="rtl"] .transaction-form-group {
    text-align: right;
}

html[dir="rtl"] .transaction-form-actions {
    justify-content: flex-start;
}


/* ============================================================
   TABLETTE
   ============================================================ */

@media (max-width: 1000px) {

    .transactions-summary {
        grid-template-columns:
            repeat(2, 1fr);
    }

    .transactions-table {
        min-width: 900px;
    }

}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 700px) {

    .transactions-section {
        padding: 30px 0 50px;
    }

    .transactions-container {
        padding-left: 18px;
        padding-right: 18px;
    }

    .transactions-page-header {
        align-items: flex-start;

        flex-direction: column;

        gap: 18px;
    }

    .transactions-page-header h1 {
        font-size: 27px;
    }

    .transactions-page-header
    .transactions-primary-button {
        width: 100%;
    }

    .transactions-summary {
        grid-template-columns: 1fr;

        gap: 12px;
    }

    .transaction-summary-card {
        min-height: 90px;

        padding: 17px;
    }

    .transactions-filter {
        align-items: flex-start;

        flex-direction: column;

        padding: 16px;
    }

    .transactions-filter form {
        width: 100%;

        align-items: flex-start;

        flex-direction: column;

        gap: 7px;
    }

    .transactions-filter select {
        width: 100%;

        min-width: 0;
    }

    .transactions-filter-selected {
        width: 100%;
    }

    .transactions-card-header {
        padding: 18px;
    }

    .transactions-empty {
        min-height: 280px;

        padding: 35px 20px;
    }

    .transaction-modal {
        padding: 12px;
    }

    .transaction-modal-box {
        max-height: calc(100vh - 24px);

        border-radius: 12px;
    }

    .transaction-modal-header {
        padding: 18px;
    }

    .transaction-form {
        padding: 18px;
    }

}


/* ============================================================
   PETIT MOBILE
   ============================================================ */

@media (max-width: 420px) {

    .transactions-container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .transactions-page-header h1 {
        font-size: 24px;
    }

    .transaction-form-row {
        grid-template-columns: 1fr;
    }

    .transaction-form-actions {
        flex-direction: column-reverse;
    }

    .transaction-form-actions button {
        width: 100%;
    }

}
/* ============================================================
   PAGINATION
   ============================================================ */

.transactions-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;

    margin-top: 24px;
    padding: 0;
}

.transactions-pagination a,
.transactions-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 36px;
    height: 36px;

    padding: 0 10px;

    border: 1px solid #d9e0e8;
    border-radius: 7px;

    background: #ffffff;
    color: #1769aa;

    font-size: 14px;
    font-weight: 600;

    text-decoration: none;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.transactions-pagination a:hover {
    background: #f0f6fb;
    border-color: #1769aa;
    color: #12598f;
}

.transactions-pagination .active {
    background: #1769aa;
    border-color: #1769aa;
    color: #ffffff;
}

.transactions-pagination .disabled {
    background: #f8fafc;
    border-color: #e5e7eb;
    color: #9ca3af;
    cursor: default;
}

/* ------------------------------------------------------------
   Pagination arabe
   ------------------------------------------------------------ */

html[dir="rtl"] .transactions-pagination {
    direction: rtl;
}

/* ------------------------------------------------------------
   Mobile
   ------------------------------------------------------------ */

@media (max-width: 600px) {

    .transactions-pagination {
        gap: 4px;
        margin-top: 20px;
    }

    .transactions-pagination a,
    .transactions-pagination span {
        min-width: 34px;
        height: 34px;

        padding: 0 8px;

        font-size: 13px;
    }
}
/* ====================================================
   AIDE TRANSACTIONS
   ==================================================== */

.transactions-help {
    margin: 0 0 28px;
    border: 1px solid #d9e4ef;
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
}

.transactions-help summary {
    position: relative;
    padding: 16px 46px 16px 18px;
    cursor: pointer;
    list-style: none;

    font-size: 14px;
    font-weight: 700;
    color: #1769aa;

    background: #f7fbff;
}

.transactions-help summary::-webkit-details-marker {
    display: none;
}

.transactions-help summary::after {
    content: "▼";
    position: absolute;
    top: 50%;
    right: 18px;

    font-size: 11px;
    transform: translateY(-50%);
}

.transactions-help[open] summary::after {
    content: "▲";
}

.transactions-help-content {
    padding: 18px;

    font-size: 14px;
    line-height: 1.7;
    color: #475569;
}

.transactions-help-content p {
    margin: 0 0 12px;
}

.transactions-help-content p:last-child {
    margin-bottom: 0;
}

.transactions-help-warning,
.transactions-help-example {
    margin-top: 18px;
    padding: 15px 17px;
    border-radius: 8px;
    background: #f8fafc;
}

.transactions-help-warning {
    border-left: 4px solid #d97706;
}

.transactions-help-example {
    border-left: 4px solid #1769aa;
}

.transactions-help-warning > strong,
.transactions-help-example > strong {
    display: block;
    margin-bottom: 10px;
}

.transactions-help-warning > strong {
    color: #b45309;
}

.transactions-help-example > strong {
    color: #1769aa;
}

.transactions-help-money {
    display: inline-block;
    direction: ltr;
    unicode-bidi: isolate;
}

html[dir="rtl"] .transactions-help {
    text-align: right;
}

html[dir="rtl"] .transactions-help summary {
    padding-right: 18px;
    padding-left: 46px;
}

html[dir="rtl"] .transactions-help summary::after {
    right: auto;
    left: 18px;
}

html[dir="rtl"] .transactions-help-warning,
html[dir="rtl"] .transactions-help-example {
    border-left: 0;
}

html[dir="rtl"] .transactions-help-warning {
    border-right: 4px solid #d97706;
}

html[dir="rtl"] .transactions-help-example {
    border-right: 4px solid #1769aa;
}


/* ============================================================
   FAQ CONTEXTUELLE - BAS DE PAGE
   ============================================================ */

.transactions-contextual-faq {
    margin-top: 28px;
    padding: 22px;
    background: #ffffff;
    border: 1px solid #e1e7ed;
    border-radius: 12px;
    box-shadow: 0 5px 18px rgba(17, 24, 39, 0.035);
}

.transactions-contextual-faq-heading {
    margin-bottom: 18px;
}

.transactions-contextual-faq-heading .transactions-label {
    margin-bottom: 4px;
    font-size: 11px;
}

.transactions-contextual-faq-heading h2 {
    margin: 0 0 5px;
    color: #111827;
    font-size: 18px;
}

.transactions-contextual-faq-heading p {
    margin: 0;
    color: #8a94a3;
    font-size: 11px;
    line-height: 1.6;
}

.transactions-contextual-faq-list {
    display: grid;
    gap: 9px;
}

.transactions-contextual-faq-item {
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #e3e9ef;
    border-radius: 9px;
}

.transactions-contextual-faq-item summary {
    min-height: 52px;
    padding: 14px 48px 14px 16px;
    position: relative;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    color: #1f2937;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    list-style: none;
}

.transactions-contextual-faq-item summary::-webkit-details-marker {
    display: none;
}

.transactions-contextual-faq-item summary::after {
    content: "+";
    width: 26px;
    height: 26px;
    position: absolute;
    top: 50%;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1769aa;
    background: #e8f2fa;
    border-radius: 50%;
    font-size: 17px;
    font-weight: 500;
    transform: translateY(-50%);
}

.transactions-contextual-faq-item[open] {
    background: #ffffff;
    border-color: #bfd9eb;
}

.transactions-contextual-faq-item[open] summary {
    color: #1769aa;
}

.transactions-contextual-faq-item[open] summary::after {
    content: "−";
    color: #ffffff;
    background: #1769aa;
}

.transactions-contextual-faq-answer {
    padding: 0 48px 16px 16px;
}

.transactions-contextual-faq-answer p {
    margin: 0;
    color: #64748b;
    font-size: 11px;
    line-height: 1.75;
}

html[dir="rtl"] .transactions-contextual-faq,
html[dir="rtl"] .transactions-contextual-faq-heading,
html[dir="rtl"] .transactions-contextual-faq-item {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .transactions-contextual-faq-item summary {
    padding-right: 16px;
    padding-left: 48px;
}

html[dir="rtl"] .transactions-contextual-faq-item summary::after {
    right: auto;
    left: 14px;
}

html[dir="rtl"] .transactions-contextual-faq-answer {
    padding-right: 16px;
    padding-left: 48px;
}

@media (max-width: 480px) {
    .transactions-contextual-faq {
        padding: 18px;
    }

    .transactions-contextual-faq-item summary {
        font-size: 11px;
    }
}
