/* Geen apart chatpaneel: alles wordt in of onder de speler geplaatst. */

.nospace-chat-overlay {
    position: absolute;
    z-index: 20;
    top: 12px;
    left: 14px;

    width: min(44%, 520px);
    max-height: 58%;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;

    color: #ffffff;
    pointer-events: none;
}

.nospace-chat-message {
    padding: 3px 0;
    border: 0;

    text-shadow:
        0 1px 2px rgba(0, 0, 0, 1),
        0 2px 7px rgba(0, 0, 0, 0.98);
}

.nospace-chat-meta {
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.nospace-chat-meta strong {
    min-width: 0;
    overflow: hidden;

    font-size: clamp(11px, 1.3vw, 14px);
    font-weight: 900;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.nospace-chat-meta time {
    color: rgba(255, 255, 255, 0.7);
    font-size: 9px;
}

.nospace-chat-message p {
    margin: 1px 0 0;

    color: #ffffff;
    font-size: clamp(12px, 1.55vw, 16px);
    font-weight: 750;
    line-height: 1.22;

    overflow-wrap: anywhere;
}

.nospace-chat-empty {
    display: none;
}

.nospace-chat-name-button {
    position: absolute;
    z-index: 22;
    top: 10px;
    right: 10px;

    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;

    color: #ffffff;
    background: rgba(5, 18, 31, 0.84);

    font-size: 10px;
    font-weight: 800;

    cursor: pointer;
}

.nospace-chat-composer {
    position: absolute;
    z-index: 22;
    right: 12px;
    bottom: 12px;
    left: 12px;

    display: flex;
    align-items: flex-end;
    gap: 8px;

    pointer-events: auto;
}

.nospace-chat-composer textarea {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 42px;
    max-height: 86px;
    resize: vertical;

    padding: 10px 12px;

    border: 1px solid rgba(92, 173, 226, 0.78);
    border-radius: 11px;
    outline: none;

    color: #ffffff;
    background: rgba(7, 24, 40, 0.88);

    font: inherit;
    font-size: 13px;
}

.nospace-chat-composer textarea:focus {
    border-color: #19a7ff;
    box-shadow: 0 0 0 3px rgba(25, 167, 255, 0.16);
}

.nospace-chat-send {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 9px 14px;

    border: 1px solid rgba(25, 167, 255, 0.65);
    border-radius: 10px;

    color: #ffffff;
    background: linear-gradient(145deg, #158ed8, #08669f);

    font: inherit;
    font-size: 12px;
    font-weight: 800;

    cursor: pointer;
}

.nospace-chat-send:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.nospace-chat-feedback {
    position: absolute;
    bottom: calc(100% + 5px);
    left: 0;

    padding: 4px 7px;
    border-radius: 7px;

    color: #ffaaa2;
    background: rgba(5, 18, 31, 0.9);

    font-size: 10px;
}

.nospace-name-modal {
    position: fixed;
    z-index: 100000;
    inset: 0;

    display: grid;
    place-items: center;
    padding: 18px;

    background: rgba(2, 8, 15, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.nospace-name-modal[hidden] {
    display: none;
}

.nospace-name-dialog {
    width: min(100%, 410px);
    padding: 27px;

    border: 1px solid var(--line);
    border-radius: 22px;

    color: var(--text);
    background:
        radial-gradient(
            circle at 10% 0,
            rgba(25, 167, 255, 0.16),
            transparent 36%
        ),
        var(--panel);

    box-shadow: 0 26px 90px rgba(0, 0, 0, 0.48);
}

.nospace-name-dialog h2 {
    margin: 0;
    font-size: 25px;
    letter-spacing: -0.025em;
}

.nospace-name-dialog > p {
    margin: 9px 0 18px;
    color: var(--muted);
    line-height: 1.5;
}

.nospace-name-dialog input {
    width: 100%;
    padding: 13px 14px;

    border: 1px solid #334a62;
    border-radius: 12px;
    outline: none;

    color: var(--text);
    background: #10243a;

    font: inherit;
}

.nospace-name-dialog input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(25, 167, 255, 0.13);
}

.nospace-name-error {
    min-height: 18px;
    margin: 7px 0 0;

    color: #ff9b92;
    font-size: 12px;
}

.nospace-name-submit {
    width: 100%;
    margin-top: 8px;
    padding: 12px 15px;

    border: 1px solid rgba(25, 167, 255, 0.6);
    border-radius: 12px;

    color: #ffffff;
    background: linear-gradient(145deg, #158ed8, #08669f);

    cursor: pointer;
    font-weight: 800;
}

/*
 * Mobiel: alleen de berichten blijven over het beeld.
 * Het invoerveld wordt door JavaScript direct onder videoArea gezet.
 */
.nospace-mobile-composer {
    position: static;
    z-index: auto;

    padding: 10px 12px;

    border-top: 1px solid var(--line);
    background: var(--panel);
}

.nospace-mobile-composer textarea {
    min-height: 42px;
    max-height: 72px;
    resize: none;

    background: #10243a;
}

@media (max-width: 900px) {
    .nospace-chat-overlay {
        top: 9px;
        right: 76px;
        left: 10px;

        width: auto;
        max-height: 48%;
    }

    .nospace-chat-message {
        padding: 2px 0;
    }

    .nospace-chat-meta strong {
        font-size: 11px;
    }

    .nospace-chat-meta time {
        display: none;
    }

    .nospace-chat-message p {
        font-size: 12px;
    }

    .nospace-chat-name-button {
        top: 8px;
        right: 8px;
        padding: 5px 8px;
        font-size: 9px;
    }

    .nospace-name-dialog {
        padding: 23px;
        border-radius: 19px;
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    .nospace-chat-overlay {
        max-height: 42%;
    }

    .nospace-chat-message p {
        font-size: 11px;
    }

    .nospace-chat-composer {
        bottom: 8px;
    }
}

/* =========================================================
 * NoSpace v5 reparatie-overrides
 * ========================================================= */

.nospace-chat-overlay {
    top: 12px;
    bottom: 12px;
    left: 14px;
    width: min(42%, 500px);
    max-height: none;
    justify-content: flex-end;
    overflow: hidden;
}

.nospace-chat-message {
    flex: 0 0 auto;
}

.nospace-chat-meta strong {
    font-size: clamp(10px, 1.05vw, 12px);
}

.nospace-chat-meta time {
    font-size: 8px;
}

.nospace-chat-message p {
    font-size: clamp(11px, 1.25vw, 14px);
    line-height: 1.18;
}

.nospace-chat-composer.nospace-external-composer {
    position: static;
    z-index: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
    padding: 10px 12px;
    border-top: 1px solid var(--line);
    background: var(--panel);
}

.nospace-chat-composer.nospace-external-composer textarea {
    min-height: 40px;
    max-height: 72px;
    resize: none;
    padding: 9px 11px;
    background: #10243a;
    font-size: 12px;
}

.nospace-chat-composer.nospace-external-composer .nospace-chat-send {
    min-height: 40px;
    font-size: 11px;
}

@media (max-width: 900px) {
    .nospace-chat-overlay {
        top: 9px;
        right: 72px;
        bottom: 9px;
        left: 10px;
        width: auto;
        max-height: none;
    }

    .nospace-chat-meta strong {
        font-size: 9px;
    }

    .nospace-chat-message p {
        font-size: 10px;
        line-height: 1.16;
    }

    .nospace-chat-composer.nospace-external-composer {
        padding: 9px 10px;
    }

    .nospace-chat-composer.nospace-external-composer textarea {
        min-height: 38px;
        max-height: 64px;
        font-size: 11px;
    }

    .nospace-chat-composer.nospace-external-composer .nospace-chat-send {
        min-height: 38px;
        padding: 7px 11px;
        font-size: 10px;
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    .nospace-chat-overlay {
        top: 7px;
        bottom: 7px;
        max-height: none;
    }

    .nospace-chat-message {
        padding: 1px 0;
    }

    .nospace-chat-message p {
        font-size: 9px;
    }
}

/* NOSPACE FULLSCREEN CHATBALK ONDERAAN START */

/*
 * In volledig scherm staat de invoerbalk altijd vlak boven de
 * onderrand. Buiten volledig scherm blijft de bestaande positie gelden.
 */
.nospace-chat-composer.nospace-fullscreen-composer,
:fullscreen .nospace-chat-composer,
:-webkit-full-screen .nospace-chat-composer {
    position: fixed !important;
    z-index: 2147483646 !important;

    top: auto !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
    left: max(8px, env(safe-area-inset-left)) !important;

    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 8px 9px !important;

    border: 1px solid rgba(92, 173, 226, 0.52) !important;
    border-radius: 12px !important;

    background: rgba(5, 18, 31, 0.92) !important;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.48) !important;

    box-sizing: border-box !important;
}

/*
 * Houd de onderste chatberichten boven de invoerbalk, zodat ze niet
 * achter het invoerveld verdwijnen.
 */
:fullscreen .nospace-chat-overlay,
:-webkit-full-screen .nospace-chat-overlay {
    bottom: max(74px, calc(env(safe-area-inset-bottom) + 74px)) !important;
}

@media (max-width: 600px) {
    .nospace-chat-composer.nospace-fullscreen-composer,
    :fullscreen .nospace-chat-composer,
    :-webkit-full-screen .nospace-chat-composer {
        right: max(5px, env(safe-area-inset-right)) !important;
        bottom: max(5px, env(safe-area-inset-bottom)) !important;
        left: max(5px, env(safe-area-inset-left)) !important;

        padding: 6px !important;
        gap: 6px !important;
    }

    .nospace-chat-composer.nospace-fullscreen-composer textarea,
    :fullscreen .nospace-chat-composer textarea,
    :-webkit-full-screen .nospace-chat-composer textarea {
        min-height: 36px !important;
        max-height: 56px !important;
    }

    .nospace-chat-composer.nospace-fullscreen-composer .nospace-chat-send,
    :fullscreen .nospace-chat-composer .nospace-chat-send,
    :-webkit-full-screen .nospace-chat-composer .nospace-chat-send {
        min-height: 36px !important;
    }

    :fullscreen .nospace-chat-overlay,
    :-webkit-full-screen .nospace-chat-overlay {
        bottom: max(
            65px,
            calc(env(safe-area-inset-bottom) + 65px)
        ) !important;
    }
}

/* NOSPACE FULLSCREEN CHATBALK ONDERAAN EINDE */
