/* ==========================================================================
   DAEHAN INST AI CHATBOT WIDGET STYLES (Futuristic B2B Glassmorphism)
   ========================================================================== */

/* Launcher Container */
#dh-chatbot-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    font-family: 'Inter', 'Noto Sans KR', sans-serif;
    display: none; /* Initially hidden on intro */
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

#dh-chatbot-container.visible {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Floating Launcher Button */
#dh-chatbot-launcher {
    position: relative;
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0a192f 0%, #172a45 50%, #0a192f 100%);
    border: 2px solid #64ffda;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 0 20px rgba(100, 255, 218, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64ffda;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    user-select: none;
}

#dh-chatbot-launcher:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 30px rgba(100, 255, 218, 0.6);
    border-color: #a8fff0;
}

#dh-chatbot-launcher.active {
    background: linear-gradient(135deg, #112240 0%, #0a192f 100%);
    border-color: #64ffda;
    box-shadow: 0 0 25px rgba(100, 255, 218, 0.5);
}

/* Pulse Beacon Animation */
.dh-launcher-pulse {
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 50%;
    border: 2px solid rgba(100, 255, 218, 0.6);
    animation: dhPulseRing 2.4s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    pointer-events: none;
}

@keyframes dhPulseRing {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    60% {
        transform: scale(1.35);
        opacity: 0;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

/* Periodic Bounce Animation for Attention */
.dh-bounce-attention {
    animation: dhIconBounce 4s ease-in-out infinite;
}

@keyframes dhIconBounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    85% {
        transform: translateY(-9px);
    }
    90% {
        transform: translateY(0);
    }
    93% {
        transform: translateY(-4px);
    }
    96% {
        transform: translateY(0);
    }
}

/* Launcher Icon SVGs */
.dh-launcher-icon {
    width: 34px;
    height: 34px;
    fill: currentColor;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.dh-close-icon {
    display: none;
    width: 26px;
    height: 26px;
    fill: #64ffda;
}

#dh-chatbot-launcher.active .dh-launcher-icon {
    display: none;
}

#dh-chatbot-launcher.active .dh-close-icon {
    display: block;
}

/* Online Badge */
.dh-online-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background-color: #10b981;
    border: 2.5px solid #0a192f;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

/* Attention Tooltip Bubble */
#dh-chatbot-tooltip {
    position: absolute;
    bottom: 12px;
    right: 80px;
    background: rgba(10, 25, 47, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(100, 255, 218, 0.5);
    border-radius: 24px;
    padding: 10px 18px;
    color: #e6f1ff;
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 15px rgba(100, 255, 218, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    opacity: 0;
    transform: translateX(10px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#dh-chatbot-tooltip.show {
    opacity: 1;
    transform: translateX(0) scale(1);
    pointer-events: auto;
}

#dh-chatbot-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -6px;
    transform: translateY(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: rgba(10, 25, 47, 0.95);
    border-right: 1px solid rgba(100, 255, 218, 0.5);
    border-top: 1px solid rgba(100, 255, 218, 0.5);
}

.dh-tooltip-close {
    font-size: 14px;
    color: #8892b0;
    margin-left: 6px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.dh-tooltip-close:hover {
    color: #64ffda;
}

/* ==========================================================================
   Chatbot Window
   ========================================================================== */
#dh-chatbot-window {
    position: fixed;
    bottom: 105px;
    right: 28px;
    width: 390px;
    height: 590px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 130px);
    background: linear-gradient(180deg, rgba(13, 27, 49, 0.97) 0%, rgba(2, 12, 27, 0.98) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(100, 255, 218, 0.35);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(100, 255, 218, 0.15);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s;
    font-family: 'Inter', 'Noto Sans KR', sans-serif;
}

#dh-chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.dh-chat-header {
    background: linear-gradient(135deg, #0a192f 0%, #172a45 100%);
    border-bottom: 1px solid rgba(100, 255, 218, 0.25);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.dh-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dh-avatar-badge {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #112240 0%, #020c1b 100%);
    border: 1.5px solid #64ffda;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64ffda;
    box-shadow: 0 0 12px rgba(100, 255, 218, 0.3);
}

.dh-avatar-badge svg {
    width: 22px;
    height: 22px;
}

.dh-header-info h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ccd6f6;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dh-header-info p {
    margin: 2px 0 0 0;
    font-size: 0.76rem;
    color: #64ffda;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dh-status-dot {
    width: 7px;
    height: 7px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px #10b981;
    display: inline-block;
}

.dh-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dh-action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 8px;
    color: #8892b0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.dh-action-btn:hover {
    background: rgba(100, 255, 218, 0.15);
    border-color: #64ffda;
    color: #64ffda;
    transform: translateY(-1px);
}

.dh-action-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Messages Body */
.dh-chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.dh-chat-body::-webkit-scrollbar {
    width: 5px;
}

.dh-chat-body::-webkit-scrollbar-track {
    background: rgba(2, 12, 27, 0.5);
}

.dh-chat-body::-webkit-scrollbar-thumb {
    background: rgba(100, 255, 218, 0.2);
    border-radius: 4px;
}

.dh-chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 255, 218, 0.4);
}

/* Message Bubbles */
.dh-msg-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: dhMsgFadeIn 0.3s ease forwards;
}

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

.dh-msg-row.user {
    justify-content: flex-end;
}

.dh-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #112240;
    border: 1px solid #64ffda;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64ffda;
    flex-shrink: 0;
    margin-top: 2px;
}

.dh-msg-avatar svg {
    width: 16px;
    height: 16px;
}

.dh-msg-bubble {
    max-width: 82%;
    padding: 12px 15px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.55;
    word-break: break-word;
}

.dh-msg-row.ai .dh-msg-bubble {
    background: rgba(17, 34, 64, 0.9);
    border: 1px solid rgba(100, 255, 218, 0.25);
    color: #ccd6f6;
    border-top-left-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.dh-msg-row.user .dh-msg-bubble {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    border: 1px solid rgba(147, 197, 253, 0.3);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

/* Formatted Elements inside AI bubble */
.dh-msg-bubble strong {
    color: #64ffda;
    font-weight: 700;
}

.dh-msg-bubble a {
    color: #64ffda;
    text-decoration: underline;
    font-weight: 600;
}

.dh-msg-bubble a:hover {
    color: #a8fff0;
}

.dh-contact-card {
    background: rgba(10, 25, 47, 0.9);
    border: 1px dashed #64ffda;
    border-radius: 10px;
    padding: 12px;
    margin-top: 10px;
    font-size: 0.83rem;
}

.dh-contact-card-title {
    font-weight: 700;
    color: #64ffda;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dh-contact-link-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.dh-quick-contact-btn {
    background: rgba(100, 255, 218, 0.1);
    border: 1px solid #64ffda;
    color: #64ffda;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.dh-quick-contact-btn:hover {
    background: #64ffda;
    color: #0a192f;
    transform: translateY(-1px);
}

/* Quick Inquiry Chips */
.dh-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.dh-chip {
    background: rgba(23, 42, 69, 0.8);
    border: 1px solid rgba(100, 255, 218, 0.25);
    color: #8892b0;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.dh-chip:hover {
    background: rgba(100, 255, 218, 0.15);
    border-color: #64ffda;
    color: #64ffda;
    transform: translateY(-1px);
}

/* Typing Indicator */
.dh-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
}

.dh-typing-dot {
    width: 7px;
    height: 7px;
    background-color: #64ffda;
    border-radius: 50%;
    opacity: 0.4;
    animation: dhTypingBlink 1.4s infinite both;
}

.dh-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.dh-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dhTypingBlink {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1.15);
    }
}

/* Chat Footer / Input */
.dh-chat-footer {
    background: rgba(10, 25, 47, 0.98);
    border-top: 1px solid rgba(100, 255, 218, 0.2);
    padding: 12px 14px 10px 14px;
}

.dh-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(17, 34, 64, 0.8);
    border: 1px solid rgba(100, 255, 218, 0.3);
    border-radius: 24px;
    padding: 4px 6px 4px 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dh-input-wrapper:focus-within {
    border-color: #64ffda;
    box-shadow: 0 0 12px rgba(100, 255, 218, 0.25);
}

.dh-chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 0.88rem;
    font-family: inherit;
    padding: 6px 0;
}

.dh-chat-input::placeholder {
    color: #8892b0;
    font-size: 0.82rem;
}

.dh-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #64ffda 0%, #00b4d8 100%);
    border: none;
    color: #0a192f;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dh-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 12px rgba(100, 255, 218, 0.6);
}

.dh-send-btn svg {
    width: 16px;
    height: 16px;
    margin-left: 2px;
}

.dh-footer-sub {
    font-size: 0.68rem;
    color: #64748b;
    text-align: center;
    margin-top: 6px;
    letter-spacing: 0.2px;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #dh-chatbot-container {
        bottom: 20px;
        right: 20px;
    }

    #dh-chatbot-launcher {
        width: 60px;
        height: 60px;
    }

    #dh-chatbot-window {
        bottom: 85px;
        right: 15px;
        left: 15px;
        width: auto;
        height: calc(100vh - 110px);
        border-radius: 14px;
    }

    #dh-chatbot-tooltip {
        right: 70px;
        font-size: 0.8rem;
        padding: 8px 14px;
    }
}
