/* Smart Chat Assistant Styles */

/* Main Chat Widget */
.sca-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    width: 360px;
}

/* Chat Button (Floating) */
.sca-chat-button {
    height: 48px;
    padding: 0 16px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: fixed;
    bottom: 20px;
    right: 20px;
    animation: sca-popup 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 10000; /* below container */
    visibility: visible !important;
    opacity: 1 !important;
}

/* Popup animation */
@keyframes sca-popup {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Pulse animation for attention */
@keyframes sca-pulse {
    0%, 100% {
        box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 24px rgba(102, 126, 234, 0.6), 0 0 0 8px rgba(102, 126, 234, 0.1);
    }
}

.sca-chat-button:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.5);
    animation: sca-pulse 2s infinite;
}

.sca-chat-button:active {
    transform: scale(0.95);
}

.sca-button-icon {
    font-size: 22px;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Label inside floating button */
.sca-button-label {
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

/* Material Symbols baseline */
.material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* Chat Container */
.sca-chat-container {
    display: none !important;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    margin-bottom: 10px;
    height: 520px;
    flex-direction: column;
}

.sca-chat-container.sliding {
    animation: sca-slide-up 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes sca-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.sca-chat-widget.sca-open .sca-chat-container {
    display: flex !important;
}

/* When chat is open, hide the floating button to avoid overlap */
.sca-chat-widget.sca-open .sca-chat-button {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Ensure container appears above any residual button during animations */
.sca-chat-container {
    position: relative;
    z-index: 11000; /* higher than floating button */
}

/* Chat Header */
.sca-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: none; /* hidden by default to avoid overlap */
    justify-content: space-between;
    align-items: center;
}

.sca-chat-widget.sca-open .sca-chat-header {
    display: flex; /* show only when chat is open */
}

.sca-chat-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sca-chat-icon {
    font-size: 24px;
}

.sca-chat-title {
    font-size: 18px;
    font-weight: 600;
}

.sca-chat-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    font-size: 22px;
    line-height: 1;
}

.sca-chat-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages Area */
.sca-chat-messages {
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    flex: 1;
}

/* Custom Scrollbar */
.sca-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.sca-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.sca-chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.sca-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Messages */
.sca-message {
    margin-bottom: 16px;
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sca-message-user {
    justify-content: flex-end;
}

.sca-message-bot {
    justify-content: flex-start;
}

.sca-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
}

.sca-message-user .sca-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.sca-message-bot .sca-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sca-message-content p {
    margin: 0 0 8px 0;
}

.sca-message-content p:last-child {
    margin-bottom: 0;
}

.sca-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.sca-message-content li {
    margin: 4px 0;
}

/* Help List */
.sca-help-list {
    list-style: none;
    padding-left: 0;
    margin: 12px 0;
}

.sca-help-list li {
    padding: 4px 0;
}

/* Typing Indicator */
.sca-typing-indicator .sca-message-content {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.sca-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite;
}

.sca-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.sca-typing-dot: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 Replies */
.sca-quick-replies {
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.sca-quick-replies-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sca-quick-reply-btn {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #495057;
    font-family: inherit;
    white-space: nowrap;
}

.sca-quick-reply-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-1px);
}

.sca-quick-reply-btn:active {
    transform: translateY(0);
}

/* Chat Input Container */
.sca-chat-input-container {
    display: flex;
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    gap: 8px;
}

/* Spell suggestions below input */
.sca-spell-suggestions {
    padding: 6px 20px 10px 20px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sca-suggestion-btn {
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #e0e7ff;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sca-suggestion-btn:hover {
    background: #e0e7ff;
    transform: translateY(-1px);
}

.sca-chat-input {
    flex: 1;
    border: 1px solid #e9ecef;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s ease;
}

.sca-chat-input:focus {
    border-color: #667eea;
}

.sca-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.sca-chat-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.sca-chat-send:active {
    transform: scale(0.95);
}

/* Tablet */
@media (max-width: 1024px) {
    .sca-chat-widget {
        width: 340px;
        bottom: 18px;
        right: 18px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sca-chat-widget {
        width: 320px;
        bottom: 15px;
        right: 15px;
        left: auto;
    }
    
    .sca-chat-container {
        height: 480px;
    }
    
    .sca-chat-messages {
        padding: 16px;
    }
    
    .sca-chat-button {
        height: 46px;
        padding: 0 14px;
        bottom: 15px !important;
        right: 15px !important;
        display: flex !important;
    }
    
    .sca-button-icon {
        font-size: 21px;
        color: #fff;
    }

    .sca-button-label {
        font-size: 13px;
    }
    
    .sca-quick-replies-container {
        flex-direction: column;
    }
    
    .sca-quick-reply-btn {
        width: 100%;
        text-align: center;
    }
    
    .sca-message-content {
        max-width: 85%;
        font-size: 13px;
        padding: 10px 14px;
    }
}

@media (max-width: 480px) {
    .sca-chat-widget {
        bottom: 12px;
        right: 12px;
        left: 12px;
        width: calc(100vw - 24px);
    }
    
    .sca-chat-button {
        height: 44px;
        padding: 0 12px;
        bottom: 12px !important;
        right: 12px !important;
        display: flex !important;
    }
    
    .sca-button-icon {
        font-size: 20px;
    }
    
    .sca-chat-header {
        padding: 14px 16px;
    }
    
    .sca-chat-title {
        font-size: 16px;
    }
    
    .sca-chat-messages {
        padding: 12px;
    }
    
    .sca-chat-input-container {
        padding: 10px 16px;
    }
    
    .sca-quick-replies {
        padding: 10px 16px;
    }

    .sca-chat-container {
        height: 440px;
    }
}

/* Accessibility */
.sca-chat-button:focus,
.sca-chat-toggle:focus,
.sca-chat-send:focus,
.sca-quick-reply-btn:focus,
.sca-chat-input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Avoid square focus box behind floating pill button */
.sca-chat-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.35), 0 4px 16px rgba(102, 126, 234, 0.4);
}

/* Error Messages */
.sca-error-message .sca-message-content {
    background: #fff3cd;
    color: #856404;
    border-left: 3px solid #ffc107;
}

/* Prevent text overflow */
.sca-message-content,
.sca-quick-reply-btn {
    word-break: break-word;
    overflow-wrap: break-word;
}

