/* Chatbot Styles - Enhanced Modern Theme */
:root {
    --chat-bg: #1a1a2e;
    --chat-header-bg: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    --chat-accent: #00d4ff;
    --chat-accent-glow: rgba(0, 212, 255, 0.4);
    --chat-user-msg-bg: #302b63;
    --chat-bot-msg-bg: #2a2a40;
    --chat-text-color: #e0e0e0;
    --chat-border-radius: 16px;
    --chat-green: #00ff88;
    --chat-purple: #9d4edd;
}

/* Floating Button */
.chatbot-toggler {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--chat-header-bg);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px var(--chat-accent-glow), 0 5px 15px rgba(0,0,0,0.3);
    border: 2px solid var(--chat-accent);
    z-index: 9999;
    transition: all 0.3s ease;
    animation: pulse-glow 2s infinite;
}

.chatbot-toggler:hover {
    transform: scale(1.1);
    box-shadow: 0 0 25px var(--chat-accent-glow);
}

.chatbot-toggler span {
    position: absolute;
    color: #fff;
    font-size: 28px;
    transition: all 0.3s ease;
}

.chatbot-toggler span:last-child,
.chatbot-toggler.show-chat span:first-child {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.chatbot-toggler.show-chat span:last-child {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 10px var(--chat-accent-glow); }
    50% { box-shadow: 0 0 20px var(--chat-accent-glow), 0 0 10px var(--chat-accent); }
    100% { box-shadow: 0 0 10px var(--chat-accent-glow); }
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 160px;
    right: 20px;
    width: 380px;
    height: 650px; /* PC 화면에서 높이 증가 (550px -> 650px) */
    max-height: 80vh; /* 화면 높이의 80%를 넘지 않도록 */
    background: var(--chat-bg);
    border-radius: var(--chat-border-radius);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
    transform-origin: bottom right;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 20px rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

.show-chat .chatbot-window {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

/* Header */
.chat-header {
    background: var(--chat-header-bg);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--chat-accent);
}

.chatbot-avatar {
    font-size: 24px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.chat-header h2 {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.chat-header p {
    color: #aaa;
    font-size: 0.8rem;
    margin: 0;
}

.chat-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

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

/* Chat Box (Messages) */
.chat-box {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(0,0,0,0.2);
}

.chat-box::-webkit-scrollbar {
    width: 6px;
}
.chat-box::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

.chat-msg {
    display: flex;
    max-width: 85%;
    align-items: flex-start;
    gap: 8px;
    position: relative;
    flex-wrap: wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-msg .msg-content {
    flex: 1;
    min-width: 0; /* flexbox에서 텍스트 오버플로우 방지 */
    max-width: 100%;
    box-sizing: border-box;
}

.chat-msg.bot {
    align-self: flex-start;
}

.chat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-icon {
    width: 32px;
    height: 32px;
    background: var(--chat-header-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--chat-accent);
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.1);
}

.chat-msg.user .msg-icon {
    display: none;
}

.msg-content {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    word-break: break-word;
}

.chat-msg.bot .msg-content {
    background: var(--chat-bot-msg-bg);
    color: var(--chat-text-color);
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(255,255,255,0.05);
}

.chat-msg.user .msg-content {
    background: var(--chat-accent);
    color: #000;
    font-weight: 500;
    border-bottom-right-radius: 2px;
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.2);
}

.msg-time {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    margin-top: 4px;
    align-self: flex-end;
}

.chat-msg.user .msg-time {
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    opacity: 0.7;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--chat-accent);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }
    30% { transform: translateY(-10px); opacity: 1; }
}

/* Quick Action Buttons */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 12px 0;
}

.quick-action-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--chat-green);
    color: var(--chat-green);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}

.quick-action-btn:hover {
    background: var(--chat-green);
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
}

.quick-action-btn i {
    font-size: 0.9rem;
}

/* Product Cards */
.product-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 12px 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.product-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
    border-color: var(--chat-accent);
}

.product-card-image {
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    background-position: center;
    position: relative;
}

.product-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--chat-green);
    color: #000;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.product-card-content {
    padding: 12px;
}

.product-card-content h4 {
    margin: 0 0 6px 0;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
}

.product-card-content p {
    margin: 0 0 8px 0;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    line-height: 1.4;
}

.product-detail-item {
    margin: 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.product-detail-item i {
    color: var(--chat-accent);
    width: 18px;
    text-align: center;
}

.product-discount {
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(0, 255, 136, 0.1);
    border-left: 3px solid var(--chat-green);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--chat-green);
}

.product-card-price {
    color: var(--chat-accent);
    font-size: 0.9rem;
    font-weight: 600;
}

.product-card-action {
    padding: 8px 12px;
    background: rgba(255,255,255,0.05);
    border-top: 1px solid rgba(255,255,255,0.1);
    color: var(--chat-accent);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    cursor: pointer;
}

.product-card-action i {
    font-size: 0.75rem;
}

/* 셀프가입/간편상담신청 버튼 스타일 */
.bot-actions .bot-action-btn[data-action="self_signup"] {
    background: linear-gradient(135deg, var(--chat-green), #00cc70);
    border-color: var(--chat-green);
    color: #000;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 255, 136, 0.3);
}

.bot-actions .bot-action-btn[data-action="self_signup"]:hover {
    background: linear-gradient(135deg, #00cc70, var(--chat-green));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.4);
}

.bot-actions .bot-action-btn[data-action="consult"] {
    background: linear-gradient(135deg, var(--chat-accent), #0099cc);
    border-color: var(--chat-accent);
    color: #000;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
}

.bot-actions .bot-action-btn[data-action="consult"]:hover {
    background: linear-gradient(135deg, #0099cc, var(--chat-accent));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.4);
}

/* Comparison Table */
.comparison-table {
    margin: 12px 0;
    overflow-x: auto;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.comparison-table th {
    background: rgba(255,255,255,0.1);
    color: var(--chat-accent);
    padding: 8px;
    text-align: left;
    border: 1px solid rgba(255,255,255,0.1);
    font-weight: 600;
}

.comparison-table td {
    padding: 8px;
    border: 1px solid rgba(255,255,255,0.05);
    color: var(--chat-text-color);
}

.comparison-table tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}

.comparison-table tr:hover {
    background: rgba(0, 212, 255, 0.1);
}

/* Progress Indicator */
.progress-indicator {
    margin: 12px 0;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--chat-accent), var(--chat-green));
    border-radius: 2px;
    transition: width 0.3s ease;
    animation: progress-glow 2s infinite;
}

@keyframes progress-glow {
    0%, 100% { box-shadow: 0 0 5px var(--chat-accent); }
    50% { box-shadow: 0 0 15px var(--chat-accent); }
}

.progress-text {
    color: var(--chat-text-color);
    font-size: 0.85rem;
    text-align: center;
}

/* Action Buttons inside Bot Message */
.bot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.bot-action-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--chat-accent);
    color: var(--chat-accent);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.bot-action-btn:hover {
    background: var(--chat-accent);
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

/* Chat Input */
.chat-input-area {
    padding: 15px;
    background: var(--chat-bg);
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-menu-btn {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    color: var(--chat-text-color);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.chat-menu-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--chat-accent);
    color: var(--chat-accent);
}

.chat-input-area textarea {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 10px 15px;
    color: #fff;
    font-size: 0.95rem;
    resize: none;
    height: 45px;
    min-height: 45px;
    max-height: 120px;
    outline: none;
    transition: all 0.3s;
    font-family: inherit;
}

.chat-input-area textarea:focus {
    border-color: var(--chat-accent);
    background: rgba(255,255,255,0.1);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

.chat-input-area textarea::placeholder {
    color: rgba(255,255,255,0.4);
}

.chat-send-btn {
    width: 45px;
    height: 45px;
    background: var(--chat-accent);
    border: none;
    border-radius: 50%;
    color: #000;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--chat-accent-glow);
}

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

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chatbot-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    .chatbot-toggler {
        bottom: 80px;
        right: 15px;
    }
    .quick-actions {
        grid-template-columns: 1fr;
    }
    .product-card-image {
        height: 100px;
    }
    .comparison-table {
        font-size: 0.75rem;
    }
    .comparison-table th,
    .comparison-table td {
        padding: 6px;
    }
}

/* Animation for new messages */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-msg {
    animation: slideIn 0.3s ease;
}
