/* Asmara AI Chatbot - Ultra-Clean Theme (Putih Merah Kuning) */
:root {
    --ai-primary: #e11d48;
    --ai-secondary: #f59e0b;
    --ai-bg: rgba(255, 255, 255, 0.95);
    --ai-glass: blur(20px);
    --ai-card-border: rgba(244, 244, 245, 0.95);
    --ai-text-main: #18181b;
    --ai-text-muted: #71717a;
    --ai-bubble-bg: #fff1f2;
    --ai-bubble-text: #18181b;
    --ai-input-bg: #ffffff;
    --ai-input-border: #e4e4e7;
    --ai-footer-bg: #fffbeb;
}

[data-theme='dark'] {
    --ai-primary: #fb7185;
    --ai-secondary: #fbbf24;
    --ai-bg: rgba(24, 24, 27, 0.94);
    --ai-card-border: rgba(255, 255, 255, 0.1);
    --ai-text-main: #fafafa;
    --ai-text-muted: #a1a1aa;
    --ai-bubble-bg: rgba(244, 63, 94, 0.12);
    --ai-bubble-text: #fafafa;
    --ai-input-bg: rgba(24, 24, 27, 0.75);
    --ai-input-border: rgba(255, 255, 255, 0.15);
    --ai-footer-bg: rgba(0, 0, 0, 0.35);
}

.ai-trigger {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-secondary));
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(2, 132, 199, 0.35);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-trigger:hover {
    transform: scale(1.08) rotate(6deg);
    box-shadow: 0 14px 30px rgba(2, 132, 199, 0.45);
}

.ai-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 9px;
    font-weight: 800;
    padding: 3px 6px;
    border-radius: 9999px;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.ai-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--ai-primary);
    opacity: 0.5;
    animation: ai-pulse 2.2s infinite;
    z-index: -1;
}

@keyframes ai-pulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.55); opacity: 0; }
}

.ai-container {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 140px);
    background: var(--ai-bg);
    backdrop-filter: var(--ai-glass);
    -webkit-backdrop-filter: var(--ai-glass);
    border: 1px solid var(--ai-card-border);
    border-radius: 26px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px -10px rgba(15, 23, 42, 0.18);
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    transform-origin: bottom right;
}

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

.ai-header {
    padding: 18px 22px;
    background: linear-gradient(to right, rgba(2, 132, 199, 0.08), rgba(99, 102, 241, 0.08));
    border-bottom: 1px solid var(--ai-card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    color: white;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.ai-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ai-text-main);
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--ai-text-muted);
}

.status-dot {
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: status-pulse 2s infinite;
}

@keyframes status-pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.ai-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-max-btn {
    background: rgba(2, 132, 199, 0.08);
    border: 1px solid rgba(2, 132, 199, 0.2);
    color: var(--ai-text-muted);
    padding: 5px 11px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.ai-max-btn i {
    font-size: 9px;
}

.ai-max-btn.active {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: white;
    border-color: transparent;
    box-shadow: 0 0 14px rgba(236, 72, 153, 0.35);
}

.ai-close-btn {
    background: none;
    border: none;
    color: var(--ai-text-muted);
    font-size: 19px;
    cursor: pointer;
    transition: color 0.2s;
}

.ai-close-btn:hover {
    color: var(--ai-text-main);
}

.ai-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.ai-messages::-webkit-scrollbar {
    width: 5px;
}

.ai-messages::-webkit-scrollbar-thumb {
    background: var(--ai-card-border);
    border-radius: 5px;
}

.message {
    padding: 12px 18px;
    border-radius: 18px;
    max-width: 86%;
    font-size: 14px;
    line-height: 1.55;
    position: relative;
    word-break: break-word;
}

.ai-message {
    background: var(--ai-bubble-bg);
    color: var(--ai-bubble-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
}

.user-message {
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-secondary));
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

.ai-thinking {
    padding: 10px 20px;
    background: rgba(15, 23, 42, 0.04);
    border-top: 1px solid var(--ai-card-border);
    font-size: 12px;
}

[data-theme='dark'] .ai-thinking {
    background: rgba(0, 0, 0, 0.25);
}

.thought-scroll {
    height: 20px;
    overflow: hidden;
    color: #10b981;
    position: relative;
    font-family: 'Courier New', Courier, monospace;
}

#thought-steps {
    display: flex;
    flex-direction: column;
    transition: all 0.4s;
}

.thought-step {
    height: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.9;
}

.thinking-dots {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.thinking-dots span {
    width: 4px;
    height: 4px;
    background: var(--ai-text-muted);
    border-radius: 50%;
    animation: thinking-dot 1.4s infinite ease-in-out;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinking-dot {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.ai-chips {
    padding: 8px 18px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    background: var(--ai-bg);
    border-top: 1px solid var(--ai-card-border);
    scrollbar-width: none;
}

.ai-chips::-webkit-scrollbar {
    display: none;
}

.ai-chip {
    white-space: nowrap;
    background: rgba(225, 29, 72, 0.08);
    border: 1px solid rgba(225, 29, 72, 0.22);
    color: var(--ai-primary);
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ai-chip.chip-highlight {
    background: linear-gradient(135deg, #e11d48, #f59e0b);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.28);
}

.ai-chip:hover {
    background: linear-gradient(135deg, #e11d48, #f59e0b);
    color: #ffffff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(225, 29, 72, 0.3);
}

[data-theme='dark'] .ai-chip {
    background: rgba(244, 63, 94, 0.12);
    border-color: rgba(244, 63, 94, 0.3);
    color: var(--ai-primary);
}

[data-theme='dark'] .ai-chip:hover {
    background: linear-gradient(135deg, #f43f5e, #fbbf24);
    color: #ffffff;
}

.ai-input-area {
    padding: 12px 18px 14px 18px;
    display: flex;
    gap: 10px;
    border-top: 1px solid var(--ai-card-border);
    background: var(--ai-bg);
}

#ai-input {
    flex: 1;
    background: var(--ai-input-bg);
    border: 1px solid var(--ai-input-border);
    border-radius: 12px;
    padding: 11px 15px;
    color: var(--ai-text-main);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#ai-input:focus {
    border-color: var(--ai-primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.ai-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-secondary));
    border: none;
    color: white;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.ai-footer {
    padding: 9px;
    text-align: center;
    font-size: 10px;
    color: var(--ai-text-muted);
    background: var(--ai-footer-bg);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-top: 1px solid var(--ai-card-border);
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

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

.ai-avatar.thinking i {
    animation: brain-throb 1s infinite alternate cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

@keyframes brain-throb {
    0% { transform: scale(1); }
    100% { transform: scale(1.25); }
}

@media (max-width: 480px) {
    .ai-container {
        width: calc(100vw - 28px);
        right: 14px;
        bottom: 85px;
        height: 68vh;
    }
    
    .ai-trigger {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }
}
