Files
demo-mayagen/dashboard-page/styles/main.css
emmanuel.rizky 84c7cbd8ce feat(chat): Integrate chatbot API for dynamic responses
This commit replaces the static, simulated chat functionality with a live integration to a chatbot backend API.

The chat page now sends user messages to a webhook endpoint using the `fetch` API. It implements session management by generating and storing a `sessionId` in `localStorage` to maintain conversation context between requests.

Key changes:
- Implement `async` `sendMessage` function to post to the chatbot API.
- Add session ID generation and persistence.
- Dynamically render text and image responses from the API.
- Remove hardcoded example messages from the HTML.
- Update the virtual assistant's name to "Maya".
- Fix navigation links from the dashboard to the chat page.
2025-07-21 14:44:06 +07:00

543 lines
10 KiB
CSS

/* Reset CSS */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Struktur dasar */
body {
display: flex;
flex-direction: column;
min-height: 100vh;
background: linear-gradient(135deg, #0077b6, #023e8a);
color: #ffffff; /* Warna teks putih */
text-shadow: 0 1px 3px rgba(0,0,0,0.5); /* Bayangan teks */
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
overflow-y: auto; /* Scroll di seluruh halaman */
padding: 0 20px; /* Tambahan padding horizontal */
}
/* Container for responsive design */
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 0 15px;
}
/* Universal Header (works for both desktop and mobile) */
header {
position: sticky;
top: 0;
z-index: 1000;
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(35px);
border-radius: 0 0 20px 20px;
margin: 0;
padding: 20px 25px;
box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
min-height: 110px;
width: 100%;
max-width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
gap: 15px;
}
/* Universal Header Elements */
.mobile-header-user-info {
display: flex;
align-items: center;
gap: 15px;
min-width: 50%; /* Ensure proper wrapping behavior */
}
.mobile-header-title {
font-size: 28px; /* Consistent size for all devices */
font-weight: bold;
line-height: 1.3;
}
.mobile-header-icon svg {
width: 36px; /* Slightly larger for visibility */
height: 36px;
}
.mobile-header-right {
display: flex;
align-items: center;
gap: 15px;
position: relative;
}
.dropdown-menu {
position: absolute;
top: 100%;
right: 0;
background: rgba(255, 255, 255, 0.2);
backdrop-filter: blur(20px);
border-radius: 12px;
padding: 10px;
z-index: 100;
min-width: 200px;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
display: none;
}
.dropdown-menu.visible {
display: block;
}
.dropdown-menu button {
width: 100%;
text-align: left;
padding: 10px 15px;
border-radius: 8px;
}
.dropdown-menu button:hover {
background: rgba(255, 255, 255, 0.3);
}
.mobile-header-menu-button {
background: rgba(255, 255, 255, 0.2);
border: none;
border-radius: 12px;
padding: 12px;
display: flex;
align-items: center;
justify-content: center;
min-height: 54px; /* Generous touch target */
min-width: 54px;
}
.mobile-header-menu-button svg {
width: 36px; /* Consistent icon size */
height: 36px;
}
.mobile-header-avatar {
width: 54px; /* Consistent avatar size */
height: 54px;
border-radius: 50%;
background-size: cover;
background-position: center;
}
/* Konten kiri header */
header .user-info {
display: flex;
align-items: center;
gap: 15px;
}
/* Konten kanan header */
header .header-right {
display: flex;
align-items: center;
gap: 20px; /* Jarak antar ikon/avatar */
}
/* Area konten tanpa scroll sendiri */
main {
flex: 1;
padding: 20px;
height: auto; /* Tinggi disesuaikan dengan konten */
}
/* Kontainer konten */
.layout-content-container {
max-width: 1200px;
margin: 0 auto;
padding: 15px;
}
/* Peningkatan kontras teks */
h1, h2, h3, h4, h5, h6,
p, span, div, td, th, li {
color: #F0F8FF !important; /* AliceBlue, off-white for softer look */
text-shadow: none !important; /* Remove text shadow */
}
/* Kartu dan elemen UI */
.card, .bg-\[\#ededed\] {
background: rgba(255, 255, 255, 0.25);
backdrop-filter: blur(25px);
border: 1px solid rgba(255, 255, 255, 0.4);
border-radius: 16px;
margin: 15px 0;
padding: 20px;
color: #ffffff;
}
/* Tombol */
button {
background: rgba(0, 150, 199, 0.7);
border: 1px solid rgba(255, 255, 255, 0.4);
backdrop-filter: blur(12px);
border-radius: 12px;
transition: all 0.3s ease;
color: #000 !important;
font-weight: bold;
padding: 10px 20px;
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 150, 199, 0.4);
}
/* Tabel */
table {
background: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(10px);
border-radius: 15px;
overflow: hidden;
width: 100%;
table-layout: fixed; /* Ensure proportional columns */
}
th, td {
padding: 12px 15px;
color: #F0F8FF;
}
/* Proportional Columns */
th:nth-child(1), td:nth-child(1) { width: 50%; }
th:nth-child(2), td:nth-child(2) { width: 20%; }
th:nth-child(3), td:nth-child(3) { width: 30%; }
/* Floating circles background */
.floating-circles {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
z-index: -1;
}
.floating-circles li {
position: absolute;
display: block;
list-style: none;
width: 20px;
height: 20px;
background: rgba(72, 202, 228, 0.5);
animation: floating 25s linear infinite;
bottom: -150px;
border-radius: 50%;
z-index: 1;
animation-fill-mode: both;
}
/* Floating animation */
@keyframes floating {
0% {
transform: translate(0, 0) rotate(0deg);
opacity: 0.7;
}
25% {
transform: translate(-50px, -250px) rotate(90deg);
opacity: 0.5;
}
50% {
transform: translate(50px, -500px) rotate(180deg);
opacity: 0.3;
}
75% {
transform: translate(-30px, -750px) rotate(270deg);
opacity: 0.5;
}
100% {
transform: translate(0, -1000px) rotate(360deg);
opacity: 0;
}
}
/* Responsivitas */
@media (max-width: 768px) {
/* Show mobile elements, hide desktop nav */
.mobile-header-user-info,
.mobile-header-right {
display: flex;
}
.desktop-nav {
display: none;
}
/* Stack cards vertically on mobile */
#stat-cards, #secondary-stats {
grid-template-columns: 1fr;
}
/* Adjust header layout for mobile */
header {
flex-direction: column;
align-items: flex-start;
padding: 15px;
}
.mobile-header-right {
align-self: flex-end;
margin-top: -50px;
}
body {
padding: 0 10px;
}
/* Stat Cards */
#stat-cards, #secondary-stats {
flex-direction: column;
gap: 15px;
}
main {
padding: 10px;
height: calc(100vh - 120px);
}
.layout-content-container {
padding: 10px;
}
.card, .bg-\[\#ededed\] {
padding: 15px;
margin: 10px 0;
}
button {
padding: 8px 15px;
font-size: 14px;
}
}
@media (min-width: 769px) {
/* Adjust header layout for desktop */
header {
padding: 15px 25px;
}
.mobile-header-user-info {
display: flex;
align-items: center;
}
.mobile-header-right {
display: flex;
}
}
/* Definitive Vertical Layout */
.controls-container,
.card-container {
display: block;
}
/* Responsive Layout for Cards */
#stat-cards, #secondary-stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
}
/* Ensure cards within the container stack vertically */
.card-container > div {
margin-bottom: 20px; /* Add space between vertical cards */
}
/* Force dark text in knowledge table for readability */
.knowledge-table,
.knowledge-table * {
color: #333333 !important;
}
/* Style the top buttons container */
.controls-inner-container {
display: flex;
justify-content: space-between;
gap: 20px;
}
/* Definitive Compact Bar Chart Styling */
.compact-bar-chart {
display: grid;
grid-template-columns: auto 1fr; /* Label and bar */
gap: 0.5rem 1rem; /* Vertical and horizontal gap */
align-items: center;
padding: 1rem 0;
}
.bar-wrapper {
background-color: rgba(0, 0, 0, 0.1);
border-radius: 4px;
height: 8px; /* Wrapper height */
}
.bar {
background-color: #ededed;
height: 100%;
border-radius: 4px;
}
/* RAG Section Styling */
.rag-section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}
.upload-button {
background-color: #0077b6;
color: white !important;
}
.status-active {
color: #28a745 !important; /* Green */
font-weight: bold;
}
.status-inactive {
color: #dc3545 !important; /* Red */
}
.action-buttons {
display: flex;
gap: 10px;
}
.view-button, .delete-button {
padding: 2px 10px; /* Shorter buttons */
font-size: 12px;
min-width: 60px;
}
/* Clean RAG Section Styling */
.knowledge-table {
width: 100%;
border-collapse: collapse;
background: #FFFFFF; /* Solid white background */
border-radius: 15px;
overflow: hidden;
box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
}
.knowledge-table th, .knowledge-table td {
padding: 12px 15px;
text-align: left;
color: #333333; /* Dark text for contrast */
}
.table-header-row th {
background: #f5f5f5;
padding: 0;
}
.knowledge-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
}
.knowledge-header h2 {
font-size: 22px;
font-weight: bold;
color: #333333;
}
.upload-button {
background: #0077b6;
color: white;
border: none;
border-radius: 12px;
padding: 10px 20px;
font-weight: bold;
cursor: pointer;
}
.knowledge-table th {
background: #f0f0f0;
font-weight: bold;
color: #333333;
}
.knowledge-table tr {
border-bottom: 1px solid #e0e0e0;
}
.knowledge-table tr:last-child {
border-bottom: none;
}
.rag-table tr {
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.rag-table tr:last-child {
border-bottom: none;
}
/* Enhanced status badges */
.status-badge {
padding: 4px 10px;
border-radius: 12px;
font-size: 12px;
font-weight: bold;
display: inline-block;
text-align: center;
}
.status-active {
background-color: rgba(40, 167, 69, 0.2);
color: #28a745 !important;
}
.status-inactive {
background-color: rgba(220, 53, 69, 0.2);
color: #dc3545 !important;
}
.action-buttons {
display: flex;
gap: 10px;
}
.view-button, .delete-button {
padding: 8px 16px;
font-size: 13px;
min-width: 80px;
border: none;
border-radius: 8px;
font-weight: bold;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
gap: 6px;
transition: all 0.2s ease;
}
.view-button:hover, .delete-button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.view-button {
background-color: #007bff;
color: white;
}
.delete-button {
background-color: #dc3545;
color: white;
}