UNPKG

hotel-ai-widget

Version:

A customizable hotel chat widget for React and vanilla HTML

796 lines (675 loc) 12.7 kB
/* Position utilities */ .bottom-right { position: fixed; bottom: 1.5rem; /* 6 */ right: 1.5rem; z-index: 50; } .bottom-left { position: fixed; bottom: 1.5rem; left: 1.5rem; z-index: 50; } /* General modal and overlay */ .modal-overlay { position: fixed; inset: 0; z-index: 50; background-color: rgba(0, 0, 0, 0.5); display: flex; padding: 1rem; align-items: center; justify-content: center; } .modal-container { width: 100%; max-width: 112rem; height: 100%; max-height: 90vh; background-color: white; border-radius: 0.5rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); display: flex; flex-direction: column; } /* Header buttons */ .header-button { color: white; padding: 0.5rem; border-radius: 0.375rem; transition: background-color 0.2s; } .header-button:hover { background-color: #2563eb; /* darker blue */ } /* Widget */ .chat-widget { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 50; } .chat-container { width: 24rem; background-color: white; border-radius: 0.5rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); transition: all 0.3s; overflow: hidden; } .chat-container.minimized { height: 3.5rem; } .chat-container.expanded { height: 600px; } /* Header */ .chat-header { display: flex; justify-content: space-between; align-items: center; background-color: #2563eb; color: white; padding: 0.75rem; border-top-left-radius: 0.5rem; border-top-right-radius: 0.5rem; } /* Tabs */ .tab-button { flex: 1; padding: 0.5rem; font-size: 0.75rem; font-weight: 500; display: flex; justify-content: center; align-items: center; gap: 0.25rem; transition: background-color 0.2s, color 0.2s; } .tab-button.active { background-color: #2563eb; color: white; } .tab-button.inactive { background-color: #f3f4f6; color: #374151; } .tab-button.inactive:hover { background-color: #e5e7eb; } /* Icons */ .icon-sm { width: 0.75rem; height: 0.75rem; } .icon-md { width: 1.25rem; height: 1.25rem; } /* Chat section header */ .section-header { background-color: #f9fafb; padding: 0.625rem 1rem; border-bottom: 1px solid #d1d5db; } .section-header h2 { font-weight: 600; color: #111827; } .chat-open-button { width: 3.5rem; /* w-14 */ height: 3.5rem; /* h-14 */ border-radius: 9999px; /* rounded-full */ background-color: #2563eb; /* bg-blue-600 */ color: white; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1); /* shadow-lg */ transition: background-color 0.2s; /* transition-colors duration-200 */ } .chat-open-button:hover { background-color: #1d4ed8; /* hover:bg-blue-700 */ } .chat-open-icon { width: 1.25rem; height: 1.25rem; } /* Widget Container */ .chat-widget-container { position: fixed; z-index: 50; } .chat-widget-container.bottom-right { bottom: 1.5rem; right: 1.5rem; } .chat-widget-container.bottom-left { bottom: 1.5rem; left: 1.5rem; } .chat-widget-main { width: 24rem; background-color: white; border-radius: 0.5rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); transition: all 0.3s ease; height: 37.5rem; } .chat-widget-main.minimized { height: 3.5rem; } /* Widget Header */ .widget-header { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem; background-color: #2563eb; color: white; border-top-left-radius: 0.5rem; border-top-right-radius: 0.5rem; } .widget-header-title { display: flex; align-items: center; gap: 0.5rem; } .widget-header-icon { width: 1rem; height: 1rem; } .widget-header-text { font-size: 0.875rem; font-weight: 600; } .widget-header-actions { display: flex; align-items: center; gap: 0.25rem; } .widget-header-button { color: white; background: none; border: none; padding: 0.25rem; border-radius: 0.25rem; cursor: pointer; transition: background-color 0.2s ease; } .widget-header-button:hover { background-color: #1d4ed8; } .widget-header-button-icon { width: 0.75rem; height: 0.75rem; } /* Widget Tabs */ .widget-tabs { display: flex; border-bottom: 1px solid #d1d5db; } .widget-tab { flex: 1; padding: 0.5rem; font-size: 0.75rem; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 0.25rem; transition: all 0.2s ease; background-color: #f3f4f6; color: #374151; border: none; cursor: pointer; } .widget-tab:hover { background-color: #e5e7eb; } .widget-tab.active { background-color: #2563eb; color: white; } .widget-tab-icon { width: 0.75rem; height: 0.75rem; } /* Widget Content */ .widget-content { height: 32.5rem; display: flex; flex-direction: column; } .widget-chat-container { flex: 1; display: flex; flex-direction: column; overflow-y: auto; } /* Chat Messages */ .chat-messages { display: flex; flex-direction: column; gap: 0.75rem; scroll-behavior: smooth; flex: 1; padding: 1rem 1rem 0.75rem; } .welcome-message { margin-bottom: 1rem; } .welcome-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; } .welcome-content { display: flex; gap: 0.5rem; align-items: flex-start; } .welcome-icon { width: 1rem; height: 1rem; margin-top: 0.125rem; flex-shrink: 0; color: #2563eb; } .welcome-text { font-size: 0.75rem; color: #4b5563; } .user-message-container { display: flex; justify-content: flex-end; margin-bottom: 0.75rem; } .user-message { background-color: #f3f4f6; color: black; padding: 0.5rem 0.75rem; border-radius: 1rem; border-bottom-right-radius: 0.375rem; max-width: 80%; } .user-message-text { font-size: 0.75rem; white-space: pre-wrap; } .status-content { font-size: 0.75rem; color: #4b5563; font-style: italic; margin-bottom: 0.5rem; } .status-content-text { white-space: pre-wrap; } .main-content { font-size: 0.875rem; line-height: 1.6; margin-bottom: 0.75rem; position: relative; } .main-content-text { white-space: pre-wrap; font-size: 0.875rem; } .streaming-indicator { display: flex; gap: 0.25rem; align-items: center; color: #6b7280; margin-bottom: 0.75rem; } .streaming-dot { animation: bounce 1s infinite; font-size: 0.75rem; } .streaming-dot-delay-1 { animation-delay: 0.2s; } .streaming-dot-delay-2 { animation-delay: 0.4s; } @keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-0.25rem); } 60% { transform: translateY(-0.125rem); } } .messages-end { overflow-anchor: none; } /* Place Links */ .place-link { color: #2563eb; text-decoration: underline; cursor: pointer; font-weight: 500; transition: color 0.2s ease; } .place-link:hover { color: #1d4ed8; } /* Markdown Styles */ .markdown-paragraph { margin-bottom: 0.5rem; line-height: 1.6; font-size: 0.875rem; } .markdown-strong { font-weight: 600; } .markdown-em { font-style: italic; } .markdown-code { background-color: #f3f4f6; padding: 0.125rem 0.375rem; border-radius: 0.25rem; font-size: 0.75rem; font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace; } .markdown-pre { background-color: #f3f4f6; padding: 0.75rem; border-radius: 0.5rem; overflow-x: auto; margin: 0.75rem 0; } .markdown-pre-code { font-size: 0.75rem; font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace; } .markdown-ul { list-style-type: disc; padding-left: 1rem; margin: 0.5rem 0; } .markdown-ul > li { margin: 0.25rem 0; } .markdown-ol { list-style-type: decimal; padding-left: 1rem; margin: 0.5rem 0; } .markdown-ol > li { margin: 0.25rem 0; } .markdown-li { line-height: 1.6; font-size: 0.875rem; } .markdown-link { color: #2563eb; text-decoration: underline; font-size: 0.875rem; transition: color 0.2s ease; } .markdown-link:hover { color: #1d4ed8; } .markdown-h1 { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.75rem; margin-top: 1rem; color: #111827; } .markdown-h2 { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; margin-top: 0.75rem; color: #111827; } .markdown-h3 { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.5rem; margin-top: 0.75rem; color: #111827; } .markdown-h4 { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.25rem; margin-top: 0.5rem; color: #111827; } .markdown-h5 { font-size: 0.75rem; font-weight: 600; margin-bottom: 0.25rem; margin-top: 0.5rem; color: #111827; } .markdown-h6 { font-size: 0.75rem; font-weight: 600; margin-bottom: 0.25rem; margin-top: 0.5rem; color: #111827; } .markdown-blockquote { border-left: 4px solid #d1d5db; padding-left: 0.75rem; font-style: italic; margin: 0.75rem 0; color: #374151; font-size: 0.875rem; } .markdown-hr { border-color: #d1d5db; margin: 1rem 0; } .markdown-table-wrapper { overflow-x: auto; margin: 0.75rem 0; } .markdown-table { min-width: 100%; border-collapse: collapse; border: 1px solid #d1d5db; font-size: 0.75rem; } .markdown-thead { background-color: #f9fafb; } .markdown-tr { border-bottom: 1px solid #e5e7eb; } .markdown-tr:hover { background-color: #f9fafb; } .markdown-th { border: 1px solid #d1d5db; padding: 0.5rem 0.75rem; text-align: left; font-weight: 600; color: #111827; background-color: #f9fafb; font-size: 0.75rem; } .markdown-td { border: 1px solid #d1d5db; padding: 0.5rem 0.75rem; font-size: 0.75rem; } /* Modal Styles */ .modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; } .modal-container { width: 90vw; height: 90vh; max-width: 1200px; background-color: white; border-radius: 0.5rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); display: flex; flex-direction: column; overflow: hidden; } .chat-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem; background-color: #2563eb; color: white; } .header-title { display: flex; align-items: center; gap: 1rem; } .header-icon { width: 1.25rem; height: 1.25rem; } .header-text { font-size: 1.125rem; font-weight: 600; } .header-actions { display: flex; align-items: center; gap: 1rem; } .header-button { color: white; background: none; border: none; padding: 0.5rem; border-radius: 0.25rem; cursor: pointer; transition: background-color 0.2s ease; } .header-button:hover { background-color: #1d4ed8; } .header-button-icon { width: 1rem; height: 1rem; } .modal-content { flex: 1; display: flex; overflow: hidden; } .modal-left-panel { width: 50%; display: flex; flex-direction: column; border-right: 1px solid #d1d5db; } .modal-panel-header { background-color: #f9fafb; padding: 0.625rem 1rem; border-bottom: 1px solid #d1d5db; } .modal-panel-title { font-weight: 600; color: #111827; } .modal-chat-messages { flex: 1; overflow-y: auto; } .modal-right-panel { width: 50%; display: flex; flex-direction: column; } .modal-right-panel-header { background-color: #f9fafb; padding: 0.5rem 1rem; border-bottom: 1px solid #d1d5db; display: flex; align-items: center; justify-content: space-between; } .modal-right-panel-tabs { display: flex; align-items: center; gap: 0.5rem; } .modal-right-panel-tab { display: flex; align-items: center; gap: 0.25rem; padding: 0.25rem 0.5rem; border-radius: 0.375rem; font-size: 0.75rem; font-weight: 500; transition: all 0.2s ease; color: #4b5563; background: none; border: none; cursor: pointer; } .modal-right-panel-tab:hover { color: #111827; background-color: #e5e7eb; } .modal-right-panel-tab.active { background-color: #2563eb; color: white; } .modal-right-panel-tab-icon { width: 0.75rem; height: 0.75rem; } /* Dark Theme */ .chat-widget.dark, .chat-widget-container.dark { /* Add dark theme styles if needed */ } /* Responsive Design */ @media (max-width: 768px) { .chat-widget-main { width: 20rem; } .modal-container { width: 95vw; height: 95vh; } .modal-content { flex-direction: column; } .modal-left-panel, .modal-right-panel { width: 100%; } .modal-left-panel { height: 50%; border-right: none; border-bottom: 1px solid #d1d5db; } .modal-right-panel { height: 50%; } }