/* 채팅 위젯 스타일 */
#chat-widget-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
}

/* 채팅 버튼 - 화면에 고정되어 스크롤과 함께 이동 */
#chat-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 9999;
}

#chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(255, 215, 0, 0.6);
}

#chat-toggle-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* 읽지 않은 메시지 배지 */
#chat-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

#chat-unread-badge.show {
    display: flex;
}

/* 채팅 창 - 화면에 고정 */
#chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    z-index: 9998;
}

#chat-window.show {
    display: flex;
}

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

/* 채팅 헤더 */
.chat-header {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: #333;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header p {
    margin: 0;
    font-size: 12px;
    opacity: 0.8;
}

.chat-close-btn {
    background: none;
    border: none;
    color: #333;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 24px;
    line-height: 1;
}

.chat-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* 이름 입력 폼 */
.chat-name-form {
    padding: 24px;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-name-form h5 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #333;
    text-align: center;
}

.chat-name-form input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.chat-name-form input:focus {
    border-color: #ffd700;
}

.chat-start-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: #333;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

/* 채팅 메시지 영역 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

/* 메시지 스타일 */
.chat-message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

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

.chat-message.user {
    align-items: flex-end;
}

.chat-message.admin {
    align-items: flex-start;
}

.chat-message .message-content {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    position: relative;
}

.chat-message.user .message-content {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.admin .message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.chat-message .message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.chat-message .sender-name {
    font-size: 12px;
    font-weight: 600;
    color: #007bff;
    margin-bottom: 4px;
}

/* 입력 영역 */
.chat-input-area {
    display: flex;
    padding: 12px;
    background: white;
    border-top: 1px solid #e0e0e0;
    gap: 8px;
}

#chat-message-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#chat-message-input:focus {
    border-color: #ffd700;
}

.chat-send-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
    stroke: #333;
}
    fill: white;
}

/* 로딩 인디케이터 */
.chat-loading {
    display: flex;
    justify-content: center;
    padding: 10px;
}

.chat-loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #007bff;
    margin: 0 3px;
    animation: bounce 1.4s infinite ease-in-out both;
}

.chat-loading span:nth-child(1) {
    animation-delay: -0.32s;
}

.chat-loading span:nth-child(2) {
    animation-delay: -0.16s;
}

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

/* 환영 메시지 */
.chat-welcome {
    text-align: center;
    padding: 20px;
    color: #666;
}

.chat-welcome h4 {
    margin: 0 0 8px 0;
    color: #333;
}

.chat-welcome p {
    margin: 0;
    font-size: 14px;
}

/* 스크롤바 스타일 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 채팅 종료 알림 */
.chat-closed-notice {
    padding: 20px;
    text-align: center;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    margin-top: 20px;
}

.closed-notice-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.closed-notice-content p {
    margin: 0;
    color: #856404;
    font-weight: 600;
    font-size: 14px;
}

.new-chat-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: #333;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    #chat-toggle-btn {
        width: 56px;
        height: 56px;
        bottom: 15px;
        right: 15px;
    }
    
    #chat-toggle-btn svg {
        width: 26px;
        height: 26px;
    }
    
    #chat-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 15px;
        max-height: 600px;
    }
    
    .chat-header h4 {
        font-size: 15px;
    }
    
    .chat-header p {
        font-size: 11px;
    }
    
    .chat-name-form {
        padding: 20px;
    }
    
    .chat-name-form h5 {
        font-size: 13px;
    }
    
    .chat-name-form input {
        font-size: 13px;
        padding: 9px 11px;
    }
    
    .chat-start-btn {
        font-size: 13px;
        padding: 11px;
    }
    
    .chat-message .message-content {
        max-width: 85%;
        font-size: 13px;
        padding: 9px 12px;
    }
    
    .chat-input-area {
        padding: 10px;
    }
    
    #chat-message-input {
        font-size: 13px;
        padding: 9px 14px;
    }
    
    .chat-send-btn {
        width: 36px;
        height: 36px;
    }
    
    .chat-send-btn svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    #chat-toggle-btn {
        width: 52px;
        height: 52px;
        bottom: 12px;
        right: 12px;
    }
    
    #chat-window {
        width: calc(100vw - 24px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: 12px;
    }
    
    .chat-closed-notice {
        padding: 15px;
    }
    
    .closed-notice-content p {
        font-size: 13px;
    }
    
    .new-chat-btn {
        font-size: 13px;
        padding: 9px 16px;
    }
}
