/* ============================================================
   Chatbot Widget — Styles
   Tích hợp: <link rel="stylesheet" href="css/chatbot.css">
   ============================================================ */

/* Floating toggle button */
.chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00aaf2, #0078d4);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 120, 212, 0.4);
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: transform 0.2s;
}

.chat-toggle:hover {
    transform: scale(1.1);
}

/* Chat container */
.chat-container {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 370px;
    height: 580px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transition: opacity 0.3s, transform 0.3s;
}

.chat-container.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

/* Header */
.chat-header {
    background-image: url('https://chatbot-widget-code-hues.s3.ap-southeast-1.amazonaws.com/static/media/background_header_crop.a8c08ef4.png');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    padding: 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80px;
    position: relative;
}

.chat-header-title {
    background-image: url('https://chatbot-widget-code-hues.s3.ap-southeast-1.amazonaws.com/static/media/TTHCC_logo1.7598b8a3.svg');
    background-repeat: no-repeat;
    background-size: contain;
    background-position: left center;
    padding-left: 5rem;
    min-height: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chat-header-title-a {
    font-size: 13px;
    font-weight: 500;
    color: #00aaf2;
    white-space: pre-line;
    line-height: 1.3;
}

.chat-header-title-b {
    font-size: 13px;
    font-weight: 700;
    color: #00aaf2;
    line-height: 1.3;
}

.chat-header-buttons {
    display: flex;
    gap: 8px;
}

.chat-header-btn {
    background: none;
    border: none;
    color: #00aaf2;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
}

.chat-header-btn:hover {
    opacity: 1;
}

/* Messages area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background-image: url('https://chatbot-widget-code-hues.s3.ap-southeast-1.amazonaws.com/static/media/background_crop.92047d7f.png');
    background-repeat: no-repeat;
    background-size: auto;
    background-position: 100% 100%;
    background-color: #fff;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

.msg-row {
    display: flex;
    margin-bottom: 12px;
    align-items: flex-end;
}

.msg-row.bot {
    justify-content: flex-start;
}

.msg-row.user {
    justify-content: flex-end;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
    background-image: url('https://chatbot-widget-code-hues.s3.ap-southeast-1.amazonaws.com/static/media/TTHCC_logo1.7598b8a3.svg');
    background-repeat: no-repeat;
    background-size: 70%;
    background-position: center;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
}

.msg-bubble {
    max-width: 75%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.msg-row.bot .msg-bubble {
    background-color: #e3e3e3;
    color: #166ef0;
    border-radius: 16px 16px 16px 0;
}

.msg-row.user .msg-bubble {
    background-color: #fefcfc;
    color: #213dcf;
    border-radius: 16px 16px 0 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.msg-bubble a {
    color: #0078d4;
    text-decoration: underline;
}

.msg-bubble a:hover {
    color: #005a9e;
}

/* Quick options */
.quick-options {
    margin-left: 44px;
    margin-top: 6px;
    margin-bottom: 10px;
    width: calc(100% - 44px);
    max-width: 308px;
    background: #f2f2f2;
    border: 1px solid #e6e6e6;
    border-radius: 14px;
    padding: 10px;
}

.quick-option-btn {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 9px 10px;
    margin-bottom: 8px;
    font-size: 16px;
    line-height: 1.2;
    color: #fff;
    background: #14a3e4;
    cursor: pointer;
    text-align: center;
}

.quick-option-btn:last-child {
    margin-bottom: 0;
}

.quick-option-btn:hover {
    background: #0f94d2;
}

.quick-options.locked .quick-option-btn {
    background: #bfc3c7;
    cursor: not-allowed;
}

.quick-options.locked .quick-option-btn:hover {
    background: #bfc3c7;
}

.back-option-btn {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 9px 10px;
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.2;
    color: #fff;
    background: #999;
    cursor: pointer;
    text-align: center;
    display: none;
}

.quick-options.locked .back-option-btn {
    display: block;
}

.back-option-btn:hover {
    background: #777;
}

/* Back button */
.msg-row.back-button {
    justify-content: center;
    margin-top: 10px;
}

.back-button-wrapper {
    width: 100%;
    max-width: 300px;
    padding: 0 10px;
}

.back-button-wrapper button {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 10px;
    font-size: 14px;
    color: #fff;
    background: #999;
    cursor: pointer;
    text-align: center;
}

.back-button-wrapper button:hover {
    background: #777;
}

/* Choice message */
.msg-row.choice {
    justify-content: center;
}

.msg-choice {
    width: 100%;
    text-align: center;
    background: #d9d9d9;
    color: #0f61f1;
    border-radius: 4px;
    padding: 14px 10px;
    font-size: 16px;
    line-height: 1.3;
}

/* Procedure list */
.procedure-list {
    width: 100%;
    margin-left: 44px;
    margin-top: 6px;
    margin-bottom: 10px;
    max-width: 308px;
    background: #f2f2f2;
    border: 1px solid #e6e6e6;
    border-radius: 14px;
    padding: 10px;
}

.procedure-item {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.3;
    color: #fff;
    background: #14a3e4;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.procedure-item:last-child {
    margin-bottom: 0;
}

.procedure-item:hover {
    background: #0f94d2;
}

.procedure-detail {
    margin-left: 44px;
    margin-top: 6px;
    margin-bottom: 10px;
    max-width: 308px;
    background: #e8f4f8;
    border: 1px solid #cde9f1;
    border-radius: 10px;
    padding: 12px;
}

.procedure-detail-title {
    font-weight: 600;
    color: #0078d4;
    margin-bottom: 8px;
    font-size: 14px;
}

.procedure-detail-content {
    font-size: 13px;
    line-height: 1.5;
    color: #333;
}

/* Typing indicator */
.typing-indicator {
    display: none;
    padding: 8px 14px;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #aaa;
    border-radius: 50%;
    margin-right: 4px;
    animation: chatbot-typing 1.2s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatbot-typing {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50%       { opacity: 1;   transform: translateY(-4px); }
}

/* Input area */
.chat-input {
    display: flex;
    border-top: 1px solid #e8e8e8;
    background: #fff;
}

.chat-input input {
    flex: 1;
    padding: 14px 16px;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
}

.chat-input input::placeholder {
    color: #aaa;
}

.chat-input button {
    padding: 14px 20px;
    background: linear-gradient(135deg, #00aaf2, #0078d4);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.chat-input button:hover {
    background: linear-gradient(135deg, #0098d8, #006cbf);
}

/* Responsive */
@media (max-width: 480px) {
    .chat-container {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chat-toggle {
        bottom: 16px;
        right: 16px;
    }
}
