/* Grok Chatbot Styles */

/* Floating Chatbot Bubble Container */
.grok-chatbot-floating-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Floating Circle Button */
.grok-chatbot-bubble-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #39688c;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.grok-chatbot-bubble-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.grok-chatbot-bubble-button:active {
    transform: scale(0.95);
}

.grok-chatbot-bubble-button svg {
    width: 24px;
    height: 24px;
    transition: opacity 0.3s ease;
}

/* Notification Dot */
.grok-bubble-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #ff4757;
    border-radius: 50%;
    top: 0;
    right: 0;
    animation: pulse-dot 2s infinite;
    border: 2px solid white;
}

@keyframes pulse-dot {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* Floating Chat Window */
.grok-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.95) translateY(10px);
    transition: all 0.3s ease;
    animation: slideUp 0.3s ease forwards;
    overflow: hidden;
}

.grok-chatbot-window.active {
    display: flex;
    opacity: 1;
    transform: scale(1) translateY(0);
}

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

/* Chat Window Content Styles */
.grok-chatbot-window .grok-chatbot-header {
    background: #39688c;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
}

.grok-chatbot-window .grok-chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.grok-chatbot-close {
    background: transparent;
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.grok-chatbot-close:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

.grok-chatbot-window .grok-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
}

.grok-chatbot-window .grok-chatbot-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.grok-chatbot-window .grok-chatbot-form {
    display: flex;
    gap: 10px;
    width: 100%;
}

.grok-chatbot-window .grok-chatbot-input {
    flex: 1;
    padding: 22px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    color: #000;
}

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

.grok-chatbot-window .grok-chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #39688c;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    flex-shrink: 0;
}

.grok-chatbot-window .grok-chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.grok-chatbot-window .grok-chatbot-send:active {
    transform: scale(0.95);
}

.grok-chatbot-window .grok-chatbot-footer {
    padding: 8px 15px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
    color: #666;
    text-align: center;
}

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

/* Older inline styles (kept for compatibility) */
.grok-chatbot-container {
    background: #39688c;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    margin: 30px 0;
    overflow: hidden;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    height: 500px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.grok-chatbot-header {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.grok-chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.grok-chatbot-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    font-size: 20px;
    line-height: 1;
}

.grok-chatbot-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.grok-chatbot-toggle:active {
    transform: scale(0.95);
}

.grok-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message Styles */
.grok-message {
    display: flex;
    margin-bottom: 8px;
    animation: slideIn 0.3s ease-out;
}

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

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

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

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

.grok-bot-message .message-content {
    background: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

.grok-user-message .message-content {
    background: #39688c;
    color: white;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.grok-typing .message-content {
    background: #f0f0f0;
    color: #666;
    padding: 12px 16px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.grok-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: bounce 1.4s infinite;
}

.grok-typing span:nth-child(1) {
    animation-delay: 0s;
}

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

.grok-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typingAnimation 1.4s infinite;
}

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

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

@keyframes typingAnimation {
    0%, 60%, 100% {
        opacity: 0.5;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* Input Area */
.grok-chatbot-input-area {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.grok-chatbot-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.grok-chatbot-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 10px 15px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    color: #000;
    transition: all 0.3s ease;
}

.grok-chatbot-input:focus {
    color: #000 !important;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.grok-chatbot-input::placeholder {
    color: #999;
}

.grok-chatbot-send {
    background: #39688c;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}

.grok-chatbot-send:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.grok-chatbot-send:active {
    transform: scale(0.95);
}

.grok-chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Footer */
.grok-chatbot-footer {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

/* Collapsed State */
.grok-chatbot-container.collapsed {
    height: auto;
}

.grok-chatbot-container.collapsed .grok-chatbot-messages,
.grok-chatbot-container.collapsed .grok-chatbot-input-area,
.grok-chatbot-container.collapsed .grok-chatbot-footer {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Floating window adjustments for tablet */
    .grok-chatbot-window {
        width: 320px;
        height: 450px;
        bottom: 80px;
        right: 10px;
    }
    
    .grok-chatbot-container {
        max-width: 100%;
        height: 450px;
        border-radius: 12px 12px 0 0;
    }
    
    .message-content {
        max-width: 85%;
        font-size: 13px;
        padding: 10px 12px;
    }
    
    .grok-chatbot-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .grok-chatbot-window .grok-chatbot-header h3 {
        font-size: 15px;
    }
    
    .grok-chatbot-window .grok-chatbot-input {
        font-size: 16px;
        padding: 10px 14px;
    }
    
    .grok-chatbot-window .grok-chatbot-send {
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 480px) {
    /* Mobile responsive styles */
    .grok-chatbot-floating-container {
        bottom: 15px;
        right: 15px;
    }
    
    .grok-chatbot-bubble-button {
        width: 55px;
        height: 55px;
    }
    
    .grok-chatbot-window {
        position: fixed;
        width: calc(100vw - 20px);
        max-width: 100%;
        height: calc(100vh - 100px);
        max-height: 600px;
        bottom: 75px;
        right: 10px;
        left: auto;
        border-radius: 16px;
    }
    
    .grok-chatbot-container {
        height: 400px;
        border-radius: 12px;
    }
    
    .grok-chatbot-messages {
        padding: 15px;
    }
    
    .grok-chatbot-window .grok-chatbot-messages {
        padding: 12px;
    }
    
    .grok-chatbot-input-area {
        padding: 10px 15px;
    }
    
    .grok-chatbot-window .grok-chatbot-input-area {
        padding: 10px 12px;
        gap: 8px;
    }
    
    .message-content {
        max-width: 90%;
        font-size: 13px;
    }
    
    .grok-chatbot-window .grok-chatbot-header {
        padding: 12px 15px;
    }
    
    .grok-chatbot-header h3 {
        font-size: 16px;
    }
    
    .grok-chatbot-window .grok-chatbot-header h3 {
        font-size: 14px;
        font-weight: 600;
    }
    
    .grok-chatbot-window .grok-chatbot-close {
        width: 24px;
        height: 24px;
    }
    
    .grok-chatbot-window .grok-chatbot-close svg {
        width: 16px;
        height: 16px;
    }
    
    .grok-chatbot-window .grok-chatbot-input {
        font-size: 16px;
        padding: 10px 12px;
        border-radius: 18px;
    }
    
    .grok-chatbot-window .grok-chatbot-send {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }
    
    .grok-chatbot-window .grok-chatbot-send svg {
        width: 16px;
        height: 16px;
    }
    
    .grok-chatbot-window .grok-chatbot-footer {
        padding: 8px 12px;
        font-size: 11px;
    }
}

@media (max-width: 360px) {
    /* Extra small devices */
    .grok-chatbot-window {
        width: calc(100vw - 15px);
        height: calc(100vh - 90px);
        bottom: 70px;
        right: 7px;
    }
    
    .grok-chatbot-bubble-button {
        width: 50px;
        height: 50px;
    }
    
    .grok-chatbot-window .grok-chatbot-header h3 {
        font-size: 13px;
    }
    
    .grok-chatbot-window .grok-chatbot-input {
        font-size: 15px;
        padding: 9px 11px;
    }
    
    .grok-chatbot-window .grok-chatbot-send {
        width: 34px;
        height: 34px;
    }
    
    .message-content {
        font-size: 12px;
        padding: 8px 10px;
    }
}

/* Scrollbar Styling */
.grok-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.grok-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.grok-chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.grok-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Error Message */
.message-content.error {
    background: #fee;
    color: #c33;
    border-left: 3px solid #c33;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 8px;
    height: 8px;
    border: 2px solid #667eea;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Print Styles */
@media print {
    .grok-chatbot-container {
        display: none;
    }
}

/* Accessibility */
.grok-chatbot-container *:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .grok-chatbot-messages {
        background: #2c3e50;
    }
    
    .grok-bot-message .message-content {
        background: #34495e;
        color: #ecf0f1;
    }
    
    .grok-chatbot-input {
        background: #34495e;
        border-color: #555;
        color: #ecf0f1;
    }
    
    .grok-chatbot-input::placeholder {
        color: #999;
    }
    
    .grok-chatbot-input-area {
        background: #2c3e50;
        border-top-color: #34495e;
    }
}
