#pac-chatbot-wrapper {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
}
#pac-chatbot-wrapper * { box-sizing: border-box; }

/* Display Modes */
.pac-floating {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
}

.pac-inline {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: flex-start;
    margin: 20px 0;
}

#pac-chatbot-toggle {
    width: var(--pac-icon-size);
    height: var(--pac-icon-size);
    background: var(--pac-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#pac-chatbot-toggle svg { width: 50%; height: 50%; }
#pac-chatbot-toggle:hover { transform: scale(1.05); box-shadow: 0 6px 20px rgba(0,0,0,0.25); }

#pac-chatbot-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-height: calc(100vh - 40px);
}

.pac-floating #pac-chatbot-container {
    position: absolute;
    bottom: calc(var(--pac-icon-size) + 16px);
    right: 0;
    transform-origin: bottom right;
}

.pac-floating #pac-chatbot-container.pac-hidden {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

/* Common Layout Elements */
#pac-chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    flex-shrink: 0;
}
.pac-header-info { display: flex; align-items: center; gap: 16px; }
.pac-header-info-text { display: flex; flex-direction: column; }
.pac-header-info-text strong { font-size: 16px; font-weight: bold; line-height: 1.2; }
.pac-header-info-text span { font-size: 12px; margin-top: 4px; }
#pac-chatbot-close { background: transparent; border: none; cursor: pointer; padding: 4px; transition: opacity 0.2s, color 0.2s; outline: none; }

#pac-chatbot-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}
.pac-message { display: flex; max-width: 85%; }
.pac-message.pac-bot { align-self: flex-start; }
.pac-message.pac-user { align-self: flex-end; }
.pac-bubble { padding: 12px 16px; font-size: 14px; line-height: 1.7; word-wrap: break-word; }
.pac-bubble p { margin: 0 0 8px 0; }
.pac-bubble p:last-child { margin: 0; }

#pac-chatbot-input-area { padding: 20px 24px; flex-shrink: 0; }
.pac-input-wrapper { position: relative; display: flex; align-items: center; }
#pac-chatbot-input { width: 100%; outline: none; font-family: inherit; font-size: 14px; transition: border-color 0.2s; }
#pac-chatbot-send { position: absolute; left: 8px; width: 36px; height: 36px; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background-color 0.2s, opacity 0.2s; outline: none; }

/* ---------------- IMMERSIVE THEME ---------------- */
.pac-theme-immersive #pac-chatbot-container {
    background: rgba(22, 23, 29, 0.85); 
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    color: white;
}
.pac-theme-immersive #pac-chatbot-toggle { background: linear-gradient(to left, var(--pac-primary), #4f46e5); }
.pac-theme-immersive #pac-chatbot-header { background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent); border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.pac-theme-immersive .pac-header-info-text span { color: #4ade80; }
.pac-theme-immersive #pac-chatbot-close { color: rgba(255, 255, 255, 0.6); }
.pac-theme-immersive #pac-chatbot-close:hover { color: white; }
.pac-theme-immersive .pac-avatar-wrapper { position: relative; }
.pac-theme-immersive .pac-avatar-gradient { width: 46px; height: 46px; border-radius: 16px; background: linear-gradient(to top right, var(--pac-primary), #9333ea); padding: 2px; }
.pac-theme-immersive .pac-avatar-inner { width: 100%; height: 100%; border-radius: 14px; background-color: #16171d; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.pac-theme-immersive .pac-online-dot { position: absolute; bottom: -4px; right: -4px; width: 14px; height: 14px; background-color: #22c55e; border: 2px solid #16171d; border-radius: 50%; }

.pac-theme-immersive .pac-bot .pac-bubble { background: rgba(255, 255, 255, 0.05); color: white; border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 16px 4px 16px 16px; }
.pac-theme-immersive .pac-user .pac-bubble { background: var(--pac-primary); color: white; border-radius: 4px 16px 16px 16px; box-shadow: 0 8px 15px -3px rgba(0, 0, 0, 0.2); }

.pac-theme-immersive #pac-chatbot-input-area { background: linear-gradient(to top, rgba(255, 255, 255, 0.05), transparent); }
.pac-theme-immersive #pac-chatbot-input { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); color: white; border-radius: 20px; padding: 16px 16px 16px 52px; }
.pac-theme-immersive #pac-chatbot-input::placeholder { color: rgba(255, 255, 255, 0.4); }
.pac-theme-immersive #pac-chatbot-input:focus { border-color: rgba(255, 255, 255, 0.3); }
.pac-theme-immersive #pac-chatbot-send { background: var(--pac-primary); color: white; border-radius: 14px; width: 38px; height: 38px; left: 8px;}
.pac-theme-immersive #pac-chatbot-send:hover { opacity: 0.9; }

/* ---------------- LIGHT MODERN THEME ---------------- */
.pac-theme-light #pac-chatbot-container {
    background: var(--pac-bg, #ffffff);
    border: 1px solid #e5e7eb;
    border-radius: 24px; box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
    color: #111827;
}
.pac-theme-light #pac-chatbot-header { background: var(--pac-primary); color: white; border-radius: 24px 24px 0 0; }
.pac-theme-light .pac-header-info-text span { color: rgba(255,255,255,0.8); }
.pac-theme-light #pac-chatbot-close { color: white; opacity: 0.8; }
.pac-theme-light #pac-chatbot-close:hover { opacity: 1; }
.pac-theme-light .pac-avatar-simple { width: 44px; height: 44px; background: rgba(255,255,255,0.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; }
.pac-theme-light .pac-avatar-simple svg { width: 22px; height: 22px; color: white; }
.pac-theme-light .pac-online-dot-simple { position: absolute; bottom: 0; right: 0; width: 12px; height: 12px; background-color: #22c55e; border: 2px solid var(--pac-primary); border-radius: 50%; }

.pac-theme-light .pac-bot .pac-bubble { background: #f3f4f6; color: #1f2937; border-radius: 16px 4px 16px 16px; border: 1px solid #e5e7eb; }
.pac-theme-light .pac-user .pac-bubble { background: var(--pac-primary); color: white; border-radius: 4px 16px 16px 16px; }

.pac-theme-light #pac-chatbot-input-area { border-top: 1px solid #f3f4f6; }
.pac-theme-light #pac-chatbot-input { background: #f9fafb; border: 1px solid #e5e7eb; color: #111827; border-radius: 24px; padding: 14px 16px 14px 50px; }
.pac-theme-light #pac-chatbot-input:focus { border-color: var(--pac-primary); background: #fff; }
.pac-theme-light #pac-chatbot-send { background: var(--pac-primary); color: white; border-radius: 50%; }
.pac-theme-light #pac-chatbot-send:hover { opacity: 0.9; }

/* ---------------- MINIMAL THEME ---------------- */
.pac-theme-minimal #pac-chatbot-container {
    background: var(--pac-bg, #ffffff);
    border: 1px solid #e5e7eb;
    border-radius: 12px; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    color: #374151;
}
.pac-theme-minimal #pac-chatbot-header { border-bottom: 1px solid #e5e7eb; padding: 16px 20px; }
.pac-theme-minimal .pac-header-info-text strong { color: #111827; }
.pac-theme-minimal .pac-header-info-text span { color: #6b7280; }
.pac-theme-minimal #pac-chatbot-close { color: #9ca3af; }
.pac-theme-minimal #pac-chatbot-close:hover { color: #111827; }
.pac-theme-minimal .pac-avatar-simple { width: 36px; height: 36px; background: #f3f4f6; color: var(--pac-primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; position: relative; }
.pac-theme-minimal .pac-avatar-simple svg { width: 18px; height: 18px; }
.pac-theme-minimal .pac-online-dot-simple { position: absolute; bottom: -4px; right: -4px; width: 10px; height: 10px; background-color: #10b981; border: 2px solid white; border-radius: 50%; }

.pac-theme-minimal .pac-bot .pac-bubble { background: transparent; color: #374151; border-radius: 0; padding: 8px 0; border: none; }
.pac-theme-minimal .pac-user .pac-bubble { background: var(--pac-primary); color: white; border-radius: 8px; }

.pac-theme-minimal #pac-chatbot-input-area { border-top: 1px solid #e5e7eb; padding: 16px 20px; }
.pac-theme-minimal #pac-chatbot-input { background: transparent; border: 1px solid #d1d5db; border-radius: 8px; padding: 12px 16px 12px 48px; }
.pac-theme-minimal #pac-chatbot-input:focus { border-color: var(--pac-primary); box-shadow: 0 0 0 2px rgba(0,0,0,0.05); }
.pac-theme-minimal #pac-chatbot-send { background: transparent; color: var(--pac-primary); border-radius: 8px; }
.pac-theme-minimal #pac-chatbot-send:hover { background: #f3f4f6; }


/* Markdown & Links */
.pac-btn-link {
    display: inline-block;
    padding: 6px 12px;
    margin: 4px 2px;
    background-color: var(--pac-primary);
    color: white !important;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 13px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.pac-btn-link:hover { opacity: 0.9; }
.pac-custom-action-area a:hover { opacity: 0.9; }

/* Typing animation */
.pac-typing { display: flex; gap: 4px; padding: 4px 8px; align-items: center; height: 24px; }
.pac-theme-immersive .pac-typing span { background: rgba(255,255,255,0.8); }
.pac-theme-light .pac-typing span, .pac-theme-minimal .pac-typing span { background: #9ca3af; }
.pac-typing span { width: 6px; height: 6px; border-radius: 50%; animation: pac-bounce 1.4s infinite ease-in-out both; }
.pac-typing span:nth-child(1) { animation-delay: -0.32s; }
.pac-typing span:nth-child(2) { animation-delay: -0.16s; }
@keyframes pac-bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

/* Responsive adjustments */
@media (max-width: 480px) {
    .pac-floating { bottom: 16px; right: 16px; left: 16px; }
    .pac-floating #pac-chatbot-container { width: 100% !important; height: calc(100vh - 100px) !important; bottom: calc(var(--pac-icon-size) + 16px); }
    .pac-inline #pac-chatbot-container { width: 100% !important; }
}
