* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

body {
    font-family:
        Inter,
        Arial,
        Helvetica,
        sans-serif;

    background:
        linear-gradient(
            135deg,
            #eef4ff 0%,
            #f8faff 100%
        );
}

button,
textarea {
    font: inherit;
}

.app {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;
}


/* ==========================
   CHAT
========================== */

.chat-container {
    width: 100%;
    max-width: 430px;
    height: 720px;
    max-height: calc(100vh - 48px);

    background: #ffffff;

    border-radius: 22px;

    box-shadow:
        0 20px 60px rgba(0, 30, 80, 0.15);

    display: flex;
    flex-direction: column;

    overflow: hidden;
}


/* ==========================
   HEADER
========================== */

.chat-header {
    min-height: 78px;

    padding: 14px 18px;

    display: flex;
    align-items: center;

    background: #032d60;

    color: #ffffff;
}

.agent-avatar,
.conversation-avatar {
    width: 46px;
    height: 46px;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    font-weight: 700;

    background: #0176d3;
    color: #ffffff;

    flex-shrink: 0;
}

.agent-information {
    margin-left: 12px;
    flex: 1;
}

.agent-name {
    font-size: 16px;
    font-weight: 700;
}

.agent-status {
    margin-top: 4px;

    display: flex;
    align-items: center;

    gap: 6px;

    font-size: 12px;

    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;

    border-radius: 50%;

    background: #45d483;
}

.header-menu {
    width: 38px;
    height: 38px;

    border: 0;
    background: transparent;

    color: #ffffff;

    cursor: pointer;

    font-size: 22px;
}


/* ==========================
   MESSAGE AREA
========================== */

.chat-messages {
    flex: 1;

    overflow-y: auto;

    padding: 22px 18px;

    background: #f7f9fb;

    scroll-behavior: smooth;
}

.conversation-start {
    text-align: center;

    padding: 12px 0 28px;
}

.conversation-start .conversation-avatar {
    margin: 0 auto 12px;
}

.conversation-start h2 {
    margin: 0;

    font-size: 18px;

    color: #181818;
}

.conversation-start p {
    margin: 6px 0 0;

    color: #706e6b;

    font-size: 13px;
}


/* ==========================
   MESSAGE BUBBLES
========================== */

.message-row {
    width: 100%;

    display: flex;

    margin-bottom: 16px;
}

.message-row.agent {
    justify-content: flex-start;
    align-items: flex-end;
}

.message-row.customer {
    justify-content: flex-end;
}

.message-avatar {
    width: 30px;
    height: 30px;

    margin-right: 8px;

    border-radius: 50%;

    background: #0176d3;

    color: #ffffff;

    font-size: 12px;
    font-weight: 700;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;
}

.message-bubble {
    max-width: 290px;

    padding: 11px 14px;

    line-height: 1.45;

    font-size: 14px;

    word-wrap: break-word;
    white-space: pre-wrap;
}

.agent-bubble {
    background: #ffffff;

    border: 1px solid #e5e5e5;

    color: #181818;

    border-radius:
        17px
        17px
        17px
        4px;
}

.customer-bubble {
    background: #0176d3;

    color: #ffffff;

    border-radius:
        17px
        17px
        4px
        17px;
}

.message-time {
    margin-top: 4px;

    font-size: 10px;

    color: #8e8e8e;
}

.message-row.customer .message-time {
    text-align: right;
}


/* ==========================
   TYPING
========================== */

.typing-container {
    padding:
        4px
        18px
        10px;

    background: #f7f9fb;
}

.typing-bubble {
    width: 60px;
    height: 35px;

    padding: 0 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 4px;

    background: #ffffff;

    border: 1px solid #e5e5e5;

    border-radius: 16px;
}

.typing-bubble span {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #777777;

    animation: typing 1.2s infinite;
}

.typing-bubble span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-bubble span:nth-child(3) {
    animation-delay: 0.30s;
}

@keyframes typing {
    0%,
    60%,
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.hidden {
    display: none;
}


/* ==========================
   MESSAGE COMPOSER
========================== */

.chat-composer {
    min-height: 70px;

    padding: 10px 12px;

    display: flex;
    align-items: flex-end;

    gap: 8px;

    border-top: 1px solid #e5e5e5;

    background: #ffffff;
}

.chat-composer textarea {
    flex: 1;

    max-height: 120px;

    resize: none;

    border: 1px solid #d8dde6;

    border-radius: 18px;

    padding: 10px 14px;

    line-height: 20px;

    outline: none;

    background: #ffffff;
}

.chat-composer textarea:focus {
    border-color: #0176d3;

    box-shadow:
        0 0 0 1px #0176d3;
}

.composer-button {
    width: 38px;
    height: 38px;

    border: 0;

    border-radius: 50%;

    background: transparent;

    color: #0176d3;

    font-size: 26px;

    cursor: pointer;
}

.send-button {
    height: 38px;

    border: 0;

    border-radius: 18px;

    padding: 0 17px;

    background: #0176d3;

    color: #ffffff;

    font-weight: 600;

    cursor: pointer;
}

.send-button:hover {
    background: #014486;
}

.send-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}


/* ==========================
   MOBILE
========================== */

@media (max-width: 520px) {
    .app {
        padding: 0;
    }

    .chat-container {
        max-width: none;

        height: 100vh;
        max-height: 100vh;

        border-radius: 0;
    }
}