/*
 * Nuonat Core 2.0
 * Friend Requests
 * Version 1.0.0
 */

/* =========================================================
   MODAL
   ========================================================= */

.nuonat-friend-request-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.nuonat-friend-request-modal.is-open {
    display: flex;
}

.nuonat-friend-request-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.66);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

html.nuonat-friend-request-modal-open,
html.nuonat-friend-request-modal-open body {
    overflow: hidden;
}

/* =========================================================
   FENÊTRE
   ========================================================= */

.nuonat-friend-request-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 540px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 26px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 20px;
    background: #ffffff;
    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.24),
        0 8px 24px rgba(15, 23, 42, 0.12);
    color: #1f2937;
    animation: nuonatFriendRequestOpen 0.18s ease-out;
}

@keyframes nuonatFriendRequestOpen {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =========================================================
   FERMETURE
   ========================================================= */

.nuonat-friend-request-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}

.nuonat-friend-request-close:hover {
    background: #f1f5f9;
    color: #0f172a;
    transform: scale(1.05);
}

.nuonat-friend-request-close:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.25);
    outline-offset: 2px;
}

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

.nuonat-friend-request-heading {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-right: 36px;
    margin-bottom: 22px;
}

.nuonat-friend-request-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 15px;
    background: #eef6ff;
    color: #2563eb;
    font-size: 20px;
}

.nuonat-friend-request-heading h3 {
    margin: 0;
    color: #111827;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
}

.nuonat-friend-request-subtitle {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.45;
}

/* =========================================================
   DESTINATAIRE
   ========================================================= */

.nuonat-friend-request-recipient {
    margin-bottom: 18px;
    padding: 11px 14px;
    border-radius: 12px;
    background: #f8fafc;
    color: #64748b;
    font-size: 14px;
}

.nuonat-friend-request-recipient strong {
    color: #1e293b;
    font-weight: 700;
}

/* =========================================================
   MESSAGE
   ========================================================= */

.nuonat-friend-request-label {
    display: block;
    margin-bottom: 8px;
    color: #334155;
    font-size: 14px;
    font-weight: 700;
}

.nuonat-friend-request-textarea {
    display: block;
    width: 100%;
    min-height: 138px;
    padding: 14px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    outline: none;
    resize: vertical;
    background: #ffffff;
    color: #111827;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.55;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
    box-sizing: border-box;
}

.nuonat-friend-request-textarea::placeholder {
    color: #94a3b8;
}

.nuonat-friend-request-textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

/* =========================================================
   COMPTEUR
   ========================================================= */

.nuonat-friend-request-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    color: #94a3b8;
    font-size: 12px;
}

.nuonat-friend-request-meta [data-fr-counter] {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.nuonat-friend-request-meta [data-fr-counter].is-invalid {
    color: #dc2626;
    font-weight: 700;
}

/* =========================================================
   ERREUR
   ========================================================= */

.nuonat-friend-request-error {
    margin-top: 14px;
    padding: 11px 13px;
    border: 1px solid #fecaca;
    border-radius: 11px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 13px;
    line-height: 1.45;
}

.nuonat-friend-request-error[hidden] {
    display: none;
}

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

.nuonat-friend-request-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.nuonat-friend-request-actions .btn {
    min-height: 42px;
    border-radius: 11px;
    font-weight: 600;
}

.nuonat-friend-request-actions .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.nuonat-friend-request-actions .btn:disabled {
    cursor: wait;
    opacity: 0.7;
}

/* =========================================================
   MESSAGE REÇU
   ========================================================= */

.nuonat-friend-request-received {
    position: relative;
    margin: 12px 0;
    padding: 13px 15px;
    border: 1px solid #dbeafe;
    border-radius: 13px;
    background: #f8fbff;
    color: #334155;
}

.nuonat-friend-request-received::before {
    content: "";
    position: absolute;
    top: 14px;
    left: 0;
    width: 3px;
    height: calc(100% - 28px);
    border-radius: 0 3px 3px 0;
    background: #3b82f6;
}

.nuonat-friend-request-received-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
    color: #2563eb;
    font-size: 12px;
    line-height: 1.3;
}

.nuonat-friend-request-received-label strong {
    font-weight: 700;
}

.nuonat-friend-request-received-text {
    color: #334155;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* =========================================================
   ÉTAT ENVOYÉ
   ========================================================= */

.js_friend-cancel[data-nuonat-friend-request="sent"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* =========================================================
   MODE SOMBRE
   ========================================================= */

body.night-mode .nuonat-friend-request-dialog,
body[data-theme="dark"] .nuonat-friend-request-dialog,
html[data-theme="dark"] .nuonat-friend-request-dialog {
    border-color: rgba(148, 163, 184, 0.18);
    background: #18212f;
    color: #e5e7eb;
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.45),
        0 8px 25px rgba(0, 0, 0, 0.25);
}

body.night-mode .nuonat-friend-request-heading h3,
body[data-theme="dark"] .nuonat-friend-request-heading h3,
html[data-theme="dark"] .nuonat-friend-request-heading h3 {
    color: #f8fafc;
}

body.night-mode .nuonat-friend-request-subtitle,
body[data-theme="dark"] .nuonat-friend-request-subtitle,
html[data-theme="dark"] .nuonat-friend-request-subtitle {
    color: #94a3b8;
}

body.night-mode .nuonat-friend-request-close,
body[data-theme="dark"] .nuonat-friend-request-close,
html[data-theme="dark"] .nuonat-friend-request-close {
    color: #94a3b8;
}

body.night-mode .nuonat-friend-request-close:hover,
body[data-theme="dark"] .nuonat-friend-request-close:hover,
html[data-theme="dark"] .nuonat-friend-request-close:hover {
    background: #263244;
    color: #ffffff;
}

body.night-mode .nuonat-friend-request-icon,
body[data-theme="dark"] .nuonat-friend-request-icon,
html[data-theme="dark"] .nuonat-friend-request-icon {
    background: rgba(59, 130, 246, 0.14);
    color: #60a5fa;
}

body.night-mode .nuonat-friend-request-recipient,
body[data-theme="dark"] .nuonat-friend-request-recipient,
html[data-theme="dark"] .nuonat-friend-request-recipient {
    background: #202b3a;
    color: #94a3b8;
}

body.night-mode .nuonat-friend-request-recipient strong,
body[data-theme="dark"] .nuonat-friend-request-recipient strong,
html[data-theme="dark"] .nuonat-friend-request-recipient strong {
    color: #e2e8f0;
}

body.night-mode .nuonat-friend-request-label,
body[data-theme="dark"] .nuonat-friend-request-label,
html[data-theme="dark"] .nuonat-friend-request-label {
    color: #cbd5e1;
}

body.night-mode .nuonat-friend-request-textarea,
body[data-theme="dark"] .nuonat-friend-request-textarea,
html[data-theme="dark"] .nuonat-friend-request-textarea {
    border-color: #3b4758;
    background: #111827;
    color: #f8fafc;
}

body.night-mode .nuonat-friend-request-textarea::placeholder,
body[data-theme="dark"] .nuonat-friend-request-textarea::placeholder,
html[data-theme="dark"] .nuonat-friend-request-textarea::placeholder {
    color: #64748b;
}

body.night-mode .nuonat-friend-request-received,
body[data-theme="dark"] .nuonat-friend-request-received,
html[data-theme="dark"] .nuonat-friend-request-received {
    border-color: rgba(96, 165, 250, 0.22);
    background: rgba(30, 64, 175, 0.10);
}

body.night-mode .nuonat-friend-request-received-label,
body[data-theme="dark"] .nuonat-friend-request-received-label,
html[data-theme="dark"] .nuonat-friend-request-received-label {
    color: #60a5fa;
}

body.night-mode .nuonat-friend-request-received-text,
body[data-theme="dark"] .nuonat-friend-request-received-text,
html[data-theme="dark"] .nuonat-friend-request-received-text {
    color: #dbe4f0;
}

body.night-mode .nuonat-friend-request-error,
body[data-theme="dark"] .nuonat-friend-request-error,
html[data-theme="dark"] .nuonat-friend-request-error {
    border-color: rgba(248, 113, 113, 0.25);
    background: rgba(127, 29, 29, 0.18);
    color: #fca5a5;
}

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

@media (max-width: 575.98px) {
    .nuonat-friend-request-modal {
        align-items: flex-end;
        padding: 0;
    }

    .nuonat-friend-request-dialog {
        max-width: none;
        max-height: 92vh;
        padding: 22px 18px 18px;
        border-radius: 20px 20px 0 0;
        animation: nuonatFriendRequestMobileOpen 0.2s ease-out;
    }

    @keyframes nuonatFriendRequestMobileOpen {
        from {
            opacity: 0;
            transform: translateY(30px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .nuonat-friend-request-heading {
        gap: 12px;
        margin-bottom: 18px;
    }

    .nuonat-friend-request-icon {
        width: 44px;
        height: 44px;
        border-radius: 13px;
    }

    .nuonat-friend-request-heading h3 {
        font-size: 18px;
    }

    .nuonat-friend-request-textarea {
        min-height: 125px;
        font-size: 16px;
    }

    .nuonat-friend-request-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .nuonat-friend-request-actions .btn {
        width: 100%;
    }
}

/* =========================================================
   ACCESSIBILITÉ
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .nuonat-friend-request-dialog {
        animation: none;
    }

    .nuonat-friend-request-close,
    .nuonat-friend-request-textarea {
        transition: none;
    }
}