/* =========================================================================
   SADA Chat Widget CSS
   ========================================================================= */

/* Floating Chat Button Overrides (Bila ada default dari landing-page.css) */
.cs-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    font-size: 24px;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cs-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.cs-button i {
    animation: cs-pulse 2s infinite;
}

@keyframes cs-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.cs-tooltip {
    position: absolute;
    right: 80px;
    background: white;
    color: #1a1a2e;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.cs-button:hover .cs-tooltip {
    opacity: 1;
    visibility: visible;
    right: 75px;
}

/* Chat Widget Container */
.chat-widget-container {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 360px;
    height: 600px;
    max-height: 80vh;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    transform-origin: bottom right;
    transform: scale(0);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease, visibility 0.3s;
}

.chat-widget-container.active {
    transform: scale(1);
    opacity: 1;
    visibility: visible;
}

/* Chat Header */
.chat-widget-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.chat-widget-header .header-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-widget-header .header-info p {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.close-chat {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.close-chat:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Body (Scrollable) */
.chat-widget-body {
    flex-grow: 1;
    padding: 20px;
    background-color: #f8fafc;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Registration Form UI */
.welcome-box {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    text-align: center;
}

.welcome-text {
    font-size: 14px;
    color: #475569;
    margin: 0;
    line-height: 1.5;
}

.form-group-chat {
    margin-bottom: 15px;
}

.form-group-chat input,
.form-group-chat select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
    outline: none;
    background-color: white;
}

.form-group-chat select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
}

.form-group-chat input:focus,
.form-group-chat select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-start-chat {
    width: 100%;
    background: #0f172a;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-start-chat:hover {
    background: #1e293b;
}

/* Messages Area */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 85%;
    display: flex;
    flex-direction: column;
}

.message.guest {
    align-self: flex-end;
}

.message.admin {
    align-self: flex-start;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.message.guest .message-bubble {
    background: #0f172a;
    color: white;
    border-bottom-right-radius: 2px;
}

.message.admin .message-bubble {
    background: white;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.message-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

.message.guest .message-time {
    align-self: flex-end;
}

.system-message {
    align-self: center;
    background: #e2e8f0;
    color: #64748b;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    text-align: center;
}

/* Chat Footer / Input Area */
.chat-widget-footer {
    padding: 15px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.chat-widget-footer form {
    display: flex;
    gap: 10px;
}

.chat-widget-footer input {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    outline: none;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    transition: border-color 0.3s;
}

.chat-widget-footer input:focus {
    border-color: #94a3b8;
}

.btn-send {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #0f172a;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-send:hover {
    background: #1e293b;
}

/* Loading Dots */
.typing-indicator {
    padding: 10px 14px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    align-self: flex-start;
    display: flex;
    gap: 4px;
    align-items: center;
    display: none;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Custom Scrollbar */
.chat-widget-body::-webkit-scrollbar {
    width: 6px;
}

.chat-widget-body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-widget-body::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}
