/* Marketplace Map Styles */

/* Sidebar panel */
.sidebar-panel {
    width: 380px;
    min-width: 380px;
    background: white;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 20;
}

.sidebar-closed {
    transform: translateX(-100%);
    opacity: 0;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
}

.sidebar-open {
    transform: translateX(0);
    opacity: 1;
}

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Line clamp */
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Map container */
#map {
    width: 100%;
    height: 100%;
}

/* Cluster markers */
.cluster-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #4F46E5;
    color: white;
    font-size: 14px;
    font-weight: 700;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .sidebar-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        min-width: 100%;
        max-height: 70vh;
        border-right: none;
        border-top: 1px solid #e5e7eb;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
        z-index: 25;
    }

    .sidebar-closed {
        transform: translateY(100%);
    }

    .sidebar-open {
        transform: translateY(0);
    }
}

/* ===== Marketplace Inline Chat (mpc-*) ===== */

.mpc-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.mpc-video-avatar {
    text-align: center;
    padding: 8px 0 4px;
}
.mpc-video-avatar video {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto;
    display: block;
    border: 2px solid #e5e7eb;
}

/* Operator status bar */
.mpc-op-bar {
    padding: 6px 10px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f0fdf4;
    border-radius: 8px;
    margin-bottom: 6px;
}
.mpc-op-bar--pending { background: #fefce8; }
.mpc-op-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.mpc-op-dot--online { background: #22c55e; }
.mpc-op-dot--pending { background: #eab308; animation: mpc-pulse 1.5s infinite; }
.mpc-op-avatar {
    width: 20px; height: 20px; border-radius: 50%; object-fit: cover;
}
.mpc-op-label {
    font-size: 11px; color: #6b7280; margin-left: auto;
}

/* Messages area */
.mpc-messages {
    max-height: 350px;
    min-height: 80px;
    overflow-y: auto;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}
.mpc-messages::-webkit-scrollbar { width: 4px; }
.mpc-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* Message row */
.mpc-msg {
    display: flex;
    gap: 6px;
    max-width: 92%;
    animation: mpc-msg-in 0.2s ease-out;
}
.mpc-msg--visitor { flex-direction: row-reverse; align-self: flex-end; }
.mpc-msg--system { align-self: center; max-width: 100%; }

/* Avatar */
.mpc-avatar-wrap {
    width: 24px; min-width: 24px; height: 24px; flex-shrink: 0;
}
.mpc-avatar {
    width: 24px; min-width: 24px; height: 24px; border-radius: 50%; object-fit: cover;
    flex-shrink: 0;
}
.mpc-avatar--default {
    background: #e0e7ff; color: #4F46E5; display: flex; align-items: center;
    justify-content: center; font-size: 10px; font-weight: 700;
}
.mpc-avatar--operator {
    background: #dbeafe; color: #2563eb; display: flex; align-items: center;
    justify-content: center; width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
    overflow: hidden;
}

/* Bubble */
.mpc-bubble {
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.45;
    border-radius: 12px;
    word-break: break-word;
}
.mpc-msg--ai .mpc-bubble {
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}
.mpc-msg--visitor .mpc-bubble {
    background: #4F46E5;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.mpc-msg--operator .mpc-bubble {
    background: #dbeafe;
    color: #1e3a5f;
    border-bottom-left-radius: 4px;
}
.mpc-bubble--system {
    background: transparent !important;
    color: #9ca3af !important;
    font-size: 11px;
    font-style: italic;
    text-align: center;
    padding: 4px 8px;
}

.mpc-bubble a {
    color: inherit;
    text-decoration: underline;
}
.mpc-bubble strong { font-weight: 600; }

/* Message image */
.mpc-msg-image {
    max-width: 200px;
    max-height: 160px;
    border-radius: 8px;
    cursor: pointer;
}

/* Typing indicator */
.mpc-typing {
    display: flex; gap: 4px; padding: 4px 0; align-items: center;
}
.mpc-typing span {
    width: 6px; height: 6px; border-radius: 50%; background: #9ca3af;
    animation: mpc-dots 1.2s infinite;
}
.mpc-typing span:nth-child(2) { animation-delay: 0.2s; }
.mpc-typing span:nth-child(3) { animation-delay: 0.4s; }

/* Suggestions */
.mpc-suggestions {
    display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 0 8px;
}
.mpc-suggestion {
    padding: 5px 10px;
    font-size: 11px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.3;
}
.mpc-suggestion:hover {
    background: #e0e7ff;
    border-color: #c7d2fe;
    color: #4338CA;
}

/* Operator button */
.mpc-op-btn-wrap {
    padding: 4px 0 6px;
}
.mpc-op-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; font-size: 12px; font-weight: 500;
    background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px;
    color: #166534; cursor: pointer; transition: all 0.15s;
}
.mpc-op-btn:hover { background: #dcfce7; }
.mpc-op-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Input */
.mpc-input-wrap {
    display: flex; gap: 6px; padding: 6px 0 2px;
    border-top: 1px solid #f3f4f6;
}
.mpc-input {
    flex: 1; padding: 8px 12px; font-size: 13px;
    border: 1px solid #e5e7eb; border-radius: 10px;
    outline: none; transition: border-color 0.15s;
    background: #fff; color: #1f2937;
}
.mpc-input:focus { border-color: #a5b4fc; }
.mpc-input:disabled { background: #f9fafb; }
.mpc-send {
    width: 34px; height: 34px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: #4F46E5; color: #fff; border: none; border-radius: 10px;
    cursor: pointer; transition: background 0.15s;
}
.mpc-send:hover { background: #4338CA; }
.mpc-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* Footer */
.mpc-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 0 2px; gap: 8px;
}
.mpc-footer a { color: #6366f1; text-decoration: none; }
.mpc-footer a:hover { text-decoration: underline; }

/* Rating widget */
.mpc-rating {
    background: #f9fafb; border-radius: 12px; padding: 12px; text-align: center;
    width: 100%;
}
.mpc-rating-title {
    font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 8px;
}
.mpc-rating-emojis {
    display: flex; justify-content: center; gap: 16px;
}
.mpc-rating-emoji-wrap { text-align: center; }
.mpc-rating-emoji {
    width: 36px; height: 36px; padding: 0; background: none; border: none;
    cursor: pointer; transition: transform 0.15s;
}
.mpc-rating-emoji:hover { transform: scale(1.2); }
.mpc-rating-emoji svg { width: 36px; height: 36px; }
.mpc-rating-label { display: block; font-size: 10px; color: #6b7280; margin-top: 2px; }
.mpc-rating-comment { margin-top: 10px; }
.mpc-rating-textarea {
    width: 100%; padding: 6px 10px; font-size: 12px;
    border: 1px solid #e5e7eb; border-radius: 8px; resize: none;
    outline: none; font-family: inherit;
}
.mpc-rating-textarea:focus { border-color: #a5b4fc; }
.mpc-rating-actions { display: flex; justify-content: center; gap: 8px; margin-top: 6px; }
.mpc-rating-submit {
    padding: 5px 14px; font-size: 12px; font-weight: 500;
    background: #4F46E5; color: #fff; border: none; border-radius: 8px; cursor: pointer;
}
.mpc-rating-submit:hover { background: #4338CA; }
.mpc-rating-skip {
    padding: 5px 14px; font-size: 12px; color: #6b7280;
    background: none; border: none; cursor: pointer;
}
.mpc-rating-skip:hover { color: #374151; }
.mpc-rating-thanks {
    font-size: 12px; color: #22c55e; font-weight: 500;
}

/* Product card */
.mpc-product-card {
    margin: 6px 0; background: #f9fafb; border: 1px solid #e5e7eb;
    border-radius: 10px; padding: 10px; font-size: 12px; color: #374151;
}

/* Animations */
@keyframes mpc-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes mpc-dots {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}
@keyframes mpc-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Custom Google Maps styles */
.gm-style .gm-style-iw-c {
    border-radius: 12px !important;
    padding: 0 !important;
}

.gm-style .gm-style-iw-d {
    overflow: hidden !important;
}

/* Smooth transitions */
[x-cloak] {
    display: none !important;
}
