* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: url('./background.jpg') center/cover no-repeat fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .4);
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.header p {
  font-size: 1.5rem;
  font-weight: 700;
  color: rgb(255, 183, 0);
}


@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* Chat container */
.chat-container {
    width: 100%;
    max-width: 900px;
    background: rgba(0, 0, 0, .72);
    backdrop-filter: blur(8px);
    border-radius: 22px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .55);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 72vh;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, .08);
}

#chat {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#chat::-webkit-scrollbar {
    width: 8px;
}

#chat::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .25);
    border-radius: 4px;
}

/* Messages */
.message {
    display: flex;
    gap: .75rem;
    animation: fadeInUp .25s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.message-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: #b30000;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}

.user .message-avatar {
    background: linear-gradient(135deg, #ff2936, #b30000);
}

.bot .message-avatar {
    background: linear-gradient(135deg, #f2f1f1, #ababab);
}

.message-content {
    flex: 1;
    padding: 1rem 1.15rem;
    border-radius: 18px;
    line-height: 1.55;
    max-width: 85%;
    border: 1px solid rgba(255, 255, 255, .08);
}

.user .message-content {
    background: linear-gradient(135deg, #ff2936, #b30000);
    color: #fff;
    margin-left: auto;
    margin-right: 0;
    max-width: 78%;
}

.bot .message-content {
    background: #f7f7f7;
    color: #000000;
    border: 1px solid #e7e7e7;
    max-width: 86%;
}

.error .message-content {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: #fff;
}

/* === Segmented Bot Responses (2025-09-12) === */
.resp-block {
  margin: 0.35rem 0;
  line-height: 1.55;
}

.resp-divider {
  border: none;
  border-top: 1px solid rgba(0,0,0,.12);
  margin: 0.5rem 0;
}

/* Input row */
.input-container {
    padding: 1rem 1.25rem;
    background: #0f0f10;
    border-top: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    gap: .8rem;
    align-items: center;
}

#userInput {
    flex: 1;
    padding: .95rem 1.1rem;
    border: 2px solid #2a2a2a;
    border-radius: 26px;
    font-size: 1rem;
    outline: none;
    transition: all .25s ease;
    background: #121214;
    color: #fff;
}

#userInput::placeholder {
    color: #9aa0a6;
}

#userInput:focus {
    border-color: #ff2936;
    box-shadow: 0 0 0 3px rgba(255, 41, 54, .15);
    background: #0d0d0f;
}

.send-button {
    padding: .95rem 1.25rem;
    background: linear-gradient(135deg, #ff2936, #b30000);
    color: white;
    border: none;
    border-radius: 26px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 41, 54, .3);
}

.send-button:active {
    transform: translateY(0);
}

/* Loading pill */
.loading {
    display: none;
    align-items: center;
    gap: .5rem;
    color: #ffe7e7;
    font-style: italic;
    margin-top: .75rem;
}

.loading-dots {
    display: inline-flex;
    gap: 3px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: #ffe7e7;
    border-radius: 50%;
    animation: loadingDots 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes loadingDots {

    0%,
    80%,
    100% {
        transform: scale(.8);
        opacity: .5
    }

    40% {
        transform: scale(1);
        opacity: 1
    }
}

@media (max-width: 600px) {
    .header h1 {
        font-size: 1.9rem;
    }

    .chat-container {
        height: 76vh;
    }

    .message-content {
        max-width: 92%;
    }

}

/* === P5R Title Readability Upgrade (2025-09-12) === */
/* Improve font rendering across platforms */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Title container to create contrast against the busy background */
.title-badge {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(0,0,0,.70), rgba(0,0,0,.45));
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 12px 30px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(4px);
}