:root {
    --primary-color: #ff8fb1;
    --secondary-color: #ffcce1;
    --bg-gradient: linear-gradient(135deg, #fff5f7 0%, #ffe4e9 100%);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.5);
    --text-color: #5d4a4e;
    --bot-msg-bg: #ffeef2;
    --user-msg-bg: #ff8fb1;
    --shadow: 0 8px 32px 0 rgba(255, 143, 177, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Noto Sans TC', sans-serif;
}

body {
    background: transparent;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* 兔兔懸浮按鈕 */
#bunny-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    border: 3px solid var(--primary-color);
}

#bunny-launcher:hover {
    transform: scale(1.1) rotate(5deg);
}

#bunny-launcher img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

/* 聊天視窗 - 全螢幕貼合 iframe */
#chat-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
}

/* 隱藏最大化按鈕 (已永遠全螢幕) */
#maximize-chat {
    display: none;
}

/* 手機版 RWD */
@media (max-width: 480px) {
    body {
        padding: 10px;
        align-items: flex-start;
    }

    #chat-container {
        width: 100%;
        height: calc(100vh - 20px);
        max-height: none;
        border-radius: 16px;
        margin: 0;
    }

    .chat-header {
        padding: 15px;
    }

    .chat-header h2 {
        font-size: 1rem;
    }

    #chat-messages {
        padding: 15px;
    }

    .message {
        font-size: 0.9rem;
        padding: 10px 14px;
    }

    .chat-input-area {
        padding: 12px;
    }

    #user-input {
        padding: 10px 14px;
        font-size: 16px;
        /* 防止 iOS 自動縮放 */
    }

    .quick-replies {
        padding: 8px 12px;
    }

    .chip {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
}

/* 標題欄 */
.chat-header {
    padding: 20px;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
}

.chat-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

/* 標題按鈕群組 */
.header-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.control-btn:active {
    transform: scale(0.95);
}

/* 訊息區域 */
#chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 隱藏滾動條 */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 10px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: messageIn 0.3s ease forwards;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-message {
    align-self: flex-start;
    background: var(--bot-msg-bg);
    color: var(--text-color);
    border-bottom-left-radius: 4px;
}

.user-message {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

/* 輸入區域 */
.chat-input-area {
    padding: 20px;
    background: white;
    display: flex;
    gap: 10px;
    align-items: center;
}

#user-input {
    flex: 1;
    border: 2px solid #eee;
    padding: 12px 18px;
    border-radius: 25px;
    outline: none;
    transition: border-color 0.3s;
}

#user-input:focus {
    border-color: var(--primary-color);
}

#send-btn {
    background: var(--primary-color);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s;
}

#send-btn:hover {
    background: #ff76a1;
}

/* 快速回覆按鈕 */
.quick-replies {
    padding: 10px 20px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    background: white;
    white-space: nowrap;
    border-top: 1px solid #fcf2f4;
}

.quick-replies::-webkit-scrollbar {
    display: none;
}

.chip {
    padding: 6px 14px;
    background: #fff5f7;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    background: var(--primary-color);
    color: white;
}

/* 輸入中的動畫 */
.typing-indicator {
    padding: 10px;
    display: none;
    align-items: center;
    gap: 5px;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* --- 管理員後台樣式 --- */
.admin-container {
    max-width: 800px;
    width: 90%;
    margin: 40px auto;
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.admin-header {
    margin-bottom: 25px;
    border-bottom: 2px solid var(--bot-msg-bg);
    padding-bottom: 15px;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
}

.admin-container .save-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: 0.3s;
    width: 100%;
}