/* SC Web Chat Widget Styles - ShopChicken Brand */
:root {
    --sc-chat-primary: #BF1E2D; /* ShopChicken Red */
    --sc-chat-secondary: #D4AF37; /* Royal Gold */
    --sc-chat-text: #333333;
    --sc-chat-white: #ffffff;
    --sc-chat-bg: #f9f9f9;
}

/* 懸浮按鈕 */
.sc-webchat-launcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--sc-chat-primary);
    border: 2px solid var(--sc-chat-white);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(191, 30, 45, 0.4); /* Red shadow */
    cursor: pointer;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sc-webchat-launcher:hover {
    transform: scale(1.08);
    background: #a01825; /* Darker Red */
    box-shadow: 0 6px 20px rgba(191, 30, 45, 0.5);
}

.sc-webchat-launcher svg {
    width: 30px;
    height: 30px;
    fill: var(--sc-chat-secondary); /* Gold Icon */
}

/* 未讀徽章 */
.sc-webchat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4d4f;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
}

/* 聊天視窗 */
.sc-webchat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 360px;
    height: 500px;
    max-height: calc(100vh - 120px);
    background: var(--sc-chat-white);
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    z-index: 99999;
    overflow: hidden;
    border: 1px solid #eee;
    
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sc-webchat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.sc-webchat-header {
    padding: 16px 20px;
    background: var(--sc-chat-primary); /* Red header */
    color: var(--sc-chat-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid var(--sc-chat-secondary); /* Gold border */
}

.sc-webchat-header-info h4 {
    margin: 0 0 2px 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sc-webchat-header-info span {
    font-size: 12px;
    opacity: 0.9;
    color: #ffdce0;
}

.sc-webchat-close {
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    padding: 5px;
}

.sc-webchat-close:hover {
    opacity: 1;
}

/* Messages */
.sc-webchat-body {
    flex: 1;
    background: var(--sc-chat-bg);
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-image: radial-gradient(#e5e5e5 1px, transparent 1px);
    background-size: 20px 20px; /* Subtle pattern */
}

.sc-webchat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.sc-webchat-msg.sent {
    align-self: flex-end;
    background: var(--sc-chat-primary); /* Red */
    color: #fff;
    border-bottom-right-radius: 2px;
}

.sc-webchat-msg.received {
    align-self: flex-start;
    background: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 2px;
}

.sc-webchat-msg-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

/* Footer Input */
.sc-webchat-footer {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sc-webchat-input {
    flex: 1;
    border: none;
    background: #f5f5f5;
    padding: 12px 16px;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: background 0.2s;
}

.sc-webchat-input:focus {
    background: #ebebeb;
}

.sc-webchat-send {
    background: var(--sc-chat-primary);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.sc-webchat-send:hover {
    transform: scale(1.05);
}

.sc-webchat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.sc-webchat-send svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* Mobile RWD */
@media (max-width: 480px) {
    .sc-webchat-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .sc-webchat-launcher {
        bottom: 15px;
        right: 15px;
    }
}

/* ========== 會員專用聊天：鎖頭狀態 ========== */

/* 鎖頭按鈕樣式 */
.sc-webchat-launcher.locked {
    background: #9ca3af;
}

.sc-webchat-launcher.locked:hover {
    background: #6b7280;
}

/* 晃動動畫 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.sc-webchat-launcher.shake {
    animation: shake 0.5s ease-in-out;
}

/* ========== 登入提示 Modal ========== */

.sc-webchat-login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

.sc-webchat-login-content {
    background: #fff;
    padding: 32px;
    border-radius: 16px;
    text-align: center;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    position: relative;
}

.sc-webchat-login-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.sc-webchat-login-close:hover {
    color: #333;
}

.sc-webchat-login-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.sc-webchat-login-content h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    color: #333;
}

.sc-webchat-login-content p {
    margin: 0 0 24px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.sc-webchat-login-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.sc-webchat-login-buttons a {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.sc-btn-login {
    background: var(--sc-chat-primary);
    color: #fff;
}

.sc-btn-login:hover {
    background: #05a647;
    color: #fff;
}

.sc-btn-register {
    background: #f3f4f6;
    color: #333;
}

.sc-btn-register:hover {
    background: #e5e7eb;
    color: #333;
}
