/* Chatbot Icon Container */
#chatbot-icon {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 90px;
    height: 90px;
    cursor: pointer;
    z-index: 9998;
    transition: transform 0.2s ease-in-out;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

#chatbot-icon svg {
    width: 100%;
    height: 100%;
}

#chatbot-icon:hover {
    transform: scale(1.1);
}

/* Chatbot Window */
#chatbot-window {
    position: fixed;
    bottom: 185px;
    right: 20px;
    width: 380px;
    height: 670px;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
    z-index: 9999;
    overflow: hidden;
    
    transform-origin: bottom right;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 1;
    transform: scale(1);
}

#chatbot-window.hidden {
    transform: scale(0.5);
    opacity: 0;
    pointer-events: none;
}

/* Header */
#chatbot-header {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#chatbot-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

#chatbot-close {
    background: none;
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
    padding: 0;
}

#chatbot-close:hover { opacity: 1; }

/* Body (Chat Area) */
#chatbot-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    background-color: #f3f4f6;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Footer (Input Area) - 수정됨 */
#chatbot-footer {
    padding: 15px;
    border-top: 1px solid #e5e7eb;
    background-color: #ffffff;
    display: flex;
    flex-direction: column; /* 내부 요소 전환을 위해 */
    justify-content: center;
    min-height: 70px; /* 높이 고정하여 전환 시 덜컹거림 방지 */
    flex-shrink: 0;
}

/* 입력창 그룹 (JS로 생성 또는 래핑 예정) */
#chatbot-input-group {
    display: flex;
    width: 100%;
    gap: 10px;
    align-items: center;
}

#chatbot-input {
    flex: 1;
    font-size: 1rem;
    padding: 12px 15px;
    border: 1px solid #d1d5db;
    border-radius: 25px;
    outline: none;
}

#chatbot-input:focus {
    border-color: #3b82f6;
}

#chatbot-send-btn {
    background-color: #3b82f6;
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* [NEW] 하단 3버튼 그룹 스타일 */
#chatbot-footer-options {
    display: none; /* 기본 숨김, JS로 토글 */
    width: 100%;
    justify-content: space-between;
    gap: 8px;
}

.footer-option-btn {
    flex: 1; /* 3등분 */
    background: #ffffff;
    color: #3b82f6;
    border: 1px solid #3b82f6;
    border-radius: 12px;
    padding: 12px 4px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
}

.footer-option-btn:hover {
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.2);
}

/* Messages */
.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

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

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

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.bot-message .message-content {
    background-color: #ffffff;
    color: #333;
    border: 1px solid #e5e7eb;
    border-top-left-radius: 4px;
}

.user-message .message-content {
    background-color: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

/* Option Bubbles (채팅창 내부 말풍선 옵션용 - 기존 유지) */
.option-bubble {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.rounded-btn {
    background: white;
    color: #3b82f6;
    border: 1px solid #3b82f6;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
}

.rounded-btn:hover {
    background: #eff6ff;
}

/* Loading Animation */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: #3B82F6;
    border-radius: 50%;
    animation: pulse 1.4s infinite ease-in-out both;
}

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

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

/* Weather Styles */
.weather-title-outside {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 6px; 
    padding-left: 4px;  
    text-align: left;
}

.weather-card {
    font-family: 'Noto Sans KR', sans-serif;
    width: 100%;
    background-color: #f9fafb; 
    border: 1px solid #e5e7eb; 
    border-radius: 12px;
    padding: 12px;
    box-sizing: border-box;
}

.weather-main-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 5px;
}

.weather-icon-img {
    width: 50px;
    height: 50px;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.1));
}

.weather-temp-box {
    display: flex;
    flex-direction: column;
}

.weather-temp {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    color: #1f2937;
}

.weather-desc {
    font-size: 0.8rem;
    color: #4b5563;
    margin-top: 2px;
}

.weather-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid #d1d5db; 
    border-radius: 8px;
    margin-bottom: 10px;
    background-color: #f9fafb;
    overflow: hidden;
}

.weather-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    border-right: 1px solid #d1d5db;
    border-bottom: 1px solid #d1d5db;
}

.weather-item:nth-child(2n) { border-right: none; }
.weather-item:nth-child(n+3) { border-bottom: none; }

.weather-label {
    font-size: 0.8rem;
    font-weight: 600;  
    color: #6b7280;    
    margin-bottom: 2px;
}

.weather-value {
    font-size: 0.9rem;
    font-weight: 600;  
    color: #1f2937;    
}

.weather-footer {
    display: flex;
    justify-content: space-between;
    padding: 0 5px;
    font-size: 0.75rem;
    color: #6b7280;
}

.sun-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Mobile Styles */
@media (max-width: 768px) {
    #chatbot-icon {
        position: fixed !important;
        right: 2% !important;
        bottom: 17% !important;
        width: 18% !important;
        height: auto !important;
        aspect-ratio: 1/1;
        z-index: 2000 !important;
    }

    #chatbot-window {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100%; height: 100%;
        border-radius: 0; margin: 0;
        z-index: 9999;
        transform: translateY(0); 
        opacity: 1;
        transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    }

    #chatbot-window.hidden {
        transform: translateY(100%); 
        opacity: 1; 
        pointer-events: auto; 
    }

    #chatbot-header {
        padding-top: 15px; 
        height: 60px;
        border-radius: 0;
    }
    
    #chatbot-header h3 { font-size: 1.2rem; }
    
    #chatbot-close {
        font-size: 28px;
        padding: 10px;
    }

    #chatbot-footer {
        padding: 10px;
        padding-bottom: 20px; 
    }
    
    #chatbot-input { font-size: 16px !important; }
}