/* Chatbot CSS - Custom styling for the chat interface */

/* Modern Chatbot Styles */
:root {
    --pushkah-primary: #45c1c1;
    --pushkah-primary-hover: #3ba8a8;
    --pushkah-secondary: #64748b;
    --pushkah-success: #10b981;
    --pushkah-warning: #f59e0b;
    --pushkah-danger: #ef4444;
    --pushkah-bg: #f8fafc;
    --pushkah-card: #ffffff;
    --pushkah-border: #e2e8f0;
    --pushkah-text: #1e293b;
    --pushkah-text-light: #64748b;
    --pushkah-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --pushkah-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Chat Icon */
.chat-icon {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--pushkah-primary), #45c1c1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--pushkah-shadow-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    border: none;
    animation: pulse 2s infinite;
}

.chat-icon:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 25px 60px -12px rgba(69, 193, 193, 0.4);
}

.chat-icon.drag-over {
    transform: scale(1.1);
    background: linear-gradient(135deg, var(--pushkah-success), #059669);
    box-shadow: 0 25px 60px -12px rgba(16, 185, 129, 0.4);
}

.chat-icon.drag-over::after {
    content: 'Drop files here to upload';
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--pushkah-success);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1060;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 420px;
    height: 520px;
    background: var(--pushkah-card);
    border-radius: 20px;
    box-shadow: var(--pushkah-shadow-lg);
    display: none;
    flex-direction: column;
    z-index: 1050;
    overflow: hidden;
    border: 1px solid var(--pushkah-border);
    animation: slideInUp 0.3s ease-out;
    max-width: calc(100vw - 64px);
    box-sizing: border-box;
}

.chat-window.minimized {
    height: 72px;
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInUp {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideInDown {
    from { transform: translateY(-100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--pushkah-primary), #45c1c1);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
    position: relative;
    overflow: visible !important;
    min-height: 60px;
}

.chat-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0;
    position: relative;
    z-index: 1;
}

.chat-controls {
    display: flex !important;
    gap: 8px;
    position: relative;
    z-index: 10 !important;
    align-items: center;
    visibility: visible !important;
    opacity: 1 !important;
}

.chat-btn {
    background: rgba(255, 255, 255, 0.3) !important;
    border: 2px solid rgba(255, 255, 255, 0.4) !important;
    color: white !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    backdrop-filter: blur(10px);
    font-size: 14px !important;
    font-weight: 600 !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 15 !important;
}

.chat-btn:hover {
    background: rgba(255, 255, 255, 0.5) !important;
    transform: scale(1.05) !important;
    border-color: rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

.chat-btn i,
.chat-btn svg {
    color: white !important;
    font-size: 14px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 16 !important;
}

.chat-btn svg {
    width: 16px !important;
    height: 16px !important;
}

.chat-btn svg path {
    stroke: white !important;
    stroke-width: 2 !important;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 12px 20px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--pushkah-bg);
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 360px;
    scroll-behavior: smooth;
    max-width: 100%;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--pushkah-border);
    border-radius: 3px;
}

/* Message Styles */
.message {
    display: flex;
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.message.user {
    justify-content: flex-end;
}

.message.bot {
    justify-content: flex-start;
}

.message-content {
    max-width: 85%;
    padding: 16px 20px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--pushkah-primary), #45c1c1);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 12px rgba(69, 193, 193, 0.3);
}

.message.bot .message-content {
    background: var(--pushkah-card);
    color: var(--pushkah-text);
    border-bottom-left-radius: 6px;
    border: 1px solid var(--pushkah-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* System Message Styles */
.message.system {
    justify-content: flex-start;
}

.message.system .message-content {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    color: var(--pushkah-text);
    border-bottom-left-radius: 6px;
    border: 2px solid var(--pushkah-primary);
    box-shadow: 0 4px 16px rgba(69, 193, 193, 0.15);
    font-weight: 500;
}

.message.system .message-content::before {
    content: "🤖";
    margin-right: 8px;
    font-size: 16px;
}

.message.system .message-time {
    color: var(--pushkah-primary);
    font-weight: 600;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 6px;
    display: block;
    font-weight: 500;
}

.message.user .message-time {
    opacity: 0.8;
}

/* Chat Input Area */
.chat-input-area {
    padding: 12px 20px;
    border-top: 1px solid var(--pushkah-border);
    background: var(--pushkah-card);
    border-radius: 0 0 20px 20px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.chat-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 0;
}

.chat-input {
    flex: 1;
    border: 2px solid var(--pushkah-border);
    border-radius: 25px;
    padding: 10px 20px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    background: var(--pushkah-bg);
}

.chat-input:focus {
    border-color: var(--pushkah-primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(69, 193, 193, 0.1);
}

.chat-input:focus::placeholder {
    color: var(--pushkah-primary);
    opacity: 0.8;
}

/* Attachment Button - Styled specifically for the chat */
.chat-input-group .chat-btn#uploadBtn {
    background: transparent !important;
    color: var(--pushkah-secondary) !important;
    border-radius: 8px !important;
    width: 40px !important;
    height: 40px !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    border: 2px solid var(--pushkah-border) !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
    font-size: 16px !important;
    line-height: 1 !important;
}

.chat-input-group .chat-btn#uploadBtn:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    background: var(--pushkah-bg) !important;
    border-color: var(--pushkah-primary) !important;
    color: var(--pushkah-primary) !important;
}

.chat-input-group .chat-btn#uploadBtn:active {
    transform: scale(0.95) !important;
}

/* Remove the tooltip hint for attachment button */
.chat-input-group .chat-btn#uploadBtn::after {
    display: none !important;
}

/* Send Button */
.chat-send-btn {
    background: linear-gradient(135deg, var(--pushkah-primary), #45c1c1);
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(69, 193, 193, 0.2);
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(69, 193, 193, 0.3);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chat-send-btn svg {
    color: white;
    width: 16px;
    height: 16px;
}

/* File Upload Info - Hidden */
.file-upload-info {
    display: none !important;
}

.file-upload-info small {
    display: none !important;
}

.file-upload-info i {
    display: none !important;
}

/* File Message Styles */
.file-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 5px 0;
    max-width: 100%;
    overflow: hidden;
}

.file-preview {
    flex-shrink: 0;
    max-width: 100%;
}

.file-thumbnail {
    width: 200px !important;
    height: auto !important;
    border-radius: 8px;
    cursor: pointer !important;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    object-fit: cover;
    display: block;
}

.file-thumbnail:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.file-icon {
    width: 40px;
    height: 40px;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #6c757d;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.file-info strong {
    display: block;
    margin-bottom: 2px;
    color: #333;
    font-size: 14px;
    word-break: break-word;
}

.file-info small {
    color: #6c757d;
    font-size: 12px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    background: var(--pushkah-card);
    border-radius: 20px;
    border-bottom-left-radius: 6px;
    max-width: 100px;
    border: 1px solid var(--pushkah-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--pushkah-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-12px); }
}

/* Drag and Drop Styles */
.chat-window.drag-over {
    border: 3px dashed var(--pushkah-primary);
    background-color: rgba(37, 99, 235, 0.05);
    transform: scale(1.02);
}

.drag-over .chat-header {
    background: linear-gradient(135deg, var(--pushkah-primary), #45c1c1);
}

/* Responsive Design */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 32px);
        right: 16px;
        left: 16px;
        height: 60vh;
        max-width: none;
    }
    
    .chat-icon {
        right: 16px;
        bottom: 16px;
    }
    
    .file-thumbnail {
        width: 150px;
        height: auto;
    }
    
    .message-content {
        max-width: 90%;
        padding: 12px 16px;
    }
    
    .chat-input-group {
        gap: 8px;
    }
    
    .chat-input-group .chat-btn#uploadBtn,
    .chat-send-btn {
        width: 36px !important;
        height: 36px !important;
    }
    
    .chat-input-area {
        padding: 10px 16px;
    }
    
    .chat-messages {
        padding: 10px 16px;
        max-height: 300px;
    }
    
    .chat-header {
        padding: 10px 16px;
    }
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--pushkah-danger);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 20px;
    color: var(--pushkah-text-light);
}

.welcome-message .welcome-icon {
    font-size: 48px;
    color: var(--pushkah-primary);
    margin-bottom: 16px;
}

.welcome-message h4 {
    color: var(--pushkah-text);
    margin-bottom: 8px;
}

.welcome-message p {
    margin: 0;
    line-height: 1.6;
}

/* Status Indicator */
.chat-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pushkah-success);
    animation: statusPulse 2s infinite;
}

.status-indicator.waiting { background: var(--pushkah-warning); }
.status-indicator.connected { background: var(--pushkah-success); }

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Chat Closed Message */
.chat-closed-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--pushkah-text);
    background: var(--pushkah-card);
    border-radius: 12px;
    margin: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chat-closed-message .closed-icon {
    font-size: 48px;
    color: var(--pushkah-secondary);
    margin-bottom: 20px;
}

.chat-closed-message h4 {
    color: var(--pushkah-text);
    margin-bottom: 12px;
    font-size: 20px;
    font-weight: 600;
}

.chat-closed-message p {
    color: var(--pushkah-text-light);
    margin-bottom: 24px;
    line-height: 1.6;
    font-size: 14px;
}

.start-new-chat-btn {
    background: white;
    border: 2px solid var(--pushkah-border);
    color: var(--pushkah-text);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.start-new-chat-btn:hover {
    background: var(--pushkah-bg);
    border-color: var(--pushkah-primary);
    color: var(--pushkah-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.start-new-chat-btn:active {
    transform: translateY(0);
}

/* Visitor Registration Form */
.visitor-registration {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    max-height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.registration-header {
    text-align: center;
    margin-bottom: 20px;
}

.registration-header h5 {
    color: var(--pushkah-primary);
    margin-bottom: 8px;
    font-weight: 600;
}

.registration-header p {
    color: #6c757d;
    margin: 0;
    font-size: 14px;
}

.registration-header small {
    color: #adb5bd;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

.registration-form {
    max-width: 300px;
    margin: 0 auto;
}

.registration-form .form-group {
    margin-bottom: 15px;
}

.registration-form label {
    display: block;
    margin-bottom: 5px;
    color: #495057;
    font-weight: 500;
    font-size: 14px;
}

.registration-form .form-control {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.registration-form .form-control:focus {
    outline: none;
    border-color: var(--pushkah-primary);
    box-shadow: 0 0 0 3px rgba(69, 193, 193, 0.1);
}

.registration-form .btn {
    width: 100%;
    padding: 12px;
    background: var(--pushkah-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: auto;
    flex-shrink: 0;
}

.registration-form .btn:hover {
    background: var(--pushkah-primary-hover);
}

.registration-form .btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.registration-form .btn-outline-secondary {
    background: transparent;
    border: 1px solid #6c757d;
    color: #6c757d;
}

.registration-form .btn-outline-secondary:hover {
    background: #6c757d;
    color: white;
}

/* Hide chat input area when registration is shown */
.visitor-registration:not([style*="display: none"]) ~ .chat-input-area {
    display: none;
}
