/* Wahana Chatbot Styles - Premium Leather Brand */

#wahana-chatbot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Floating Button */
.chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6B3A1F 0%, #BA7517 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(186, 117, 23, 0.4);
}

.chatbot-button:active {
    transform: scale(0.95);
}

/* Chat Panel */
.chatbot-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 100px);
    background: #FAF6F0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    isolation: isolate;
}

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

/* Header */
.chatbot-header {
    background: #8a4f23;
    color: white;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 228, 190, 0.22);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    background-clip: padding-box;
}

.chatbot-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chatbot-header-logo-wrap {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: #f7f0e6;
    border: 1px solid rgba(26, 15, 7, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(26, 15, 7, 0.14);
    flex-shrink: 0;
}

.chatbot-header-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

.chatbot-header-copy {
    min-width: 0;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.01em;
    font-family: 'Playfair Display', serif;
    line-height: 1.2;
}

.chatbot-header-copy p {
    margin: 2px 0 0;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 238, 214, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-header-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fdf2df;
    background: rgba(23, 10, 2, 0.22);
    border: 1px solid rgba(255, 221, 169, 0.25);
    border-radius: 999px;
    padding: 5px 8px;
}

.chatbot-header-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #9dff9a;
    box-shadow: 0 0 0 3px rgba(157, 255, 154, 0.2);
}

.chatbot-close {
    background: rgba(32, 12, 2, 0.2);
    border: 1px solid rgba(255, 221, 169, 0.3);
    backdrop-filter: blur(2px);
    color: white;
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: background 0.2s ease;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #F7F0E6;
}

.chatbot-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url('../../themes/wahana-theme/src/assets/texture-leather-grain.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.08;
    mix-blend-mode: soft-light;
    pointer-events: none;
    z-index: 0;
    border-radius: 12px;
}

.chatbot-header,
.chatbot-messages,
.chatbot-input-area {
    position: relative;
    z-index: 10;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #BA7517;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #6B3A1F;
}

/* Message Bubbles */
.chatbot-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

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

.chatbot-message-content p {
    margin: 0 0 10px 0;
    line-height: 1.6;
}

.chatbot-message-content p:last-child {
    margin-bottom: 0;
}

.chatbot-message-content h3, 
.chatbot-message-content h4 {
    margin: 15px 0 8px 0;
    color: #1A0F07;
    font-weight: 700;
}

.chatbot-message-content h3 { font-size: 1.1rem; }
.chatbot-message-content h4 { font-size: 1rem; }

.chatbot-message-content ul, 
.chatbot-message-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.chatbot-message-content ul {
    list-style: disc !important;
}

.chatbot-message-content ol {
    list-style: decimal !important;
}

.chatbot-message-content li {
    margin-bottom: 5px;
    line-height: 1.6;
    display: list-item !important;
}

.chatbot-message-content strong {
    font-weight: 700;
    color: inherit;
}

.chatbot-message-content blockquote {
    margin: 10px 0;
    padding: 5px 15px;
    border-left: 3px solid #BA7517;
    background: rgba(186, 117, 23, 0.05);
    font-style: italic;
}

.chatbot-message-content code {
    background: rgba(0,0,0,0.05);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.chatbot-message-user {
    align-self: flex-end;
    background: #6B3A1F;
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-message-assistant {
    align-self: flex-start;
    background: #D4B896;
    color: #1A0F07;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chatbot-loading {
    opacity: 0.7;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 0.4;
    }
}

/* Input Area */
.chatbot-input-area {
    padding: 16px;
    border-top: 1px solid #D4B896;
    display: flex;
    gap: 8px;
    background: #FAF6F0;
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid #D4B896;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: 'DM Sans', sans-serif;
    background: white;
    color: #1A0F07;
}

.chatbot-input:focus {
    border-color: #BA7517;
    box-shadow: 0 0 0 3px rgba(186, 117, 23, 0.12);
}

.chatbot-input::placeholder {
    color: #9ca3af;
}

.chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #6B3A1F;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
}

.chatbot-send:hover {
    background: #BA7517;
}

.chatbot-send:active {
    transform: scale(0.95);
}

.chatbot-send:disabled {
    background: #D4B896;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #wahana-chatbot-widget {
        bottom: 16px;
        right: 16px;
    }
    
    .chatbot-button {
        width: 56px;
        height: 56px;
    }
    
    .chatbot-panel {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        max-height: calc(100vh - 120px);
        bottom: 16px;
        right: 16px;
        border-radius: 12px;
    }

    .chatbot-header {
        padding: 12px;
    }

    .chatbot-header-logo-wrap {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .chatbot-header-logo {
        width: 20px;
        height: 20px;
    }

    .chatbot-header h3 {
        font-size: 16px;
    }

    .chatbot-header-copy p {
        font-size: 10px;
    }

    .chatbot-header-status {
        display: none;
    }
    
    .chatbot-message {
        max-width: 90%;
    }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
    .chatbot-panel {
        width: 360px;
        height: 500px;
    }
}

/* Dark mode disabled - keep Wahana brand colors */
@media (prefers-color-scheme: dark) {
    /* Wahana brand colors stay consistent in dark mode */
}

/* Accessibility */
.chatbot-button:focus,
.chatbot-close:focus,
.chatbot-send:focus,
.chatbot-input:focus {
    outline: 2px solid #BA7517;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    #wahana-chatbot-widget {
        display: none !important;
    }
}
