/* ==========================================================================
   1. RESET & CONTAINER BASE
   ========================================================================== */
#fmz-bot-container,
#fmz-bot-container * { box-sizing: border-box !important; }

#fmz-bot-container { 
    position: fixed; 
    bottom: 25px; 
    left: 25px; 
    z-index: 999999; 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
}

/* ==========================================================================
   2. KEYFRAME ANIMATIONS
   ========================================================================== */
@keyframes fmz-slide-up { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes fmz-pop-in { from { opacity: 0; transform: scale(0.95) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes fmz-modal-pop-in { from { opacity: 0; transform: translate(-50%, -45%) scale(0.95); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes fmz-pulse-glow { 0% { box-shadow: 0 0 0 0 rgba(var(--fmz-primary-rgb), 0.4); } 70% { box-shadow: 0 0 0 15px rgba(var(--fmz-primary-rgb), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--fmz-primary-rgb), 0); } }
@keyframes fmz-typing-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-5px); opacity: 1; } }

/* ==========================================================================
   3. TRIGGER TOGGLE BUTTON & WINDOW WRAPPER
   ========================================================================== */
#fmz-bot-toggle { 
    background: linear-gradient(135deg, var(--fmz-primary), var(--fmz-secondary)); 
    color: white; 
    border: none; 
    padding: 14px 24px; 
    border-radius: 30px; 
    font-size: 16px; 
    font-weight: bold; 
    cursor: pointer; 
    box-shadow: 0 4px 15px rgba(var(--fmz-primary-rgb), 0.3); 
    animation: fmz-pulse-glow 2.5s infinite; 
    transition: all 0.2s ease; 
    white-space: nowrap; 
}
#fmz-bot-toggle:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(var(--fmz-primary-rgb), 0.5); }

#fmz-bot-window { 
    width: 350px; 
    max-width: calc(100vw - 30px); 
    height: 500px; 
    max-height: calc(100vh - 80px); 
    position: relative; 
    background: rgba(255, 255, 255, 0.95); 
    backdrop-filter: blur(16px); 
    -webkit-backdrop-filter: blur(16px); 
    border: 1px solid rgba(255, 255, 255, 0.6); 
    border-radius: 20px; 
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.12); 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
    margin-bottom: 15px; 
    animation: fmz-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
}

/* ==========================================================================
   4. HEADER & ACTIONS
   ========================================================================== */
#fmz-bot-header { background: linear-gradient(90deg, var(--fmz-primary), var(--fmz-secondary)); color: white; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
#fmz-bot-header strong { font-size: 15px; letter-spacing: 0.3px; }
.fmz-header-actions { display: flex; gap: 8px; align-items: center; }

#fmz-bot-menu-toggle { background: transparent; border: none; color: white; font-size: 22px; line-height: 1; width: 28px; height: 28px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding-bottom: 8px; }
#fmz-bot-close { background: rgba(255,255,255,0.2); border: none; color: white; font-size: 12px; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
#fmz-bot-menu-toggle:hover { opacity: 0.7; } 
#fmz-bot-close:hover { background: rgba(255,255,255,0.35); }

/* ==========================================================================
   5. OPTIONS MODAL OVERLAY
   ========================================================================== */
#fmz-bot-options-modal { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000; }
.fmz-modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.fmz-modal-content-wrapper { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 75%; background: #ffffff; border-radius: 20px; padding: 24px 20px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.2); animation: fmz-modal-pop-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fmz-modal-title { margin: 0 0 18px 0; color: var(--fmz-primary); font-size: 16px; font-weight: bold; }
.fmz-modal-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px 20px; border-radius: 24px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s ease; }
.fmz-modal-btn.fmz-danger { background: #fee2e2; color: #c62828; margin-bottom: 12px; } 
.fmz-modal-btn.fmz-danger:hover { background: #ef9a9a; transform: translateY(-2px); }
.fmz-modal-btn.fmz-cancel { background: #f5f5f5; color: #555; } 
.fmz-modal-btn.fmz-cancel:hover { background: #e0e0e0; transform: translateY(-2px); }

/* ==========================================================================
   6. MESSAGES AREA & BUBBLES
   ========================================================================== */
#fmz-bot-messages { flex-grow: 1; padding: 20px 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
#fmz-bot-messages::-webkit-scrollbar { width: 4px; } 
#fmz-bot-messages::-webkit-scrollbar-thumb { background: rgba(var(--fmz-primary-rgb), 0.2); border-radius: 10px; }

.fmz-message-row { display: flex; gap: 10px; width: 100%; animation: fmz-pop-in 0.3s ease forwards; }
.fmz-message-row.user { flex-direction: row-reverse; }
.fmz-message-row.model { flex-direction: row; }
.fmz-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; box-shadow: 0 2px 5px rgba(0,0,0,0.1); flex-shrink: 0; }

.fmz-message-column { display: flex; flex-direction: column; flex: 1; max-width: 88%; min-width: 0; }
.fmz-message-row.user .fmz-message-column { align-items: flex-end; }
.fmz-message-row.model .fmz-message-column { align-items: flex-start; }

.fmz-message-bubble { padding: 12px 16px; border-radius: 18px; font-size: 14px; line-height: 1.55; box-shadow: 0 2px 6px rgba(0,0,0,0.03); overflow-wrap: break-word; word-wrap: break-word; width: fit-content; }
.fmz-user .fmz-message-bubble { background: linear-gradient(135deg, #e8f5e9, #c8e6c9); color: #2b5c2d; border-top-right-radius: 4px; }
.fmz-model .fmz-message-bubble, .fmz-bot .fmz-message-bubble { background: #ffffff; color: #333; border-top-left-radius: 4px; border: 1px solid rgba(0,0,0,0.04); }

.fmz-timestamp { font-size: 10px; color: #a0a0a0; margin-top: 4px; padding: 0 4px; }
.fmz-feedback-actions { display: flex; gap: 8px; margin-top: 6px; padding-left: 4px; }
.fmz-feedback-btn { background: transparent; border: 1px solid transparent; cursor: pointer; font-size: 14px; opacity: 0.5; transition: all 0.2s; padding: 2px 4px; border-radius: 4px; }
.fmz-feedback-btn:hover:not(:disabled) { opacity: 1; background: rgba(0,0,0,0.05); } 
.fmz-feedback-btn.active { opacity: 1; transform: scale(1.15); } 
.fmz-feedback-btn:disabled { cursor: default; }

/* ==========================================================================
   7. UI COMPONENTS (CARDS, ACCORDIONS, CHIPS)
   ========================================================================== */
.fmz-cards-container { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; width: 100%; }
.fmz-article-card { background: #ffffff; border-radius: 12px; border: 1px solid #eef2f3; border-left: 4px solid var(--fmz-primary); padding: 14px; margin: 0; box-shadow: 0 4px 12px rgba(0,0,0,0.04); }
.fmz-card-header { font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: #a0a0a0; font-weight: bold; margin-bottom: 4px; }
.fmz-card-title { font-size: 13.5px; font-weight: 600; color: #2c3e50; line-height: 1.4; margin-bottom: 10px; }
.fmz-card-btn { display: inline-block; background: rgba(var(--fmz-primary-rgb), 0.06); color: var(--fmz-primary); padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; text-decoration: none; transition: all 0.2s; }
.fmz-card-btn:hover { background: var(--fmz-primary); color: white; }

.fmz-accordion { border: 1px solid #eef2f3; border-radius: 10px; margin: 12px 0; overflow: hidden; background: #fafbfc; }
.fmz-accordion-header { background: #ffffff; padding: 12px 14px; font-size: 13px; font-weight: 600; color: #34495e; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background 0.2s; }
.fmz-accordion-header:hover { background: #fdfdfd; }
.fmz-accordion-icon { font-size: 10px; color: #a0a0a0; transition: transform 0.2s; } 
.fmz-accordion-header.active .fmz-accordion-icon { transform: rotate(180deg); }
.fmz-accordion-content { display: none; padding: 14px; font-size: 13px; border-top: 1px solid #eef2f3; background: #ffffff; color: #555; }

.fmz-chips-outer-wrapper { width: 100%; padding-left: 42px; animation: fmz-pop-in 0.4s ease forwards; }
.fmz-chips-flex-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -6px; }
.fmz-action-chip { background: #ffffff; color: var(--fmz-primary); border: 1px solid var(--fmz-primary); padding: 6px 14px; border-radius: 20px; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: all 0.2s ease; box-shadow: 0 2px 5px rgba(0,0,0,0.03); }
.fmz-action-chip:hover { background: var(--fmz-primary); color: white; transform: translateY(-1px); }

.fmz-message-bubble strong { color: var(--fmz-secondary); }
.fmz-message-bubble h3 { font-size: 15px; color: var(--fmz-primary); margin: 16px 0 8px 0; font-weight: bold; }
.fmz-message-bubble blockquote { background-color: var(--fmz-highlight-bg); color: var(--fmz-highlight-text); padding: 12px 14px; margin: 12px 0; border-left: 3px solid var(--fmz-primary); border-radius: 0 6px 6px 0; font-style: italic; font-size: 13px; }
.fmz-paragraph-space { height: 12px; width: 100%; }
.fmz-bullet, .fmz-task { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0; }
.fmz-bullet-dot { font-weight: bold; color: var(--fmz-primary); min-width: 14px; }
.fmz-task input[type="checkbox"] { margin-top: 4px; accent-color: var(--fmz-primary); }

.fmz-typing-container { display: flex; align-items: center; gap: 4px; padding: 4px 2px; }
.fmz-typing-dot { width: 6px; height: 6px; background-color: var(--fmz-primary); border-radius: 50%; animation: fmz-typing-bounce 1.4s infinite ease-in-out both; }
.fmz-typing-dot:nth-child(1) { animation-delay: -0.32s; } 
.fmz-typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* ==========================================================================
   8. INPUT FIELD AREA
   ========================================================================== */
#fmz-bot-input-area { display: flex !important; align-items: center !important; padding: 12px !important; border-top: 1px solid rgba(0,0,0,0.06) !important; background: #ffffff !important; width: 100% !important; flex-shrink: 0 !important; }
#fmz-bot-input { flex-grow: 1 !important; min-width: 0 !important; height: 42px !important; padding: 8px 14px !important; border: 1px solid #e0e0e0 !important; border-radius: 24px !important; outline: none !important; font-size: 14px !important; line-height: 1.2 !important; background: #fafafa !important; transition: all 0.3s !important; margin: 0 !important; }
#fmz-bot-input:focus { border-color: var(--fmz-primary) !important; background: #ffffff !important; box-shadow: 0 0 0 3px rgba(var(--fmz-primary-rgb), 0.08) !important; }
#fmz-bot-send { background-color: var(--fmz-primary) !important; color: white !important; border: none !important; height: 42px !important; padding: 0 18px !important; margin-left: 8px !important; border-radius: 24px !important; cursor: pointer !important; font-weight: bold !important; font-size: 14px !important; line-height: 42px !important; white-space: nowrap !important; flex-shrink: 0 !important; transition: background 0.2s !important; }
#fmz-bot-send:hover { background-color: var(--fmz-secondary) !important; }