/* =========================================================
   DJ DOM 974 MIX - TCHAT RESPONSIVE
   PC / TABLETTE / GSM
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    width: 22px;
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    width: 100%;
    min-height: 100%;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #05060d;
    color: #f7f7fb;
}

button,
input,
textarea {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

input,
textarea {
    font-size: 16px;
}


/* =========================================================
   PAGE
   ========================================================= */

.chat-page {
    min-height: 100vh;
    min-height: 100dvh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background:
        radial-gradient(
            circle at 15% 10%,
            #8b35c955,
            transparent 35%
        ),
        radial-gradient(
            circle at 90% 90%,
            #16a8a055,
            transparent 35%
        ),
        #05060d;
}


/* =========================================================
   TCHAT
   ========================================================= */

.djchat {
    width: min(980px, 100%);

    height: min(
        820px,
        calc(100vh - 40px)
    );

    height: min(
        820px,
        calc(100dvh - 40px)
    );

    min-height: 0;

    display: grid;

    grid-template-rows:
        auto
        auto
        minmax(0, 1fr)
        auto
        auto;

    background: #0b0d17;

    border: 1px solid #292c42;
    border-radius: 26px;

    overflow: hidden;

    box-shadow:
        0 30px 90px #0008;
}


/* =========================================================
   HEADER
   ========================================================= */

.djchat-head {
    min-width: 0;

    padding: 16px 22px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    border-bottom: 1px solid #24273a;

    background: #0d101cdd;
}

.brand {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 14px;
}

.logo {
    flex: none;

    font-weight: 900;
    font-style: italic;

    color: #c65cff;

    white-space: nowrap;
}

.logo b {
    color: #fff;
}

.logo span {
    display: block;

    font-size: 8px;

    color: #8990a7;

    letter-spacing: 2px;
}

.brand strong {
    display: block;

    white-space: nowrap;
}

.brand small {
    display: block;

    margin-top: 2px;

    color: #858ca2;

    font-size: 11px;
}

.brand i {
    display: inline-block;

    width: 7px;
    height: 7px;

    background: #43e18c;

    border-radius: 50%;

    margin-right: 5px;
}


/* =========================================================
   BOUTON RECHERCHE
   ========================================================= */

.iconbtn {
    flex: none;

    width: 42px;
    height: 42px;

    border: 0;

    background: #171b2a;
    color: #c6ccdd;

    border-radius: 10px;

    cursor: pointer;
}

.iconbtn:hover {
    background: #22273a;
}


/* =========================================================
   RECHERCHE
   ========================================================= */

.djchat-search {
    padding: 10px 18px;
}

.djchat-search input {
    width: 100%;
    min-width: 0;

    background: #121625;

    border: 1px solid #30354d;

    color: #fff;

    outline: 0;

    border-radius: 12px;

    padding: 12px 14px;
}

.djchat-search input:focus {
    border-color: #9d42ff;
}


/* =========================================================
   ZONE MESSAGES
   ========================================================= */

.djchat main {
    min-height: 0;

    overflow-x: hidden;
    overflow-y: auto;

    padding: 22px;

    overscroll-behavior: contain;

    -webkit-overflow-scrolling: touch;

    scrollbar-width: thin;
}


/* =========================================================
   BIENVENUE
   ========================================================= */

.welcome,
.empty {
    text-align: center;

    color: #858ca4;

    margin: 100px auto;

    max-width: 500px;
}

.welcome div {
    font-size: 42px;
}

.welcome h2 {
    color: #fff;

    margin: 12px 0 8px;
}

.welcome p {
    margin: 0;

    line-height: 1.5;
}


/* =========================================================
   MESSAGE
   ========================================================= */

.message {
    display: flex;

    align-items: flex-start;

    gap: 10px;

    width: 100%;

    margin-bottom: 15px;
}

.avatar {
    width: 38px;
    height: 38px;

    flex: 0 0 38px;

    display: grid;
    place-items: center;

    border-radius: 13px;

    background:
        linear-gradient(
            135deg,
            #b94cff,
            #3a8dff
        );

    font-weight: 800;
}

.bubble {
    min-width: 0;

    max-width: min(75%, 700px);

    background: #131726;

    border: 1px solid #252a40;

    border-radius: 6px 18px 18px 18px;

    padding: 10px 13px;

    overflow-wrap: anywhere;
}

.meta {
    display: flex;

    gap: 10px;

    align-items: center;

    flex-wrap: wrap;

    margin-bottom: 5px;
}

.meta b {
    font-size: 13px;
}

.meta time {
    font-size: 10px;

    color: #72798e;
}

.text {
    font-size: 14px;

    line-height: 1.5;

    word-break: break-word;

    overflow-wrap: anywhere;
}

.quoted {
    font-size: 11px;

    color: #8d95ab;

    border-left: 2px solid #9d42ff;

    padding: 5px 8px;

    margin-bottom: 7px;

    background: #0d101b;

    overflow-wrap: anywhere;
}


/* =========================================================
   ACTIONS
   ========================================================= */

.actions {
    display: flex;

    flex-wrap: wrap;

    gap: 5px;

    margin-top: 8px;
}

.actions button {
    border: 0;

    background: #171b2a;

    color: #c6ccdd;

    border-radius: 10px;

    font-size: 10px;

    padding: 6px 8px;

    cursor: pointer;

    min-height: 30px;
}

.actions button:active {
    transform: scale(.96);
}


/* =========================================================
   RÉPONSE
   ========================================================= */

.replybar {
    min-width: 0;

    padding: 9px 16px;

    background: #141827;

    border-top: 1px solid #282c42;

    font-size: 12px;

    color: #aeb5c9;

    overflow-wrap: anywhere;
}

.replybar button {
    float: right;

    border: 0;

    background: none;

    color: #fff;

    font-size: 20px;

    cursor: pointer;
}


/* =========================================================
   FOOTER
   ========================================================= */

.djchat footer {
    min-width: 0;

    padding: 10px 16px 14px;

    background: #0a0c15;

    border-top: 1px solid #22263a;
}


/* =========================================================
   EMOJIS RAPIDES
   ========================================================= */

.quick {
    display: flex;

    flex-wrap: wrap;

    gap: 5px;

    margin-bottom: 7px;
}

.quick button {
    min-width: 38px;
    min-height: 34px;

    padding: 5px 9px;

    border: 0;

    background: #171b2a;

    color: #c6ccdd;

    border-radius: 10px;

    cursor: pointer;
}

.quick button:active {
    transform: scale(.94);
}


/* =========================================================
   FORMULAIRE
   ========================================================= */

.djchat form {
    width: 100%;

    display: flex;

    gap: 8px;

    align-items: flex-end;
}

.djchat form input,
.djchat form textarea,
.adminbox input {
    background: #121625;

    border: 1px solid #30354d;

    color: #fff;

    outline: 0;

    border-radius: 12px;

    padding: 12px;
}

.djchat form input {
    width: 150px;

    flex: 0 0 150px;
}

.djchat form textarea {
    flex: 1 1 auto;

    width: 100%;
    min-width: 0;

    resize: none;

    min-height: 48px;
    max-height: 120px;

    line-height: 1.4;
}

.djchat form input:focus,
.djchat form textarea:focus {
    border-color: #9d42ff;

    box-shadow:
        0 0 0 2px #9d42ff22;
}


/* =========================================================
   BOUTON ENVOYER
   ========================================================= */

.send {
    width: 48px;
    min-width: 48px;

    min-height: 48px;

    border: 0;

    border-radius: 14px;

    background:
        linear-gradient(
            135deg,
            #bd4cff,
            #5b7cff
        );

    color: #fff;

    font-weight: 800;

    cursor: pointer;
}

.send:active {
    transform: scale(.95);
}


/* =========================================================
   INDICATION
   ========================================================= */

.hint {
    font-size: 9px;

    color: #646b80;

    margin-top: 5px;
}


/* =========================================================
   ADMIN
   ========================================================= */

.adminbox {
    width: min(430px, 100%);

    padding: 30px;

    background: #0b0d17;

    border: 1px solid #292c42;

    border-radius: 22px;

    display: grid;

    gap: 12px;
}

.adminbox.wide {
    width: min(1000px, 100%);

    display: block;
}

.adminbox.wide h1 {
    margin-top: 0;
}

.adminrow {
    padding: 14px 0;

    border-top: 1px solid #292c42;
}

.adminrow small {
    display: block;

    color: #7f869a;

    margin: 4px 0;
}

.adminrow button {
    margin-top: 8px;
}


/* =========================================================
   TABLETTE
   ========================================================= */

@media (max-width: 800px) {

    .chat-page {
        padding: 12px;
    }

    .djchat {
        width: 100%;

        height: calc(100vh - 24px);
        height: calc(100dvh - 24px);

        border-radius: 20px;
    }

    .bubble {
        max-width: 82%;
    }
}


/* =========================================================
   GSM
   ========================================================= */

@media (max-width: 650px) {

    html,
    body {
        width: 100%;

        overflow-x: hidden;
    }

    .chat-page {
        width: 100%;

        min-height: 100vh;
        min-height: 100dvh;

        padding: 0;

        display: block;

        background: #05060d;
    }


    .djchat {

        width: 100%;

        height: 100vh;
        height: 100dvh;

        min-height: 0;

        border: 0;

        border-radius: 0;

        box-shadow: none;
    }


    /* HEADER */

    .djchat-head {
        padding:
            max(12px, env(safe-area-inset-top))
            12px
            12px;

        gap: 8px;
    }

    .brand {
        gap: 9px;
    }

    .logo {
        font-size: 15px;
    }

    .logo span {
        font-size: 7px;

        letter-spacing: 1.5px;
    }

    .brand strong {
        font-size: 14px;
    }

    .brand small {
        font-size: 10px;
    }

    .iconbtn {
        width: 40px;
        height: 40px;
    }


    /* RECHERCHE */

    .djchat-search {
        padding: 8px 10px;
    }

    .djchat-search input {
        padding: 11px;
    }


    /* MESSAGES */

    .djchat main {
        padding: 14px 10px;

        scroll-padding-bottom: 10px;
    }

    .message {
        gap: 7px;

        margin-bottom: 12px;
    }

    .avatar {
        width: 32px;
        height: 32px;

        flex-basis: 32px;

        border-radius: 10px;

        font-size: 12px;
    }

    .bubble {
        max-width: calc(100% - 39px);

        padding: 9px 10px;

        border-radius:
            5px
            15px
            15px
            15px;
    }

    .meta {
        gap: 6px;

        margin-bottom: 4px;
    }

    .meta b {
        font-size: 12px;
    }

    .meta time {
        font-size: 9px;
    }

    .text {
        font-size: 14px;

        line-height: 1.45;
    }

    .quoted {
        font-size: 10px;

        padding: 4px 6px;
    }


    /* ACTIONS */

    .actions {
        gap: 4px;
    }

    .actions button {
        font-size: 10px;

        min-height: 30px;

        padding: 5px 7px;
    }


    /* RÉPONSE */

    .replybar {
        padding: 8px 10px;

        font-size: 11px;
    }


    /* FOOTER */

    .djchat footer {

        padding:
            7px
            8px
            max(9px, env(safe-area-inset-bottom));
    }


    /* EMOJIS */

    .quick {
        gap: 4px;

        margin-bottom: 6px;
    }

    .quick button {
        flex: 1 1 0;

        min-width: 0;

        min-height: 34px;

        padding: 4px;
    }


    /* FORMULAIRE MOBILE */

    .djchat form {
        display: grid;

        grid-template-columns:
            minmax(85px, 27%)
            minmax(0, 1fr)
            45px;

        gap: 6px;

        align-items: stretch;
    }

    .djchat form input {
        width: 100%;

        min-width: 0;

        flex: none;

        padding: 10px 9px;

        border-radius: 11px;
    }

    .djchat form textarea {
        width: 100%;

        min-width: 0;

        min-height: 45px;
        max-height: 100px;

        padding: 10px 9px;

        border-radius: 11px;
    }

    .djchat form .send {
        width: 45px;

        min-width: 45px;

        min-height: 45px;

        border-radius: 12px;
    }

    .hint {
        display: none;
    }


    /* BIENVENUE */

    .welcome,
    .empty {
        margin: 60px auto;

        padding: 0 15px;
    }

    .welcome div {
        font-size: 36px;
    }

    .welcome h2 {
        font-size: 20px;
    }

    .welcome p {
        font-size: 13px;
    }
}


/* =========================================================
   PETITS GSM
   ========================================================= */

@media (max-width: 380px) {

    .logo {
        display: none;
    }

    .brand {
        gap: 7px;
    }

    .djchat-head {
        padding-left: 10px;
        padding-right: 10px;
    }

    .djchat main {
        padding-left: 7px;
        padding-right: 7px;
    }

    .bubble {
        max-width: calc(100% - 36px);
    }

    .djchat form {
        grid-template-columns:
            minmax(72px, 25%)
            minmax(0, 1fr)
            43px;
    }

    .djchat form input,
    .djchat form textarea {
        font-size: 16px;
    }

    .quick button {
        font-size: 15px;
    }
}


/* =========================================================
   MODE PAYSAGE GSM
   ========================================================= */

@media (max-width: 800px) and (orientation: landscape) {

    .djchat {
        height: 100vh;
        height: 100dvh;
    }

    .djchat-head {
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .djchat main {
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .djchat footer {
        padding-top: 5px;
        padding-bottom: 5px;
    }

    .quick {
        display: none;
    }

    .hint {
        display: none;
    }
}


/* =========================================================
   ÉCRANS TACTILES
   ========================================================= */

@media (hover: none) and (pointer: coarse) {

    .iconbtn,
    .quick button,
    .actions button,
    .send {
        touch-action: manipulation;
    }

    .iconbtn:active,
    .quick button:active,
    .actions button:active,
    .send:active {
        opacity: .75;
    }
}


/* =========================================================
   DJDOM CHAT — PROTECTION MOBILE
   Empêche le chat de déformer le thème principal
   ========================================================= */

#djdom-chat,
#djdom-chat * {
    box-sizing: border-box;
}

#djdom-chat {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    position: relative;
}

/* Le conteneur principal du chat */
#djdom-chat .djchat {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

/* Empêche les messages longs de pousser la page */
#djdom-chat .message,
#djdom-chat .message-content,
#djdom-chat .djchat-message,
#djdom-chat .djchat-bubble {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Inputs / textarea */
#djdom-chat input,
#djdom-chat textarea,
#djdom-chat button,
#djdom-chat select {
    max-width: 100%;
}

/* Images éventuelles */
#djdom-chat img {
    max-width: 100%;
    height: auto;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {

    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    #djdom-chat {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    #djdom-chat .djchat {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin: 0;
        padding-left: 0;
        padding-right: 0;
    }

    #djdom-chat .djchat-messages {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    #djdom-chat .djchat-input,
    #djdom-chat .djchat-form {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    #djdom-chat textarea,
    #djdom-chat input {
        min-width: 0;
        width: 100%;
    }

    #djdom-chat .actions {
        max-width: 100%;
        min-width: 0;
        flex-wrap: wrap;
    }
}

/* Petits téléphones */
@media (max-width: 480px) {

    #djdom-chat {
        max-width: 100vw;
    }

    #djdom-chat .djchat {
        border-radius: 0;
    }

    #djdom-chat * {
        max-width: 100%;
    }
}