
.cfaq-popup-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 9998;
    border: none;
    overflow: hidden;
}

.cfaq-popup-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cfaq-popup-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.cfaq-popup-button-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

/* ==========================================
   POPUP CHAT WINDOW
   ========================================== */

.cfaq-popup-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 9999;
    overflow: hidden;
}

.cfaq-popup-window.cfaq-popup-open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

.cfaq-popup-header {
    background: linear-gradient(135deg, #30d596 0%, #45c47a 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.cfaq-popup-title h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.cfaq-popup-title p {
    margin: 4px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.cfaq-close-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    overflow: hidden;
}

.cfaq-close-button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cfaq-close-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.cfaq-popup-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7f7f8;
}

.cfaq-popup-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e5e5;
    display: flex;
    gap: 10px;
}

/* ==========================================
   FULLSCREEN CHAT CONTAINER
   ========================================== */

.cfaq-fullscreen-container {
    width: 100%;
    height: 80vh;
    min-height: 600px;
    max-width: 1000px;
    margin: 40px auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cfaq-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.cfaq-chat-header h3 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
}

.cfaq-chat-header p {
    margin: 8px 0 0 0;
    font-size: 16px;
    opacity: 0.9;
}

.cfaq-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: #f7f7f8;
}

.cfaq-chat-input-container {
    padding: 24px;
    background: white;
    border-top: 1px solid #e5e5e5;
    display: flex;
    gap: 12px;
}

/* ==========================================
   MESSAGES STYLING
   ========================================== */

.cfaq-message {
    margin-bottom: 16px;
    display: flex;
    animation: messageSlideIn 0.3s ease;
}

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

.cfaq-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.cfaq-user-message {
    justify-content: flex-end;
}

.cfaq-user-message .cfaq-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.cfaq-bot-message {
    justify-content: flex-start;
}

.cfaq-bot-message .cfaq-message-content {
    background: white;
    color: #2d3748;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ==========================================
   TYPING INDICATOR
   ========================================== */

.cfaq-typing-indicator .cfaq-message-content {
    display: flex;
    gap: 4px;
    padding: 12px 20px;
}

.cfaq-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e0;
    animation: typing 1.4s infinite;
}

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

.cfaq-typing-indicator 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;
    }
}

/* ==========================================
   INPUT FIELD & BUTTON
   ========================================== */

.cfaq-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e5e5;
    border-radius: 24px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.cfaq-chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.cfaq-send-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.cfaq-send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.cfaq-send-button:active {
    transform: scale(0.95);
}

/* ==========================================
   SCROLLBAR STYLING
   ========================================== */

.cfaq-popup-messages::-webkit-scrollbar,
.cfaq-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.cfaq-popup-messages::-webkit-scrollbar-track,
.cfaq-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.cfaq-popup-messages::-webkit-scrollbar-thumb,
.cfaq-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.cfaq-popup-messages::-webkit-scrollbar-thumb:hover,
.cfaq-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ==========================================
   MOBILE RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .cfaq-popup-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        bottom: 90px;
        right: 20px;
        left: 20px;
    }
    
    .cfaq-fullscreen-container {
        margin: 20px;
        height: calc(100vh - 40px);
        min-height: auto;
        border-radius: 12px;
    }
    
    .cfaq-chat-header {
        padding: 20px;
    }
    
    .cfaq-chat-header h3 {
        font-size: 22px;
    }
    
    .cfaq-chat-header p {
        font-size: 14px;
    }
    
    .cfaq-chat-messages,
    .cfaq-popup-messages {
        padding: 16px;
    }
    
    .cfaq-message-content {
        max-width: 85%;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .cfaq-popup-button {
        width: 56px;
        height: 56px;
        bottom: 16px;
        right: 16px;
    }
    
    .cfaq-popup-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 16px;
        left: 16px;
        border-radius: 12px;
    }
    
    .cfaq-fullscreen-container {
        margin: 12px;
        border-radius: 8px;
    }
    
    .cfaq-chat-input {
        font-size: 14px;
        padding: 10px 14px;
    }
    
    .cfaq-send-button {
        width: 40px;
        height: 40px;
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

.cfaq-popup-button:focus,
.cfaq-close-button:focus,
.cfaq-send-button:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

.cfaq-chat-input:focus {
    outline: none;
}

/* Ensure proper contrast for accessibility */
.cfaq-bot-message .cfaq-message-content {
    color: #1a202c;
}

.cfaq-user-message .cfaq-message-content {
    color: #ffffff;
}