/* 
 * Chatbot Widget CSS - Công ty Chào Ngày Mới
 * File này có thể nhúng vào bất kỳ website nào
 * Chỉ cần thêm: <link rel="stylesheet" href="chatbot.css">
 */

/* Font Awesome (nếu chưa có trên website) */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css');

/* Reset và base styles cho chatbot widget */
#chaongaymoi-chatbot-widget,
#chaongaymoi-chatbot-widget * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#chaongaymoi-chatbot-widget {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    user-select: none;
}

/* Chatbot toggle button */
#chaongaymoi-chatbot-toggle {
    width: 75px;
    height: 75px;
    background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.6);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    position: relative;
    overflow: hidden;
}

#chaongaymoi-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.6);
}

#chaongaymoi-chatbot-toggle:active {
    transform: scale(0.95);
}

/* Pulse animation cho button */
#chaongaymoi-chatbot-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%) scale(0);
    animation: chatbot-pulse 2s infinite;
}

@keyframes chatbot-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    70% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Icon animation */
#chaongaymoi-chatbot-toggle i {
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

#chaongaymoi-chatbot-toggle:hover i {
    transform: rotate(10deg);
}

/* Tooltip for chatbot button */
#chaongaymoi-chatbot-toggle::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#chaongaymoi-chatbot-toggle::before {
    content: '';
    position: absolute;
    bottom: 92%;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

#chaongaymoi-chatbot-toggle:hover::after,
#chaongaymoi-chatbot-toggle:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Notification badge */
.chaongaymoi-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: chatbot-bounce 1s infinite;
}

@keyframes chatbot-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* Chatbot container */
#chaongaymoi-chatbot-container {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 420px;
    height: 680px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid #3B82F6;
}

#chaongaymoi-chatbot-container.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chatbot header */
.chaongaymoi-chatbot-header {
    background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.chaongaymoi-chatbot-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chaongaymoi-chatbot-title i {
    font-size: 18px;
}

.chaongaymoi-status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: chatbot-blink 2s infinite;
}

@keyframes chatbot-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

#chaongaymoi-chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

#chaongaymoi-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Chatbot iframe */
#chaongaymoi-chatbot-iframe {
    width: 100%;
    height: 608px;
    border: none;
    display: block;
    background: #f9fafb;
}

/* Loading state */
.chaongaymoi-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 608px;
    background: #f9fafb;
    padding: 20px;
    box-sizing: border-box;
}

/* Fallback state */
.chaongaymoi-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 608px;
    background: #f9fafb;
    padding: 20px;
    box-sizing: border-box;
}

.chaongaymoi-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3B82F6;
    border-radius: 50%;
    animation: chatbot-spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes chatbot-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.chaongaymoi-loading-text {
    color: #6b7280;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    max-width: 200px;
    line-height: 1.4;
}

/* Welcome message */
.chaongaymoi-welcome-message {
    position: absolute;
    bottom: 85px;
    right: 80px;
    background: white;
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    max-width: 280px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.chaongaymoi-welcome-message.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.chaongaymoi-welcome-message::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

.chaongaymoi-welcome-text {
    font-size: 14px;
    color: #374151;
    line-height: 1.4;
    margin-bottom: 8px;
}

.chaongaymoi-welcome-close {
    position: absolute;
    top: 4px;
    right: 4px;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 12px;
    cursor: pointer;
    padding: 2px;
    border-radius: 2px;
}

.chaongaymoi-welcome-close:hover {
    color: #374151;
}

/* Responsive styles */
@media (max-width: 768px) {
    #chaongaymoi-chatbot-widget {
        bottom: 15px;
        right: 15px;
    }
    
    #chaongaymoi-chatbot-toggle {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }
    
    #chaongaymoi-chatbot-container {
        width: calc(100vw - 30px);
        right: -15px;
        height: 620px;
        border-width: 1px;
    }
    
    #chaongaymoi-chatbot-iframe {
        height: 548px;
    }
    
    .chaongaymoi-loading {
        height: 548px;
    }
    
    .chaongaymoi-welcome-message {
        max-width: calc(100vw - 140px);
        right: 85px;
    }
}

@media (max-width: 480px) {
    #chaongaymoi-chatbot-toggle {
        width: 65px;
        height: 65px;
        font-size: 26px;
    }
    
    #chaongaymoi-chatbot-container {
        width: calc(100vw - 20px);
        right: -10px;
        height: 560px;
        bottom: 80px;
        border-width: 1px;
    }
    
    #chaongaymoi-chatbot-iframe {
        height: 488px;
    }
    
    .chaongaymoi-loading {
        height: 488px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    #chaongaymoi-chatbot-container {
        background: #1f2937;
        border-color: #374151;
    }
    
    .chaongaymoi-loading {
        background: #1f2937;
    }
    
    .chaongaymoi-loading-text {
        color: #d1d5db;
    }
    
    .chaongaymoi-welcome-message {
        background: #1f2937;
        border-color: #374151;
        color: #d1d5db;
    }
    
    .chaongaymoi-welcome-message::after {
        background: #1f2937;
        border-color: #374151;
    }
}

/* Print styles */
@media print {
    #chaongaymoi-chatbot-widget {
        display: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    #chaongaymoi-chatbot-toggle {
        background: #000;
        color: #fff;
        border: 2px solid #fff;
    }
    
    #chaongaymoi-chatbot-container {
        border: 2px solid #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    #chaongaymoi-chatbot-toggle,
    #chaongaymoi-chatbot-container,
    .chaongaymoi-welcome-message {
        transition: none;
        animation: none;
    }
    
    #chaongaymoi-chatbot-toggle::before {
        animation: none;
    }
} 