/* ============================================
   GUIDE MOLDOVA CHAT WIDGET - COMPLETE CSS
   ============================================ */

/* CSS Variables - Brand Colors */
:root {
    --gm-primary: #1a5f3c;
    --gm-primary-dark: #134a2e;
    --gm-primary-light: #2d8a5a;
    --gm-accent: #c9a84c;
    --gm-accent-light: #e0c878;
    --gm-bg: #ffffff;
    --gm-bg-secondary: #f8f9fa;
    --gm-bg-dark: #1a1a2e;
    --gm-text: #2c3e50;
    --gm-text-light: #6c757d;
    --gm-text-muted: #adb5bd;
    --gm-border: #e9ecef;
    --gm-border-light: #f1f3f5;
    --gm-success: #28a745;
    --gm-error: #dc3545;
    --gm-warning: #ffc107;
    --gm-shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --gm-shadow-md: 0 4px 20px rgba(0,0,0,0.12);
    --gm-shadow-lg: 0 8px 40px rgba(0,0,0,0.15);
    --gm-radius-sm: 8px;
    --gm-radius-md: 12px;
    --gm-radius-lg: 16px;
    --gm-radius-xl: 20px;
    --gm-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --gm-font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --gm-font-heading: 'Playfair Display', Georgia, serif;
}

/* Reset for widget only */
.gm-chat-button,
.gm-chat-container,
.gm-welcome-popup,
.gm-modal {
    font-family: var(--gm-font-body);
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

.gm-chat-button *,
.gm-chat-container *,
.gm-welcome-popup *,
.gm-modal * {
    box-sizing: border-box;
}

/* ============================================
   FLOATING CHAT BUTTON
   ============================================ */
.gm-chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    cursor: pointer;
    transition: var(--gm-transition);
}

.gm-chat-button-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--gm-primary) 0%, var(--gm-primary-dark) 100%);
    color: white;
    padding: 14px 22px;
    border-radius: 50px;
    box-shadow: var(--gm-shadow-lg);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.3px;
    transition: var(--gm-transition);
    position: relative;
    z-index: 2;
}

.gm-chat-button-inner svg {
    flex-shrink: 0;
}

.gm-chat-button:hover .gm-chat-button-inner {
    transform: translateY(-2px);
    box-shadow: 0 12px 48px rgba(26, 95, 60, 0.3);
}

.gm-chat-button.active .gm-chat-button-inner {
    background: linear-gradient(135deg, var(--gm-error) 0%, #b02a37 100%);
}

.gm-chat-button-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50px;
    background: var(--gm-primary);
    opacity: 0;
    animation: gm-pulse 2s infinite;
    z-index: 1;
}

@keyframes gm-pulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
    100% { transform: translate(-50%, -50%) scale(1.4); opacity: 0; }
}

/* ============================================
   WELCOME POPUP
   ============================================ */
.gm-welcome-popup {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 340px;
    max-width: calc(100vw - 48px);
    background: var(--gm-bg);
    border-radius: var(--gm-radius-lg);
    box-shadow: var(--gm-shadow-lg);
    z-index: 999998;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: var(--gm-transition);
    overflow: hidden;
    border: 1px solid var(--gm-border);
}

.gm-welcome-popup.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.gm-welcome-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 8px;
}

.gm-welcome-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gm-primary) 0%, var(--gm-primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    overflow: hidden;
}

.gm-welcome-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gm-welcome-popup-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gm-text-light);
    font-size: 22px;
    line-height: 1;
    transition: var(--gm-transition);
}

.gm-welcome-popup-close:hover {
    background: var(--gm-bg-secondary);
    color: var(--gm-text);
}

.gm-welcome-popup-body {
    padding: 0 20px 20px;
}

.gm-welcome-message {
    font-size: 14px;
    color: var(--gm-text);
    line-height: 1.6;
    margin-bottom: 14px;
}

.gm-welcome-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gm-suggestion-chip {
    background: var(--gm-bg-secondary);
    border: 1px solid var(--gm-border);
    color: var(--gm-primary);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--gm-transition);
    font-family: var(--gm-font-body);
}

.gm-suggestion-chip:hover {
    background: var(--gm-primary);
    color: white;
    border-color: var(--gm-primary);
    transform: translateY(-1px);
}

/* ============================================
   CHAT CONTAINER
   ============================================ */
.gm-chat-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 420px;
    max-width: calc(100vw - 48px);
    height: 640px;
    max-height: calc(100vh - 48px);
    background: var(--gm-bg);
    border-radius: var(--gm-radius-xl);
    box-shadow: var(--gm-shadow-lg);
    z-index: 999997;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: var(--gm-transition);
    overflow: hidden;
    border: 1px solid var(--gm-border);
}

.gm-chat-container.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ============================================
   CHAT HEADER
   ============================================ */
.gm-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--gm-primary) 0%, var(--gm-primary-dark) 100%);
    color: white;
    flex-shrink: 0;
}

.gm-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gm-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.3);
}

.gm-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gm-header-info {
    display: flex;
    flex-direction: column;
}

.gm-header-title {
    font-family: var(--gm-font-heading);
    font-size: 17px;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.3px;
}

.gm-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.gm-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: gm-blink 2s infinite;
}

@keyframes gm-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.gm-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Language Selector */
.gm-language-selector {
    position: relative;
}

.gm-lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 6px 10px;
    border-radius: var(--gm-radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--gm-transition);
    font-family: var(--gm-font-body);
}

.gm-lang-btn:hover {
    background: rgba(255,255,255,0.25);
}

.gm-lang-flag {
    font-size: 16px;
}

.gm-lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--gm-bg);
    border-radius: var(--gm-radius-md);
    box-shadow: var(--gm-shadow-lg);
    border: 1px solid var(--gm-border);
    min-width: 160px;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: var(--gm-transition);
    overflow: hidden;
    z-index: 10;
}

.gm-lang-dropdown.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.gm-lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--gm-text);
    cursor: pointer;
    transition: var(--gm-transition);
}

.gm-lang-option:hover {
    background: var(--gm-bg-secondary);
}

.gm-lang-option.active {
    background: var(--gm-bg-secondary);
    color: var(--gm-primary);
    font-weight: 600;
}

.gm-lang-option.active::after {
    content: '✓';
    margin-left: auto;
    font-weight: 700;
    color: var(--gm-primary);
}

.gm-header-minimize {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 34px;
    height: 34px;
    border-radius: var(--gm-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--gm-transition);
    font-family: var(--gm-font-body);
}

.gm-header-minimize:hover {
    background: rgba(255,255,255,0.25);
}

/* ============================================
   CHAT MESSAGES
   ============================================ */
.gm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

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

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

.gm-chat-messages::-webkit-scrollbar-thumb {
    background: var(--gm-border);
    border-radius: 3px;
}

.gm-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--gm-text-muted);
}

/* Message Bubbles */
.gm-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: gm-message-in 0.3s ease-out;
}

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

.gm-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

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

.gm-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
}

.gm-message.assistant .gm-message-avatar {
    background: linear-gradient(135deg, var(--gm-primary) 0%, var(--gm-primary-light) 100%);
    color: white;
}

.gm-message.user .gm-message-avatar {
    background: var(--gm-bg-secondary);
    color: var(--gm-text-light);
    border: 1px solid var(--gm-border);
}

.gm-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gm-message-content {
    padding: 12px 16px;
    border-radius: var(--gm-radius-md);
    font-size: 14px;
    line-height: 1.7;
    word-wrap: break-word;
}

.gm-message.assistant .gm-message-content {
    background: var(--gm-bg-secondary);
    color: var(--gm-text);
    border: 1px solid var(--gm-border);
    border-bottom-left-radius: 4px;
}

.gm-message.user .gm-message-content {
    background: linear-gradient(135deg, var(--gm-primary) 0%, var(--gm-primary-dark) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.gm-message-time {
    font-size: 11px;
    color: var(--gm-text-muted);
    margin-top: 4px;
    text-align: right;
}

.gm-message.user .gm-message-time {
    text-align: left;
}

/* Message Content Styling */
.gm-message-content h1,
.gm-message-content h2,
.gm-message-content h3 {
    font-family: var(--gm-font-heading);
    margin: 12px 0 8px;
    color: inherit;
}

.gm-message-content h1 { font-size: 18px; }
.gm-message-content h2 { font-size: 16px; }
.gm-message-content h3 { font-size: 15px; }

.gm-message-content p {
    margin: 8px 0;
}

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

.gm-message-content li {
    margin: 4px 0;
}

.gm-message-content strong {
    font-weight: 600;
}

.gm-message-content a {
    color: var(--gm-primary-light);
    text-decoration: underline;
}

.gm-message.user .gm-message-content a {
    color: var(--gm-accent-light);
}

.gm-message-content blockquote {
    border-left: 3px solid var(--gm-accent);
    padding-left: 12px;
    margin: 8px 0;
    font-style: italic;
    color: var(--gm-text-light);
}

/* ============================================
   TYPING INDICATOR
   ============================================ */
.gm-typing-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 0 20px 12px;
    animation: gm-message-in 0.3s ease-out;
}

.gm-typing-indicator.show {
    display: flex;
}

.gm-typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--gm-bg-secondary);
    border-radius: var(--gm-radius-md);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--gm-border);
}

.gm-typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--gm-primary);
    border-radius: 50%;
    animation: gm-typing-bounce 1.4s infinite ease-in-out both;
}

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

@keyframes gm-typing-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.gm-typing-text {
    font-size: 12px;
    color: var(--gm-text-muted);
}

/* ============================================
   QUICK REPLIES
   ============================================ */
.gm-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 12px;
    flex-shrink: 0;
}

.gm-quick-btn {
    background: transparent;
    border: 1px solid var(--gm-primary);
    color: var(--gm-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--gm-transition);
    font-family: var(--gm-font-body);
    white-space: nowrap;
}

.gm-quick-btn:hover {
    background: var(--gm-primary);
    color: white;
    transform: translateY(-1px);
}

/* ============================================
   CHAT INPUT
   ============================================ */
.gm-chat-input-area {
    padding: 12px 20px 16px;
    border-top: 1px solid var(--gm-border);
    background: var(--gm-bg);
    flex-shrink: 0;
}

.gm-chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--gm-bg-secondary);
    border: 1px solid var(--gm-border);
    border-radius: var(--gm-radius-lg);
    padding: 10px 14px;
    transition: var(--gm-transition);
}

.gm-chat-input-wrapper:focus-within {
    border-color: var(--gm-primary);
    box-shadow: 0 0 0 3px rgba(26, 95, 60, 0.1);
}

.gm-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--gm-text);
    resize: none;
    max-height: 120px;
    font-family: var(--gm-font-body);
    outline: none;
    line-height: 1.5;
}

.gm-chat-input::placeholder {
    color: var(--gm-text-muted);
}

.gm-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gm-primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--gm-transition);
    flex-shrink: 0;
}

.gm-send-btn:hover {
    background: var(--gm-primary-dark);
    transform: scale(1.05);
}

.gm-send-btn:disabled {
    background: var(--gm-text-muted);
    cursor: not-allowed;
    transform: none;
}

.gm-input-hint {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 11px;
    color: var(--gm-text-muted);
}

.gm-powered-by {
    font-weight: 500;
    color: var(--gm-primary-light);
}

/* ============================================
   MODAL (Email Collection)
   ============================================ */
.gm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.gm-modal.show {
    display: flex;
}

.gm-modal-content {
    background: var(--gm-bg);
    border-radius: var(--gm-radius-xl);
    box-shadow: var(--gm-shadow-lg);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    animation: gm-modal-in 0.3s ease-out;
}

@keyframes gm-modal-in {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.gm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.gm-modal-header h3 {
    font-family: var(--gm-font-heading);
    font-size: 20px;
    font-weight: 600;
    color: var(--gm-text);
    margin: 0;
}

.gm-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gm-bg-secondary);
    border: none;
    color: var(--gm-text-light);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--gm-transition);
    font-family: var(--gm-font-body);
}

.gm-modal-close:hover {
    background: var(--gm-border);
    color: var(--gm-text);
}

.gm-modal-body {
    padding: 16px 24px 24px;
}

.gm-modal-body p {
    color: var(--gm-text-light);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.gm-form-group {
    margin-bottom: 16px;
}

.gm-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gm-text);
    margin-bottom: 6px;
}

.gm-form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gm-border);
    border-radius: var(--gm-radius-sm);
    font-size: 14px;
    font-family: var(--gm-font-body);
    color: var(--gm-text);
    transition: var(--gm-transition);
    outline: none;
}

.gm-form-group input:focus {
    border-color: var(--gm-primary);
    box-shadow: 0 0 0 3px rgba(26, 95, 60, 0.1);
}

.gm-form-group input::placeholder {
    color: var(--gm-text-muted);
}

.gm-error-msg {
    display: block;
    font-size: 12px;
    color: var(--gm-error);
    margin-top: 4px;
    min-height: 16px;
}

.gm-btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--gm-primary) 0%, var(--gm-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--gm-radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--gm-transition);
    font-family: var(--gm-font-body);
    margin-top: 8px;
}

.gm-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--gm-shadow-md);
}

.gm-btn-text {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: var(--gm-text-light);
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: var(--gm-transition);
    font-family: var(--gm-font-body);
    margin-top: 8px;
}

.gm-btn-text:hover {
    color: var(--gm-text);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 480px) {
    .gm-chat-container {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .gm-welcome-popup {
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
    }

    .gm-chat-button {
        bottom: 16px;
        right: 16px;
    }

    .gm-chat-button-text {
        display: none;
    }

    .gm-chat-button-inner {
        padding: 14px;
        border-radius: 50%;
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
.gm-chat-messages {
    scrollbar-width: thin;
    scrollbar-color: var(--gm-border) transparent;
}

/* ============================================
   LOADING STATE
   ============================================ */
.gm-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gm-border);
    border-top-color: var(--gm-primary);
    border-radius: 50%;
    animation: gm-spin 0.8s linear infinite;
}

@keyframes gm-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   ERROR MESSAGE
   ============================================ */
.gm-error-message {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
    padding: 12px 16px;
    border-radius: var(--gm-radius-md);
    font-size: 13px;
    margin: 8px 20px;
}

/* ============================================
   CITATION BADGE
   ============================================ */
.gm-citation {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--gm-accent);
    color: var(--gm-bg-dark);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 8px;
}

.gm-citation svg {
    width: 12px;
    height: 12px;
}
