/* Martinez AI Chatbot Styles - Dark Gold Theme */

/* Chatbot container - highest possible z-index, always above Woodmart overlays */
.martinez-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2147483647 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    /* Create stacking context */
    isolation: isolate;
}

/* Ensure all chatbot elements maintain high z-index */
.martinez-chatbot-container * {
    z-index: auto;
}

.martinez-chatbot-window,
.martinez-chatbot-toggle {
    position: relative;
    z-index: 2147483647 !important;
}

/* Input area must be clickable */
.martinez-chatbot-input-area {
    position: relative;
    z-index: 2147483647 !important;
}

.martinez-chatbot-input-area input {
    position: relative;
    z-index: 2147483647 !important;
}



/* Toggle Button - Gold accent */
.martinez-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #C9A962 0%, #A88B4A 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(201, 169, 98, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    color: #1a1a1a;
}

.martinez-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(201, 169, 98, 0.5);
}

.martinez-chatbot-toggle svg {
    width: 28px;
    height: 28px;
}

/* Chat Window - Dark theme */
.martinez-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #1a1a1a;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: martinez-slide-up 0.3s ease;
    border: 1px solid #333;
}

@keyframes martinez-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header - Gold gradient */
.martinez-chatbot-header {
    background: linear-gradient(135deg, #C9A962 0%, #A88B4A 100%);
    color: #1a1a1a;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.martinez-chatbot-avatar {
    width: 36px;
    height: 36px;
    background: rgba(26, 26, 26, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.martinez-chatbot-title {
    font-weight: 600;
    font-size: 16px;
    color: #1a1a1a;
}

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

.martinez-chatbot-new,
.martinez-chatbot-close {
    background: none;
    border: none;
    color: #1a1a1a;
    cursor: pointer;
    padding: 4px;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.martinez-chatbot-new:hover,
.martinez-chatbot-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

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

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

.martinez-chatbot-messages::-webkit-scrollbar-track {
    background: #1a1a1a;
}

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

/* Message Bubbles */
.martinez-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: martinez-message-appear 0.3s ease;
}

@keyframes martinez-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.martinez-chat-message.user {
    align-self: flex-end;
}

.martinez-chat-message.assistant {
    align-self: flex-start;
}

.martinez-chat-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
}

/* User message - Gold */
.martinez-chat-message.user .martinez-chat-bubble {
    background: linear-gradient(135deg, #C9A962 0%, #A88B4A 100%);
    color: #1a1a1a;
    border-bottom-right-radius: 4px;
}

/* Assistant message - Dark gray */
.martinez-chat-message.assistant .martinez-chat-bubble {
    background: #2a2a2a;
    color: #e5e5e5;
    border-bottom-left-radius: 4px;
    border: 1px solid #333;
}

/* Links in messages */
.martinez-chat-bubble a {
    color: inherit;
    text-decoration: underline;
}

.martinez-chat-message.assistant .martinez-chat-bubble a {
    color: #C9A962;
}

/* Product cards in messages */
.martinez-product-card {
    display: flex;
    gap: 12px;
    background: #1a1a1a;
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
    border: 1px solid #333;
}

.martinez-product-card:hover {
    background: #252525;
    border-color: #C9A962;
}

.martinez-product-card img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.martinez-product-info {
    flex: 1;
}

.martinez-product-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    color: #e5e5e5;
}

.martinez-product-price {
    font-size: 14px;
    font-weight: 600;
    color: #C9A962;
}

/* Typing Indicator */
.martinez-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #2a2a2a;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    border: 1px solid #333;
    width: fit-content;
}

.martinez-typing-dot {
    width: 8px;
    height: 8px;
    background: #C9A962;
    border-radius: 50%;
    animation: martinez-typing 1.4s infinite;
}

.martinez-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.martinez-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes martinez-typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Input Area - Dark */
.martinez-chatbot-input-container {
    padding: 16px 20px;
    background: #1a1a1a;
    border-top: 1px solid #333;
    display: flex;
    gap: 12px;
}

.martinez-chatbot-input {
    flex: 1;
    border: 1px solid #444;
    border-radius: 24px;
    padding: 12px 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #2a2a2a;
    color: #e5e5e5;
}

.martinez-chatbot-input::placeholder {
    color: #888;
}

.martinez-chatbot-input:focus {
    border-color: #C9A962;
    box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.2);
}

/* Send button - Gold */
.martinez-chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #C9A962 0%, #A88B4A 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1a1a;
    transition: transform 0.2s, opacity 0.2s;
}

.martinez-chatbot-send:hover {
    transform: scale(1.05);
}

.martinez-chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Markdown rendering */
.martinez-chat-bubble p {
    margin: 0 0 8px 0;
}

.martinez-chat-bubble p:last-child {
    margin-bottom: 0;
}

.martinez-chat-bubble ul,
.martinez-chat-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.martinez-chat-bubble li {
    margin: 4px 0;
}

.martinez-chat-bubble strong {
    font-weight: 600;
    color: #C9A962;
}

.martinez-chat-bubble code {
    background: rgba(201, 169, 98, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .martinez-chatbot-container {
        bottom: 10px;
        right: 10px;
    }
    
    .martinez-chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -10px;
        border-radius: 12px;
    }
    
    .martinez-chatbot-toggle {
        width: 50px;
        height: 50px;
    }
    
    .martinez-chatbot-toggle svg {
        width: 24px;
        height: 24px;
    }
}

/* RTL Support */
[dir="rtl"] .martinez-chatbot-container {
    right: auto;
    left: 20px;
}

[dir="rtl"] .martinez-chatbot-window {
    right: auto;
    left: 0;
}

[dir="rtl"] .martinez-chat-message.user {
    align-self: flex-start;
}

[dir="rtl"] .martinez-chat-message.assistant {
    align-self: flex-end;
}

/* Ticket Form Styles */
.martinez-ticket-form-container {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 20px;
    margin-top: 12px;
    border: 1px solid #C9A962;
    animation: martinez-message-appear 0.3s ease;
}

.martinez-ticket-form-container h4 {
    color: #C9A962;
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
}

.martinez-ticket-form-container p {
    color: #999;
    font-size: 13px;
    margin: 0 0 16px 0;
}

.martinez-ticket-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.martinez-ticket-form input,
.martinez-ticket-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #444;
    border-radius: 8px;
    background: #2a2a2a;
    color: #e5e5e5;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.martinez-ticket-form input::placeholder,
.martinez-ticket-form textarea::placeholder {
    color: #888;
}

.martinez-ticket-form input:focus,
.martinez-ticket-form textarea:focus {
    outline: none;
    border-color: #C9A962;
    box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.2);
}

.martinez-ticket-form textarea {
    min-height: 80px;
    resize: vertical;
}

.martinez-ticket-form button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #C9A962 0%, #A88B4A 100%);
    color: #1a1a1a;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.martinez-ticket-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(201, 169, 98, 0.4);
}

.martinez-ticket-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.martinez-ticket-success {
    color: #4ade80;
    text-align: center;
    padding: 16px;
}

.martinez-ticket-success svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
}

.martinez-ticket-error {
    color: #f87171;
    font-size: 13px;
    margin-top: 8px;
}
