/* --- styles.css --- */

/* CSS styles remain the same, adding style for action button */
:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #f72585;
    --success-color: #06ffa5;
    --warning-color: #ffbe0b;
    --danger-color: #fb5607;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --message-bg: white;
    --message-text: var(--dark-color);
    --user-message-bg: var(--primary-color);
    --user-message-text: white;
    --border-color: rgba(0, 0, 0, 0.05);
    --input-bg: var(--light-color);
}

[data-theme="dark"] {
    --light-color: #2c3e50;
    --dark-color: #ecf0f1;
    --gray-color: #95a5a6;
    --bg-gradient-start: #2c3e50;
    --bg-gradient-end: #34495e;
    --message-bg: #34495e;
    --message-text: #ecf0f1;
    --user-message-bg: #2980b9;
    --user-message-text: white;
    --border-color: rgba(255, 255, 255, 0.1);
    --input-bg: #34495e;
}

/* --- Base Styles --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    padding: 20px;
    color: var(--dark-color);
    transition: background 0.3s ease;
}

/* --- Single Moving Background --- */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
}

.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('https://images.unsplash.com/photo-1519389950473-47ba0277781c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2070&q=80');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    animation: zoomAnimation 20s infinite alternate;
    transform: scale(1.0);
}

/* Overlay untuk memperbaiki kontras */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.7) 0%, rgba(118, 75, 162, 0.7) 100%);
    z-index: -1;
    animation: gradientShift 8s ease infinite;
}

/* Floating elements untuk efek inovatif */
.floating-element {
    position: fixed;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    z-index: -1;
}

.floating-element:nth-child(1) {
    width: 80px;
    height: 80px;
    top: 10%;
    left: 10%;
    animation: float 15s infinite ease-in-out;
}

.floating-element:nth-child(2) {
    width: 120px;
    height: 120px;
    bottom: 20%;
    right: 15%;
    animation: float 18s infinite ease-in-out reverse;
}

.floating-element:nth-child(3) {
    width: 60px;
    height: 60px;
    top: 70%;
    left: 20%;
    animation: float 20s infinite ease-in-out;
}

.floating-element:nth-child(4) {
    width: 100px;
    height: 100px;
    top: 30%;
    right: 25%;
    animation: float 25s infinite ease-in-out reverse;
}

/* --- Keyframes --- */
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(-20px) rotate(5deg); }
    66% { transform: translateY(10px) rotate(-5deg); }
}
@keyframes zoomAnimation {
    0% { transform: scale(1.0); }
    100% { transform: scale(1.2); }
}
@keyframes gradientShift {
    0% { background: linear-gradient(135deg, rgba(67, 97, 238, 0.7) 0%, rgba(118, 75, 162, 0.7) 100%); }
    50% { background: linear-gradient(135deg, rgba(118, 75, 162, 0.7) 0%, rgba(247, 37, 133, 0.7) 100%); }
    100% { background: linear-gradient(135deg, rgba(67, 97, 238, 0.7) 0%, rgba(118, 75, 162, 0.7) 100%); }
}
@keyframes logoRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes welcomeAnimation {
    0% { transform: scale(0) rotate(0deg); opacity: 0; }
    50% { transform: scale(1.1) rotate(180deg); opacity: 1; }
    100% { transform: scale(1) rotate(360deg); opacity: 1; }
}
@keyframes welcomeTextAnimation {
    0% { opacity: 0; transform: translateY(20px); }
    50% { opacity: 0.5; transform: translateY(0px); }
    100% { opacity: 1; transform: translateY(0px); }
}
@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(20deg); }
    75% { transform: rotate(-20deg); }
}

/* --- Welcome Screen --- */
.welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    background-size: 400% 400%;
    animation: gradientShift 5s ease infinite;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.welcome-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.welcome-logo {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 60px;
    margin-bottom: 30px;
    animation: welcomeAnimation 1.5s ease-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.welcome-title {
    color: white;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 15px;
    text-align: center;
    animation: welcomeTextAnimation 1.5s ease-out 0.3s both;
}

.welcome-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    text-align: center;
    max-width: 80%;
    animation: welcomeTextAnimation 1.5s ease-out 0.6s both;
}

.welcome-loading {
    display: flex;
    margin-top: 40px;
    animation: welcomeTextAnimation 1.5s ease-out 0.9s both;
}

.welcome-loading-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: white;
    margin: 0 5px;
    animation: typing 1.4s infinite;
}

.welcome-loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.welcome-loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* --- Chat Container --- */
.chat-wrapper {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: scale(0.9);
}

.chat-wrapper.visible {
    opacity: 1;
    transform: scale(1);
    animation: fadeIn 0.5s ease-out;
}

[data-theme="dark"] .chat-wrapper {
    background: rgba(44, 62, 80, 0.95);
}

.chat-wrapper:hover {
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.35);
}

/* --- Chat Header --- */
.chat-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.header-info { display: flex; align-items: center; z-index: 1; }
.header-avatar {
    width: 45px; height: 45px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex; justify-content: center; align-items: center;
    margin-right: 15px; font-size: 24px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    animation: pulse 2s infinite;
}
.header-text h3 { font-size: 18px; font-weight: 600; margin-bottom: 3px; }
.header-text p { font-size: 13px; opacity: 0.9; display: flex; align-items: center; }
.status-indicator {
    width: 8px; height: 8px; background-color: #4ade80;
    border-radius: 50%; margin-right: 6px; animation: pulse 2s infinite;
}
.status-indicator.offline {
    background-color: #ef4444;
    animation: none;
}
.header-actions { display: flex; gap: 10px; z-index: 1; }
.header-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.2); border: none; color: white;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; transition: all 0.3s ease; font-size: 16px;
    position: relative;
}
.header-btn:hover { background: rgba(255, 255, 255, 0.3); transform: scale(1.1); }

/* --- Chat Body --- */
.chat-body {
    flex: 1; overflow-y: auto; padding: 20px;
    background-color: var(--light-color);
    display: flex; flex-direction: column; gap: 16px;
}
.chat-body::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-body::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2); border-radius: 3px;
}
[data-theme="dark"] .chat-body::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.2); }

/* --- Messages --- */
.message {
    display: flex; gap: 12px; max-width: 85%;
    animation: slideUp 0.3s ease;
}
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 16px; flex-shrink: 0;
}
.message.bot .message-avatar { background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); color: white; }
.message.user .message-avatar { 
    background: linear-gradient(135deg, var(--success-color), #00d084); 
    color: white; 
    font-size: 14px; /* Disesuaikan untuk inisial */
}
.message-content {
    background-color: var(--message-bg); padding: 12px 16px;
    border-radius: 16px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative; color: var(--message-text);
    word-wrap: break-word;
}
.message.user .message-content {
    background: var(--user-message-bg); color: var(--user-message-text);
}
.message-text { font-size: 14px; line-height: 1.5; margin-bottom: 4px; }
.message-time { font-size: 11px; opacity: 0.7; }

/* Tambahan: Action Button Style */
.action-button-container {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.action-button {
    display: inline-block;
    padding: 8px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.action-button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
}
/* Akhir Tambahan Action Button Style */


/* --- Typing Indicator --- */
.typing-indicator { display: flex; gap: 12px; max-width: 85%; animation: slideUp 0.3s ease; }
.typing-dots { display: flex; gap: 4px; align-items: center; }
.typing-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background-color: var(--gray-color); animation: typing 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* --- Quick Replies --- */
.quick-replies {
    padding: 15px 20px; background-color: var(--message-bg);
    border-top: 1px solid var(--border-color);
    display: flex; flex-wrap: wrap; gap: 8px;
    transition: all 0.5s ease;
}
.quick-replies.hiding {
    animation: fadeOut 0.5s forwards;
}
.quick-reply {
    padding: 8px 16px; background-color: var(--input-bg);
    border: 1px solid var(--border-color); border-radius: 20px;
    font-size: 13px; cursor: pointer; transition: all 0.3s ease; white-space: nowrap;
}
.quick-reply:hover {
    background-color: var(--primary-color); color: white;
    transform: translateY(-2px); box-shadow: 0 4px 8px rgba(67, 97, 238, 0.3);
}

/* --- Input Area --- */
.input-area {
    padding: 15px 20px; 
    background-color: var(--message-bg);
    border-top: 1px solid var(--border-color);
    display: flex; 
    gap: 12px; 
    align-items: center;
}

/* Modifikasi untuk membuat input dan tombol kirim sejajar */
.input-wrapper { 
    flex: 1; 
    position: relative;
    display: flex; 
    align-items: center;
    padding-right: 50px; /* Beri ruang untuk tombol kirim */
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 25px; /* Pindahkan border ke wrapper */
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
     border-color: var(--primary-color);
     box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

/* Modifikasi Input */
.message-input {
    width: 100%; 
    padding: 12px 16px; 
    border: none; /* Hapus border */
    border-radius: 0; 
    font-size: 14px; 
    outline: none; 
    background-color: transparent; /* Jadikan background transparan */
    color: var(--dark-color);
    flex-grow: 1;
}

/* Modifikasi Aksi Input (Emoji) */
.input-actions {
    position: static; 
    transform: none;
    display: flex;
    align-items: center;
    padding-right: 10px; 
    z-index: 5;
}

.input-action-btn {
    width: 30px; height: 30px; border-radius: 50%;
    background: transparent; border: none; color: var(--gray-color);
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; transition: all 0.3s ease;
}
.input-action-btn:hover { color: var(--primary-color); background-color: rgba(67, 97, 238, 0.1); }

/* Modifikasi Tombol Kirim */
.send-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 35px; 
    height: 35px; 
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none; /* Hilangkan shadow */
    z-index: 5;
}

.send-btn:hover { 
    transform: translateY(-50%) scale(1.05); 
    box-shadow: 0 4px 8px rgba(67, 97, 238, 0.3); 
}

.send-btn:active { transform: translateY(-50%) scale(0.95); }


/* --- Emoji Picker --- */
.emoji-picker {
    position: absolute; bottom: 60px; right: 10px;
    width: 300px; max-height: 200px;
    background-color: var(--message-bg); border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 10px; display: none; z-index: 100;
    overflow-y: auto;
}
.emoji-picker.show { display: block; animation: slideUp 0.3s ease; }
.emoji-category { margin-bottom: 10px; }
.emoji-category-title {
    font-size: 12px; font-weight: 600;
    color: var(--gray-color); margin-bottom: 5px;
}
.emoji-list { display: flex; flex-wrap: wrap; gap: 5px; }
.emoji-item {
    width: 30px; height: 30px; display: flex;
    justify-content: center; align-items: center;
    cursor: pointer; border-radius: 4px;
    transition: all 0.3s ease; font-size: 18px;
}
.emoji-item:hover { background-color: var(--input-bg); transform: scale(1.2); }

/* --- Help Overlay --- */
.help-overlay, .analytics-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px);
    display: none; justify-content: center; align-items: center;
    z-index: 1000; padding: 20px;
}
.help-modal, .analytics-content {
    background-color: var(--message-bg); border-radius: 16px;
    width: 100%; max-width: 500px; max-height: 80vh;
    overflow-y: auto; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.3s ease;
}
.help-header, .analytics-header {
    padding: 20px; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
}
.help-header h3, .analytics-header h3 { font-size: 18px; font-weight: 600; color: var(--primary-color); }
.close-btn {
    width: 30px; height: 30px; border-radius: 50%;
    background: transparent; border: none; color: var(--gray-color);
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; transition: all 0.3s ease;
}
.close-btn:hover { background-color: var(--input-bg); color: var(--dark-color); }
.help-content { padding: 20px; }
.help-content p { margin-bottom: 15px; color: var(--gray-color); }
.help-topics { display: grid; gap: 12px; }
.help-topic {
    padding: 15px; background-color: var(--input-bg);
    border-radius: 16px; border-left: 4px solid var(--primary-color);
}
.help-topic h4 { font-size: 16px; margin-bottom: 5px; color: var(--dark-color); }
.help-topic p { font-size: 14px; margin: 0; color: var(--gray-color); }

/* --- Screenshot Button --- */
.screenshot-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
    transition: all 0.3s ease;
    z-index: 100;
}
.screenshot-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(67, 97, 238, 0.4);
}

/* --- Analytics Table --- */
.analytics-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
.analytics-table th,
.analytics-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.analytics-table th {
    font-weight: 600;
    color: var(--primary-color);
}
.analytics-table tr:hover {
    background-color: var(--input-bg);
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    body { padding: 0; }
    .chat-wrapper { max-width: 100%; max-height: 100vh; border-radius: 0; }
    .screenshot-btn { bottom: 80px; }
    .welcome-title { font-size: 24px; }
    .welcome-subtitle { font-size: 16px; }
}