body {
    background: linear-gradient(135deg, #e9f2ff, #f8fbff);
    font-family: 'Inter', system-ui, sans-serif;
}

/* ===== App Wrapper (Mobile-safe full height) ===== */
.app-wrapper {
    min-height: 100dvh; /* fixes mobile viewport issues */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===== Chat Container ===== */
.chat-container {
    width: 100%;
    max-width: 420px;
    height: 100dvh;
    max-height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
    overflow: hidden;
}

/* Header */
.chat-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #0d6efd;
    color: #fff;
    padding: 14px 16px;
}


.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.title {
    font-weight: 600;
}

.subtitle {
    font-size: 12px;
    opacity: .85;
}

/* Chat History */
.chat-history {
    flex: 1;
    padding: 16px;
    padding-bottom: 90px; /* space for footer */
    overflow-y: auto;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
}


/* Messages */
.message {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    max-width: 70%;
}

/* Incoming */
.message.incoming {
    align-self: flex-start;
}

.message.incoming p {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px 16px 16px 4px;
    color: #111;
}

/* Outgoing */
.message.outgoing {
    align-self: flex-end;
    text-align: right;
}

.message.outgoing p {
    background: #0d6efd;
    color: #fff;
    border-radius: 16px 16px 4px 16px;
}

/* Bubble */
.message p {
    padding: 10px 14px;
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
}

/* Timestamp */
.timestamp {
    font-size: 11px;
    opacity: .6;
    margin-top: 4px;
}

/* Typing */
.typing p {
    font-style: italic;
    opacity: .8;
}

/* Footer */
.chat-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: #fff;
    display: flex;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
}


.chat-footer input {
    border-radius: 999px;
    padding: 10px 14px;
}

.chat-footer input:focus {
    box-shadow: 0 0 0 3px rgba(13,110,253,.2);
}

.chat-footer button {
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 576px) {
    .chat-container {
        border-radius: 18px;
        height: 90dvh; /* fixes mobile viewport issues */
    }

    .app-wrapper {
        padding:16px;
        min-height: 90dvh; /* fixes mobile viewport issues */
    }
}

.chat-footer input {
    font-size: 16px; /* prevents iOS zoom */
}

