/**
 * AI Chatbot Widget Styles
 */

.ai-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Toggle Button */
.ai-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

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

/* Chat Window */
.ai-chatbot-window {
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.ai-chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.ai-chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ai-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Settings Panel */
.ai-chatbot-settings {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-chatbot-settings-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chatbot-settings-label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    min-width: 60px;
}

.ai-chatbot-settings-select,
.ai-chatbot-settings-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.ai-chatbot-settings-select:focus,
.ai-chatbot-settings-input:focus {
    border-color: #667eea;
}

.ai-chatbot-settings-input::placeholder {
    color: #9ca3af;
}

/* Messages */
.ai-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f7f9fc;
}

.ai-chatbot-message {
    display: flex;
    animation: slideIn 0.3s ease-out;
}

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

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

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

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

.ai-chatbot-message-assistant {
    justify-content: flex-start;
}

.ai-chatbot-message-assistant .ai-chatbot-message-content {
    background: white;
    color: #333;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.ai-chatbot-message-system {
    justify-content: center;
}

.ai-chatbot-message-system .ai-chatbot-message-content {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    font-size: 13px;
    max-width: 90%;
}

.ai-chatbot-message-system ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.ai-chatbot-message-system li {
    margin: 4px 0;
}

/* Input Area */
.ai-chatbot-input-container {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 8px;
    border-top: 1px solid #e5e7eb;
    background: white;
}

.ai-chatbot-voice {
    width: 40px;
    height: 40px;
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ai-chatbot-voice:hover {
    background: #f0f4ff;
    transform: scale(1.05);
}

.ai-chatbot-voice:active {
    transform: scale(0.95);
}

.ai-chatbot-voice-active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: #ef4444;
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

.ai-chatbot-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #f8f9ff;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.ai-chatbot-input:focus {
    border-color: #764ba2;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.3);
    background: white;
}

.ai-chatbot-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

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

/* Loading Indicator */
.ai-chatbot-loading {
    position: absolute;
    bottom: 70px;
    left: 16px;
    background: white;
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-chatbot-loading-dots {
    display: flex;
    gap: 4px;
}

.ai-chatbot-loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: bounce 1.4s infinite ease-in-out;
}

.ai-chatbot-loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-chatbot-loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

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

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

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

.ai-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .ai-chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 40px);
        max-height: calc(100vh - 40px);
    }
}

/* Fullscreen Mode */
.ai-chatbot-window-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    z-index: 9999 !important;
}

/* Header Actions */
.ai-chatbot-header-actions {
    display: flex;
    gap: 8px;
}

.ai-chatbot-fullscreen {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ai-chatbot-fullscreen:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Textarea Styles */
textarea.ai-chatbot-input {
    min-height: 44px;
    max-height: 150px;
    height: 44px;
    resize: none;
    overflow-y: hidden;
    overflow-x: hidden;
    line-height: 22px;
    padding: 10px 14px;
    box-sizing: border-box;
    font-family: inherit;
    vertical-align: middle;
    display: block;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Ensure placeholder and text are fully visible */
textarea.ai-chatbot-input::placeholder {
    color: #667eea;
    line-height: 22px;
    font-weight: 500;
    opacity: 0.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* UI Components */
.ai-chatbot-ui-component {
    margin: 12px 0;
}

/* Table Component */
.ai-chatbot-table-wrapper {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 8px 0;
}

.ai-chatbot-table-title {
    font-size: 14px;
    font-weight: 600;
    padding: 12px;
    margin: 0;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
}

.ai-chatbot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ai-chatbot-table thead {
    background: #f9fafb;
}

.ai-chatbot-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.ai-chatbot-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    color: #4b5563;
}

.ai-chatbot-table tbody tr:last-child td {
    border-bottom: none;
}

.ai-chatbot-table tbody tr:hover {
    background: #f9fafb;
}

/* Interactive table styles */
.ai-chatbot-table-interactive tbody tr.ai-chatbot-row-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-chatbot-table-interactive tbody tr.ai-chatbot-row-clickable:hover {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
}

.ai-chatbot-table-interactive tbody tr.ai-chatbot-row-clickable:active {
    background: linear-gradient(135deg, #667eea25 0%, #764ba225 100%);
}

.ai-chatbot-table-interactive tbody tr.ai-chatbot-row-clickable.selected {
    background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
    box-shadow: inset 3px 0 0 #667eea;
}

.ai-chatbot-table-interactive tbody tr.ai-chatbot-row-clickable:focus {
    outline: 2px solid #667eea;
    outline-offset: -2px;
}

/* Card Component */
.ai-chatbot-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 8px 0;
}

.ai-chatbot-card-success {
    border-left: 4px solid #10b981;
}

.ai-chatbot-card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #111827;
}

.ai-chatbot-card-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-chatbot-card-field {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.ai-chatbot-card-field-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    min-width: 120px;
}

.ai-chatbot-card-field-value {
    font-size: 13px;
    color: #111827;
    text-align: right;
    flex: 1;
}

/* List Component */
.ai-chatbot-list-wrapper {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 8px 0;
}

.ai-chatbot-list-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #111827;
}

.ai-chatbot-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-chatbot-list li {
    background: #f3f4f6;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
}

/* Clickable/Interactive list items (for time slots, etc.) */
.ai-chatbot-list li.ai-chatbot-clickable {
    cursor: pointer;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 1px solid #667eea40;
    transition: all 0.2s ease;
    user-select: none;
}

.ai-chatbot-list li.ai-chatbot-clickable:hover {
    background: linear-gradient(135deg, #667eea30 0%, #764ba230 100%);
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
}

.ai-chatbot-list li.ai-chatbot-clickable:active {
    transform: translateY(0);
    box-shadow: none;
}

.ai-chatbot-list li.ai-chatbot-clickable.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}
