/* ============================================================
   DZCounter
   Account - Gestion des comptes
   ============================================================ */


/* ============================================================
   SECTION
   ============================================================ */

.account-section {
    width: 100%;
    min-height: calc(100vh - 75px);

    padding: 45px 0 70px;

    background: #f4f7fb;
}

.account-container {
    width: 100%;
    max-width: 1180px;

    margin: 0 auto;

    padding: 0 25px;
}


/* ============================================================
   EN-TÊTE
   ============================================================ */

.account-page-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 30px;

    margin-bottom: 30px;
}

.account-label {
    display: block;

    margin-bottom: 5px;

    color: #1769aa;

    font-size: 13px;
    font-weight: 700;

    text-transform: uppercase;

    letter-spacing: 0.6px;
}

.account-page-header h1 {
    margin: 0 0 5px;

    color: #111827;

    font-size: 32px;

    line-height: 1.25;

    letter-spacing: -0.5px;
}

.account-page-header p {
    margin: 0;

    color: #6b7280;

    font-size: 14px;
}


/* ============================================================
   BOUTONS
   ============================================================ */

.account-primary-button,
.account-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;
}

.account-primary-button {
    color: #ffffff;

    background: #1769aa;

    border: 1px solid #1769aa;
}

.account-primary-button:hover {
    color: #ffffff;

    background: #12598f;

    border-color: #12598f;
}

.account-primary-button:active,
.account-secondary-button:active {
    transform: translateY(1px);
}

.account-primary-button span {
    font-size: 18px;

    line-height: 1;
}

.account-secondary-button {
    color: #374151;

    background: #ffffff;

    border: 1px solid #d7dee6;
}

.account-secondary-button:hover {
    color: #1769aa;

    border-color: #1769aa;

    background: #f8fafc;
}


/* ============================================================
   ALERTES
   ============================================================ */

.account-alert {
    margin-bottom: 20px;

    padding: 13px 16px;

    border-radius: 8px;

    font-size: 13px;
}

.account-alert-error {
    color: #a42639;

    background: #fff1f2;

    border: 1px solid #fecdd3;
}

.account-alert-success {
    color: #176b45;

    background: #edf9f2;

    border: 1px solid #c7ead6;
}


/* ============================================================
   RÉSUMÉ
   ============================================================ */

.account-summary {
    display: grid;

    grid-template-columns:
        repeat(2, 1fr);

    gap: 16px;

    margin-bottom: 25px;
}

.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);
}

.summary-icon {
    width: 45px;
    height: 45px;

    flex: 0 0 45px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: #e8f2f9;

    color: #1769aa;

    font-size: 12px;
    font-weight: 700;
}

.summary-icon.euro {
    background: #f1ecfb;

    color: #7652a8;

    font-size: 19px;
}

.summary-icon.count {
    background: #f1f5f8;

    color: #526273;

    font-size: 18px;
}

.summary-card span {
    display: block;

    margin-bottom: 4px;

    color: #6b7280;

    font-size: 12px;
}

.summary-card strong {
    display: block;

    color: #111827;

    font-size: 18px;

    line-height: 1.3;
}

/* Les nombres restent lisibles de gauche à droite, même en arabe. */
.summary-card bdi,
.account-card-balance bdi,
.account-card-details bdi,
.account-readonly-value bdi {
    display: inline-block;
    direction: ltr;
    unicode-bidi: isolate;
    white-space: nowrap;
}

.account-form input[type="number"] {
    direction: ltr;
    text-align: left;
}


/* ============================================================
   GRILLE DES COMPTES
   ============================================================ */

.accounts-page-grid {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 18px;
}


/* ============================================================
   CARTE COMPTE
   ============================================================ */

.account-card {
    min-width: 0;

    padding: 22px;

    background: #ffffff;

    border: 1px solid #e1e7ed;

    border-radius: 12px;

    box-shadow:
        0 5px 18px rgba(17, 24, 39, 0.035);

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.account-card:hover {
    transform: translateY(-2px);

    border-color: #cbdce8;

    box-shadow:
        0 10px 28px rgba(17, 24, 39, 0.07);
}


/* ============================================================
   HAUT DE CARTE
   ============================================================ */

.account-card-top {
    min-height: 40px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 17px;
}

.account-card-icon {
    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: #e8f2f9;

    color: #1769aa;

    font-size: 14px;
    font-weight: 700;
}


/* ============================================================
   ACTIONS CARTE
   ============================================================ */

.account-card-actions {
    display: flex;

    align-items: center;

    gap: 8px;
}

.account-card-actions form {
    margin: 0;
    padding: 0;
}

.account-action-edit,
.account-action-delete {
    padding: 4px 7px;

    color: #6b7280;

    background: transparent;

    border: 0;

    font-size: 11px;
    font-weight: 600;

    text-decoration: none;

    cursor: pointer;
}

.account-action-edit:hover {
    color: #1769aa;
}

.account-action-delete:hover {
    color: #d43c52;
}


/* ============================================================
   NOM
   ============================================================ */

.account-card-name {
    margin-bottom: 3px;

    overflow: hidden;

    color: #111827;

    font-size: 17px;
    font-weight: 700;

    text-overflow: ellipsis;

    white-space: nowrap;
}


/* ============================================================
   TYPE
   ============================================================ */

.account-card-type {
    min-height: 20px;

    margin-bottom: 20px;

    overflow: hidden;

    color: #8a94a3;

    font-size: 12px;

    text-overflow: ellipsis;

    white-space: nowrap;
}


/* ============================================================
   SOLDE
   ============================================================ */

.account-card-balance {
    padding: 15px 0;

    border-top: 1px solid #edf0f3;
    border-bottom: 1px solid #edf0f3;
}

.account-card-balance span,
.account-card-details span {
    display: block;

    margin-bottom: 4px;

    color: #8a94a3;

    font-size: 11px;
}

.account-card-balance strong {
    display: block;

    color: #1769aa;

    font-size: 22px;

    line-height: 1.3;

    word-break: break-word;
}


/* ============================================================
   SOLDE INITIAL
   ============================================================ */

.account-card-details {
    padding-top: 12px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 15px;
}

.account-card-details span {
    margin: 0;
}

.account-card-details strong {
    color: #374151;

    font-size: 12px;

    white-space: nowrap;
}


/* ============================================================
   FOOTER CARTE
   ============================================================ */

.account-card-footer {
    margin-top: 17px;

    padding-top: 13px;

    border-top: 1px solid #edf0f3;
}

.account-card-footer a {
    color: #1769aa;

    font-size: 12px;
    font-weight: 600;

    text-decoration: none;
}

.account-card-footer a:hover {
    text-decoration: underline;
}


/* ============================================================
   AUCUN COMPTE
   ============================================================ */

.accounts-empty {
    min-height: 330px;

    padding: 45px 25px;

    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    text-align: center;

    background: #ffffff;

    border: 1px solid #e1e7ed;

    border-radius: 12px;

    box-shadow:
        0 5px 18px rgba(17, 24, 39, 0.035);
}

.accounts-empty-icon {
    width: 60px;
    height: 60px;

    margin-bottom: 16px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 13px;

    background: #e8f2f9;

    font-size: 27px;
}

.accounts-empty h2 {
    margin: 0 0 7px;

    color: #111827;

    font-size: 19px;
}

.accounts-empty p {
    max-width: 480px;

    margin: 0 0 22px;

    color: #8a94a3;

    font-size: 13px;

    line-height: 1.7;
}


/* ============================================================
   MODALE
   ============================================================ */

.account-modal {
    position: fixed;

    inset: 0;

    z-index: 1000;

    display: none;

    align-items: center;
    justify-content: center;

    padding: 20px;
}

.account-modal.active {
    display: flex;
}

.account-modal-overlay {
    position: absolute;

    inset: 0;

    background: rgba(15, 23, 42, 0.52);

    backdrop-filter: blur(2px);
}

.account-modal-box {
    width: 100%;
    max-width: 520px;

    max-height: calc(100vh - 40px);

    overflow-y: auto;

    position: relative;
    z-index: 1;

    background: #ffffff;

    border-radius: 14px;

    box-shadow:
        0 25px 70px rgba(15, 23, 42, 0.2);

    animation:
        accountModalIn 0.18s ease;
}

@keyframes accountModalIn {

    from {
        opacity: 0;

        transform: translateY(8px) scale(0.98);
    }

    to {
        opacity: 1;

        transform: translateY(0) scale(1);
    }

}


/* ============================================================
   BODY BLOQUÉ
   ============================================================ */

body.modal-open {
    overflow: hidden;
}


/* ============================================================
   HEADER MODALE
   ============================================================ */

.account-modal-header {
    padding: 22px 24px;

    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;

    border-bottom: 1px solid #edf0f3;
}

.account-modal-header h2 {
    margin: 0 0 4px;

    color: #111827;

    font-size: 20px;
}

.account-modal-header p {
    margin: 0;

    color: #8a94a3;

    font-size: 12px;
}

.account-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;
}

.account-modal-close:hover {
    background: #e9edf1;

    color: #111827;
}


/* ============================================================
   FORMULAIRE
   ============================================================ */

.account-form {
    padding: 24px;
}

.account-form-group {
    margin-bottom: 18px;
}

.account-form-group:last-of-type {
    margin-bottom: 0;
}

.account-form-group label {
    display: block;

    margin-bottom: 7px;

    color: #374151;

    font-size: 13px;
    font-weight: 600;
}

.account-form-group input,
.account-form-group select,
.account-form-group textarea {
    width: 100%;

    padding: 11px 13px;

    color: #111827;

    background: #ffffff;

    border: 1px solid #d8e0e7;

    border-radius: 8px;

    outline: none;

    font-size: 13px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.account-form-group input,
.account-form-group select {
    height: 44px;
}

.account-form-group textarea {
    min-height: 85px;

    resize: vertical;

    line-height: 1.6;
}

.account-form-group input:focus,
.account-form-group select:focus,
.account-form-group textarea:focus {
    border-color: #1769aa;

    box-shadow:
        0 0 0 3px rgba(23, 105, 170, 0.09);
}

.account-form-group small {
    display: block;

    margin-top: 6px;

    color: #8a94a3;

    font-size: 11px;

    line-height: 1.5;
}


/* ============================================================
   VALEUR NON MODIFIABLE
   ============================================================ */

.account-readonly-value {
    min-height: 44px;

    padding: 11px 13px;

    display: flex;

    align-items: center;

    color: #6b7280;

    background: #f6f8fa;

    border: 1px solid #e1e7ed;

    border-radius: 8px;

    font-size: 13px;
    font-weight: 600;
}


/* ============================================================
   ACTIONS FORMULAIRE
   ============================================================ */

.account-form-actions {
    margin-top: 25px;

    padding-top: 20px;

    display: flex;

    align-items: center;
    justify-content: flex-end;

    gap: 10px;

    border-top: 1px solid #edf0f3;
}

.account-form-actions .account-primary-button,
.account-form-actions .account-secondary-button {
    min-width: 115px;
}


/* ============================================================
   RTL - ARABE
   ============================================================ */

html[dir="rtl"] .account-section {
    direction: rtl;
}

html[dir="rtl"] .account-page-header,
html[dir="rtl"] .summary-card,
html[dir="rtl"] .account-card,
html[dir="rtl"] .account-modal-box {
    direction: rtl;
}

html[dir="rtl"] .account-page-header,
html[dir="rtl"] .account-card-top,
html[dir="rtl"] .account-card-details,
html[dir="rtl"] .account-modal-header {
    text-align: right;
}

html[dir="rtl"] .account-form-group {
    text-align: right;
}

html[dir="rtl"] .account-form-actions {
    justify-content: flex-start;
}

html[dir="rtl"] .account-card-actions {
    direction: rtl;
}


/* ============================================================
   TABLETTE
   ============================================================ */

@media (max-width: 1000px) {

    .accounts-page-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }

    .account-summary {
        grid-template-columns:
            repeat(2, 1fr);
    }

}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 700px) {

    .account-section {
        padding: 30px 0 50px;
    }

    .account-container {
        padding-left: 18px;
        padding-right: 18px;
    }

    .account-page-header {
        align-items: flex-start;

        flex-direction: column;

        gap: 18px;
    }

    .account-page-header h1 {
        font-size: 27px;
    }

    .account-page-header .account-primary-button {
        width: 100%;
    }

    .account-summary {
        grid-template-columns: 1fr;

        gap: 12px;
    }

    .summary-card {
        min-height: 90px;

        padding: 17px;
    }

    .accounts-page-grid {
        grid-template-columns: 1fr;

        gap: 15px;
    }

    .account-card {
        padding: 20px;
    }

    .account-modal {
        padding: 12px;
    }

    .account-modal-box {
        max-height: calc(100vh - 24px);

        border-radius: 12px;
    }

    .account-modal-header {
        padding: 18px;
    }

    .account-form {
        padding: 18px;
    }

}


/* ============================================================
   PETIT MOBILE
   ============================================================ */

@media (max-width: 420px) {

    .account-container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .account-page-header h1 {
        font-size: 24px;
    }

    .account-card {
        padding: 17px;
    }

    .account-card-balance strong {
        font-size: 19px;
    }

    .account-form-actions {
        flex-direction: column-reverse;
    }

    .account-form-actions button {
        width: 100%;
    }

}

/* ====================================================
   AIDE COMPTES / PORTEFEUILLES
   ==================================================== */

.accounts-help {
    margin: 0 0 28px;
    border: 1px solid #d9e4ef;
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
}

.accounts-help summary {
    position: relative;
    padding: 16px 46px 16px 18px;
    cursor: pointer;
    list-style: none;

    font-size: 14px;
    font-weight: 700;
    color: #1769aa;

    background: #f7fbff;
}

.accounts-help summary::-webkit-details-marker {
    display: none;
}

.accounts-help summary::after {
    content: "▼";
    position: absolute;
    top: 50%;
    right: 18px;

    font-size: 11px;

    transform: translateY(-50%);
}

.accounts-help[open] summary::after {
    content: "▲";
}

.accounts-help-content {
    padding: 18px;

    font-size: 14px;
    line-height: 1.7;
    color: #475569;
}

.accounts-help-content p {
    margin: 0 0 12px;
}

.accounts-help-content p:last-child {
    margin-bottom: 0;
}


/* Exemple */

.accounts-help-example {
    margin-top: 18px;
    padding: 15px 17px;

    border-left: 4px solid #1769aa;
    border-radius: 8px;

    background: #f8fafc;
}

.accounts-help-example > strong {
    display: block;
    margin-bottom: 10px;

    color: #1769aa;
}

.accounts-help-money {
    display: inline-block;
    direction: ltr;
    unicode-bidi: isolate;
}


/* Arabe */

html[dir="rtl"] .accounts-help {
    text-align: right;
}

html[dir="rtl"] .accounts-help summary {
    padding-right: 18px;
    padding-left: 46px;
}

html[dir="rtl"] .accounts-help summary::after {
    right: auto;
    left: 18px;
}

html[dir="rtl"] .accounts-help-example {
    border-left: 0;
    border-right: 4px solid #1769aa;
}


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

.account-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);
}

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

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

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

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

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

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

.account-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;
}

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

.account-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%);
}

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

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

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

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

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

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

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

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

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

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

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