/* =========================================
   HALAMAN AI (ASISTEN VIRTUAL) - TEMA TERANG
   ========================================= */
.ai-page {
    max-width: 800px;
    margin: 40px auto 100px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px); /* Menyesuaikan tinggi layar */
    min-height: 600px;
}

.ai-header {
    text-align: center;
    margin-bottom: 30px;
}

.ai-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(90deg, #111111, #2563eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.ai-header p {
    color: #777777;
    font-size: 0.95rem;
}

/* Kotak Chat Utama */
.chat-container {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(37, 99, 235, 0.08), 0 4px 15px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(10px);
}

/* Area Pesan */
.chat-messages {
    flex-grow: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Scrollbar tipis biar tetap rapi di tema terang */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

/* Desain Balon Pesan */
.message {
    display: flex;
    gap: 15px;
    max-width: 85%;
    animation: fadeInUp 0.35s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.ai {
    align-self: flex-start;
}

.avatar-chat {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden; /* biar foto avatar ke-crop bulat rapi */
}

/* Avatar berupa foto (img) mengisi penuh lingkaran avatar-chat */
.avatar-chat img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.message.user .avatar-chat {
    background: #111111;
    color: #ffffff;
}

.message.ai .avatar-chat {
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    color: #fff;
    padding: 6px; /* logo diberi sedikit ruang biar tidak mepet ke tepi lingkaran */
}

.bubble {
    background: #f4f5f7;
    padding: 15px 20px;
    border-radius: 20px;
    color: #222222;
    font-size: 0.95rem;
    line-height: 1.5;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.message.user .bubble {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border: none;
    border-top-right-radius: 4px;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
}

.message.ai .bubble {
    border-top-left-radius: 4px;
}

/* Area Ketik (Input) */
.chat-input-area {
    padding: 20px;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    gap: 15px;
}

.chat-input {
    flex-grow: 1;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 30px;
    padding: 15px 25px;
    color: #111111;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    background: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.btn-send {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.3);
}

.btn-send:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.4);
}

/* Animasi mengetik */
.typing-indicator {
    display: none;
    gap: 4px;
    padding: 15px 20px;
    background: #f4f5f7;
    border-radius: 20px;
    border-top-left-radius: 4px;
    width: fit-content;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #2563eb;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}