/* AEM Labs Limited - Input Container Module */
/* ========================================= */

.input-container {
    position: relative;
    width: 55%;
    display: flex;
    justify-content: center;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: 100%;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    gap: 12px;
}

.input-wrapper:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-color: #d0d0d0;
}

.input-wrapper:focus-within {
    border: 1px solid transparent;
    position: relative;
    background: white;
}

.input-wrapper:focus-within::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 20px;
    padding: 3px;
    background: linear-gradient(270deg, #a71c1c, #6907c5, #a71c1c, #6907c5);
    background-size: 300% 100%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    animation: glow-border 2s linear infinite;
    z-index: -1;
}

.input-wrapper:focus-within::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 22px;
    background: linear-gradient(270deg, #a71c1c, #6907c5, #a71c1c, #6907c5);
    background-size: 300% 100%;
    animation: glow-border 2s linear infinite;
    filter: blur(12px);
    opacity: 0.6;
    z-index: -2;
    pointer-events: none;
}

@keyframes glow-border {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 0%;
    }
}

.input-field-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.input-bar {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0;
    outline: none;
    font-size: 14px;
    font-weight: 500;
    color: #202020;
    font-family: inherit;
    resize: none;
    overflow-y: auto;
    min-height: 24px;
    max-height: 120px;
    line-height: 24px;
    field-sizing: content; /* Auto-expand using CSS field-sizing (modern browsers) */
    height: auto; /* Fallback: allow vertical growth */
}

.submit-btn {
    background: #666;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease, background-position 0.6s ease;
    flex-shrink: 0;
    color: white;
    font-size: 16px;
}

/* Send/Stop icon states */
.submit-btn .icon-stop {
    display: none;
}

.submit-btn.is-stop .icon-send {
    display: none;
}

.submit-btn.is-stop .icon-stop {
    display: inline-block;
}

/* Change to gradient when textarea has content */
.input-field-container:has(.input-bar:not(:placeholder-shown)) .submit-btn,
.input-field-container:has(.input-bar:focus:not(:placeholder-shown)) .submit-btn {
    background: linear-gradient(270deg, #a71c1c, #6907c5, #a71c1c, #6907c5);
    background-size: 300% 100%;
    background-position: 0% 0%;
}

.submit-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(105, 7, 197, 0.4);
}

.input-field-container:has(.input-bar:not(:placeholder-shown)) .submit-btn:hover,
.input-field-container:has(.input-bar:focus:not(:placeholder-shown)) .submit-btn:hover {
    background-position: 100% 0%;
}

.submit-btn:active {
    transform: scale(0.95);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.input-bar::placeholder {
    color: #999;
    font-size: 14px;
    font-weight: 500;
}

@media (max-width: 1440px) {
    .input-container {
        width: 70%;
    }
}

@media (max-width: 992px) {
    .input-container {
        width: 90%;
    }
}