components/message-input/MessageInput.module.scss
@use '/app/scss/mixins.scss' as *;

.wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

.container {
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 1rem;
    width: 100%;
    height: 60px;
    max-width: 100%;
    flex-wrap: wrap;
    overflow-y: auto;
    // border-bottom: var(--solid-border);
}

.input {
    max-height: 100px;
    width: 100%;
    padding: 8px 1rem;
    min-height: 60px;
    font-size: 1.6rem;
    outline: none;
    line-height: 1.4;
    background-color: transparent;
    font-family: var(--font-family);
    color: var(--text-color);
    border: none;
    transition: height 0.2s ease-in-out;
    overflow: auto;

    // Add placeholder styling
    &.empty:before {
        content: attr(data-placeholder);
        color: #999;
        cursor: text;
        position: absolute;
    }

    @include respond-to('mobile') {
        min-height: 40px;
        font-size: 1.5rem;
    }
}

.extra {
    height: 40px;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
}

.attachment {
    display: flex;
    gap: 8px;

    .attach-icon:hover {
        cursor: pointer;
        opacity: 0.8;
    }
}

.submit-icon {
    background-color: var(--black-low);
    color: var(--background);
    border-radius: 50rem;
    width: 32px;
    height: 32px;
    cursor: pointer;
    margin-bottom: 4px;

    &:hover {
        opacity: 0.9;
    }
}

.preview-delete {
    position: absolute;
    top: -8px;
    right: -8px;
    box-shadow:
        #fff 0px 13px 27px -5px,
        #fff 0px 8px 16px -8px;

    &:hover {
        opacity: 1;
        color: #ff3838;
    }
}

.preview-image,
.preview-video {
    width: 40px;
    height: 36px;
    position: relative;
    margin-right: 12px;

    .preview-img,
    .preview-video-player {
        width: 100%;
        height: 100%;
        border: 1px solid var(--gray-color);
        border-radius: 4px;
        object-fit: contain;
    }
}

.preview-file {
    height: 36px;
    display: flex;
    align-items: center;
    margin-right: 12px;
    padding: 0 1rem;
    border-radius: 4px;
    position: relative;
    background-color: var(--white);
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1.4;
    border: 1px solid var(--gray-color);

    .preview-file-name {
        max-width: 100px;
        @include font-default;
        color: var(--black-low);
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        width: 100%;
    }
}

// reply box

.reply-box {
    width: 100%;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;

    .reply-content {
        font-family: var(--font-family);
        text-align: left;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .reply-name {
        @include font-default;
        text-align: left;
        font-size: 1.5rem;
    }

    .reply-text {
        display: inline-block;
        @include font-default;
        font-size: 1.4rem;
        color: var(--text-low-color);
        text-align: left;
        margin-top: 4px;
        max-width: 500px;
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .reply-close {
        margin-left: 12px;
    }
}

// emoji-picker

.icon-wrapper {
    height: 100%;
    display: flex;
    align-items: center;
}

.emoji-picker {
    background-color: var(--white) !important;
    border-radius: 8px !important;
    box-shadow: var(--white-box-shadow);
    border: 1px solid var(--gray-color) !important;
}

// drag and drop
.drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px dashed var(--red);
    background-color: var(--input-drag-enter-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.drag-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    @include font-default;
    color: var(--red);
    font-size: 1.6rem;
    font-weight: 500;

    svg {
        color: var(--red);
    }
}

// mention

.mention-list {
    position: absolute;
    width: fit-content;
    z-index: 1111;
}

// recording

.audio-recording {
    display: flex;
    align-items: center;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    background-color: var(--background);
    gap: 8px;
    padding: 6px;
    z-index: 1;
}

.cancel-btn,
.send-btn {
    background-color: var(--white);
    color: var(--text-color);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.record-bar {
    flex: 1;
    background-color: var(--white);
    border-radius: 100px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

// lớp hiệu ứng nền động

.record-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: #66666655; // màu nền progress nhạt hơn
    border-radius: inherit;
    z-index: 0;
    transition: width 1s linear;
}

.stop-btn {
    background-color: var(--black);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.timer {
    background-color: var(--black);
    color: var(--white);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 2;
}

.finish-btn,
.play-btn {
    background-color: var(--black);
    color: var(--white);
    border-radius: 10rem;
    border: none;
    outline: none;
    width: 28px;
    height: 28px;
    z-index: 2;
    position: relative;
}

.audio-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.audio-fake {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 4px;
    z-index: 2;

    .bar {
        width: 4px;
        background: var(--black-low);
        border-radius: 2px;
        animation: pulse 1.2s infinite ease-in-out;
        animation-play-state: paused;
        z-index: 2;
    }

    &.playing {
        .bar {
            animation-play-state: running; // ▶️ khi playing
        }
    }
}

@keyframes pulse {
    0%,
    100% {
        transform: scaleY(0.3);
    }
    50% {
        transform: scaleY(1.2);
    }
}
