/* ==========================================================================
   Chatbot AI JUDI — Modern Glassmorphism Styling
   ========================================================================== */

#judi-chatbot-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: 'Open Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Floating Trigger Button */
.judi-trigger-btn {
    position: relative;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #00d2ff 100%);
    border: none;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(30, 60, 114, 0.4), 0 0 0 3px rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.judi-trigger-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 30px rgba(30, 60, 114, 0.5), 0 0 0 5px rgba(0, 210, 255, 0.3);
}

.judi-trigger-btn:active {
    transform: scale(0.95);
}

.judi-trigger-icon {
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.judi-trigger-btn:hover .judi-trigger-icon {
    transform: rotate(12deg);
}

.judi-trigger-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ff3366;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid #ffffff;
    letter-spacing: 0.5px;
    animation: judi-pulse 2s infinite;
}

@keyframes judi-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 51, 102, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(255, 51, 102, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 51, 102, 0); }
}

.judi-trigger-tooltip {
    position: absolute;
    right: 74px;
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.judi-trigger-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-style: solid;
    border-color: transparent transparent transparent #1e293b;
}

.judi-trigger-btn:hover .judi-trigger-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Chat Widget Container */
.judi-chat-container {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 120px);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
    transform: scale(1) translateY(0);
}

.judi-chat-container.judi-hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.85) translateY(20px);
    pointer-events: none;
}

/* Header */
.judi-chat-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.judi-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.judi-avatar-container {
    position: relative;
}

.judi-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #00d2ff;
}

.judi-status-online {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2px solid #1e3c72;
    border-radius: 50%;
}

.judi-bot-name {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.3px;
}

.judi-badge-ver {
    font-size: 10px;
    background: rgba(0, 210, 255, 0.25);
    color: #00d2ff;
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: 600;
}

.judi-bot-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 1px;
}

.judi-header-actions {
    display: flex;
    gap: 6px;
}

.judi-icon-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: rgba(255, 255, 255, 0.85);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.2s ease;
}

.judi-icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* Messages Area */
.judi-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

.judi-chat-messages::-webkit-scrollbar {
    width: 5px;
}
.judi-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Message Bubble Styling */
.judi-msg {
    display: flex;
    gap: 10px;
    max-width: 90%;
    animation: judi-fadeIn 0.3s ease forwards;
}

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

.judi-msg-bot {
    align-self: flex-start;
}

.judi-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.judi-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

.judi-msg-user .judi-msg-avatar {
    background: #475569;
}

.judi-msg-content {
    background: #ffffff;
    padding: 12px 16px;
    border-radius: 16px;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    font-size: 13.5px;
    line-height: 1.55;
    color: #1e293b;
}

.judi-msg-user .judi-msg-content {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ffffff;
    border-radius: 16px;
    border-top-right-radius: 4px;
    border: none;
}

.judi-msg-content p {
    margin: 0 0 8px 0;
}
.judi-msg-content p:last-child {
    margin-bottom: 0;
}

.judi-msg-content a {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 600;
}
.judi-msg-user .judi-msg-content a {
    color: #93c5fd;
}

.judi-msg-content code {
    background: #f1f5f9;
    color: #0f172a;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
}

.judi-msg-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 12px;
}

.judi-msg-content th, .judi-msg-content td {
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    text-align: left;
}

.judi-msg-content th {
    background: #f1f5f9;
    font-weight: 700;
}

/* Quick Suggestion Chips */
.judi-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.judi-chip {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.judi-chip:hover {
    background: #1d4ed8;
    color: #ffffff;
    border-color: #1d4ed8;
    transform: translateY(-1px);
}

/* Feedback Buttons */
.judi-feedback-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #e2e8f0;
    font-size: 11px;
    color: #64748b;
}

.judi-feedback-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.2s ease;
}

.judi-feedback-btn:hover {
    color: #1e293b;
    background: #f1f5f9;
}

.judi-feedback-btn.active-like {
    color: #10b981;
}

.judi-feedback-btn.active-dislike {
    color: #ef4444;
}

/* Typing Indicator */
.judi-typing-indicator {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 0 16px 12px 16px;
    background: #f8fafc;
}

.judi-typing-indicator.judi-hidden {
    display: none;
}

.judi-typing-dots {
    background: #ffffff;
    padding: 10px 16px;
    border-radius: 16px;
    border-top-left-radius: 4px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.judi-typing-dots span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: judi-bounce 1.4s infinite ease-in-out both;
}

.judi-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.judi-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes judi-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Footer / Input Area */
.judi-chat-footer {
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
}

.judi-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    padding: 6px 6px 6px 14px;
    border-radius: 24px;
    border: 1px solid #cbd5e1;
    transition: all 0.2s ease;
}

.judi-input-group:focus-within {
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.judi-input-field {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 13.5px;
    color: #1e293b;
    resize: none;
    max-height: 80px;
    font-family: inherit;
}

.judi-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.judi-send-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: scale(1.05);
}

.judi-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

.judi-footer-note {
    font-size: 10px;
    color: #94a3b8;
    text-align: center;
    margin-top: 6px;
}

.judi-footer-note span {
    font-weight: 600;
    color: #64748b;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #judi-chatbot-wrapper {
        bottom: 16px;
        right: 16px;
    }
    .judi-chat-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        bottom: 0;
    }
}
