/**
 * HLI Chatbot Widget - Floating Button & Window
 */

/* Widget Container */
.hli-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: var(--skin-body-font, 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

/* Floating Toggle Button */
.hli-chatbot-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--custom-primary-blue_d70);
    border: none;
    box-shadow:0 4px 12px rgb(96 96 96 / 40%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #fff;
}
.hli-chatbot-toggle .xi-message {
    font-size: 2rem;
}

.hli-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgb(14 11 3 / 39%);
}

.hli-chatbot-toggle:active {
    transform: scale(0.95);
}

/* Badge (notification) */
.hli-chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #f44336;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid #fff;
}

/* Chatbot Window */
.hli-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chatbot Header */
.hli-chatbot-header {
    background: #111;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.hli-chatbot-header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hli-chatbot-header-logo {
    height: 1rem;
    width: auto;
}

.hli-chatbot-header-subtitle {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.02em;
    margin-top: .25rem;
    margin-left: .25rem;
}

.hli-chatbot-close {
    background: transparent;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    color: #fff;
}

.hli-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Tabs */
.hli-chatbot-tabs {
    display: flex;
    background: var(--custom-secondary-gray03, #F4F4F4);
    border-bottom: none;
    padding: 0.375rem 1rem;
    gap: 4px;
}

.hli-chatbot-tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: none;
    font-size: 1rem;
    font-weight: 500;
    color: #999;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 0.375rem;
}

.hli-chatbot-tab:hover:not(.active) {
    color: var(--custom-secondary-gray02, #737B7D);
}

.hli-chatbot-tab.active {
    background: #fff;
    color: #111;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    height: 2.5rem;
    line-height: 100%;
}

/* Greeting Hero Section */
.hli-chatbot-greeting {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: start;
    padding: 52px 24px 48px;
    background: linear-gradient(341deg, rgba(0, 0, 0, 0.00) -2.32%, rgba(0, 0, 0, 0.70) 84.14%), #AEAEAE;
    text-align: center;
    color: #fff;
    min-height: 600px;
}

.hli-chatbot-greeting-logo {
    width: 160px;
    height: auto;
    margin-bottom: 12px;
    margin-top:6.25rem;
}

.hli-chatbot-greeting-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 16px;
    color: #fff;
    letter-spacing: 0.02em;
}

.hli-chatbot-greeting-text {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.7;
    margin: 0;
}

/* Chatbot Content */
.hli-chatbot-content {
    flex: 1;
    overflow-y: auto;
    background:#fff;
    height: 100%;
}

.hli-chatbot-buttons-container {
    min-height: 100%;
}

/* Input Area */
.hli-chatbot-input-area {
    padding: .5rem 1rem;
    background: var(--custom-secondary-gray03, #F4F4F4);
    display: flex;
    gap: 8px;
    align-items: center;
}

.hli-chatbot-input-field {
    flex: 1;
    min-width: 0;
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
    resize: none;
    overflow-y: auto;
    height: auto;
    max-height: calc(1.4em * 4 + 20px); /* 4줄 + padding */
}

.hli-chatbot-input-field:focus {
    border-color: var(--custom-primary-blue, #000);
}

/* New Chat Button */
.hli-chatbot-new-chat-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.hli-chatbot-new-chat-btn:hover {
    background: #f0f0f0;
    color: #333;
    border-color: #bbb;
}

.hli-chatbot-new-chat-btn:active {
    transform: scale(0.92);
}

.hli-chatbot-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--custom-primary-blue, #000);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.hli-chatbot-send-btn:hover {
    background: var(--custom-primary-blue_d70);
}

.hli-chatbot-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Loading State */
.hli-chatbot-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #999;
    width: 100%;
}

.spinner {
    width: 40px;
    height: 40px;
    /* border: 3px solid #f3f3f3; */
    border-top: 3px solid #000;
    border-bottom: 3px solid #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
    margin-left: -28px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hli-chatbot-loading p {
    font-size: 1rem;
    color: #000000;
    margin: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .hli-chatbot-widget {
        bottom: 60px;
        right: 10px;
    }

    .hli-chatbot-toggle {
        width: 56px;
        height: 56px;
    }

    .hli-chatbot-window {
        bottom: 70px;
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
    }
    .hli-chatbot-header {
        border-radius: 0;
    }

    /* Greeting Hero Section */
    .hli-chatbot-greeting {
        height: calc(100vh - 115px);
    }
}

@media (max-width: 480px) {
    .hli-chatbot-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .hli-chatbot-toggle {
        width: 50px;
        height: 50px;
    }
}

/* Open State */
.hli-chatbot-widget.open .hli-chatbot-toggle svg {
    transform: rotate(45deg);
}
.hli-chatbot-widget .hli-chatbot-toggle .xi-close { display: none; }
.hli-chatbot-widget.open .hli-chatbot-toggle .xi-message { display: none; }
.hli-chatbot-widget.open .hli-chatbot-toggle .xi-close { display: block; }
.hli-chatbot-widget.open .hli-chatbot-toggle {
    background: var(--custom-box-linear, linear-gradient(90deg, rgba(0, 0, 0, 0.00) 0%, rgba(0, 0, 0, 0.20) 100%), #AEAEAE);
}

/* Scrollbar Styling */
.hli-chatbot-content::-webkit-scrollbar {
    width: 6px;
}

.hli-chatbot-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.hli-chatbot-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.hli-chatbot-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Tab Content Transition */
.tab-exit {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.tab-enter {
    animation: tabFadeIn 0.15s ease;
}

@keyframes tabFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
