/* ============================================================
   AMC ACADEMY TECH — WORLD-CLASS AI UI STYLESHEET
   Phase 2.5 — Avatar-Integrated Edition (Unified Final)
   ============================================================ */

/* ROOT CONTAINER */
#amc-ai-root {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999999 !important;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}

/* ============================================================
   FLOATING BUTTON — AVATAR-INTEGRATED
   ============================================================ */

#amc-ai-button {
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    background: #004AAD;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    overflow: hidden !important;
    position: relative !important;
    z-index: 999999999 !important;
}

/* FIX: Neutralize rogue flex attribute scaling */
#amc-ai-button[flex] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Avatar image inside button */
#amc-ai-button img.amc-ai-icon-img {
    width: 42px !important;
    height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
    flex: 0 0 auto !important;
}

/* Hover effect */
#amc-ai-button:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

/* ============================================================
   AI PANEL
   ============================================================ */

#amc-ai-panel {
    width: 380px;
    height: 520px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    position: fixed;
    bottom: 100px;
    right: 20px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(40px);
    opacity: 0;
}

/* PANEL OPEN ANIMATION */
.amc-ai-panel-open {
    animation: amcSlideUp 0.35s ease forwards;
}

@keyframes amcSlideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   HEADER
   ============================================================ */

#amc-ai-header {
    background: #004AAD;
    color: white;
    padding: 16px;
    position: relative;
}

#amc-ai-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

#amc-ai-header p {
    margin: 4px 0 0;
    font-size: 13px;
    opacity: 0.9;
}

#amc-ai-close {
    position: absolute;
    right: 12px;
    top: 12px;
    background: transparent;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
}

/* ============================================================
   CHAT BODY
   ============================================================ */

#amc-ai-chat-body {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background: #F7F9FC;
    scroll-behavior: smooth;
}

/* ============================================================
   MESSAGE BUBBLES — AVATAR-INTEGRATED
   ============================================================ */

.amc-ai-msg {
    max-width: 80%;
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: 12px;
    line-height: 1.45;
    font-size: 14px;
    animation: fadeIn 0.25s ease;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.amc-ai-msg.ai {
    background: #004AAD;
    color: white;
    border-bottom-left-radius: 4px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
}

.amc-ai-msg.user {
    background: #E5E7EB;
    color: #111;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.amc-ai-avatar-msg {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
}

.amc-ai-msg-text {
    flex: 1;
    line-height: 1.5;
}

/* STREAMING BUBBLE POLISH */
.amc-ai-msg.ai.streaming {
    opacity: 0.95;
    border-left: 3px solid #FFD700;
}

/* ============================================================
   COMPRESSED CHAT SUMMARY BUBBLE
   ============================================================ */

.chat-summary {
    background: #eef3ff;
    padding: 8px 12px;
    margin-bottom: 12px;
    border-left: 3px solid #4a6cf7; /* AMC Blue highlight */
    font-size: 13px;
    color: #333;
    border-radius: 8px;
    line-height: 1.45;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ============================================================
   QUICK ACTION BUTTONS
   ============================================================ */

#amc-ai-quick-actions {
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #ffffff;
    border-top: 1px solid #ddd;
}

.amc-ai-quick {
    background: #004AAD;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.amc-ai-quick:hover {
    background: #00337A;
}

/* ============================================================
   INPUT BAR
   ============================================================ */

#amc-ai-input-bar {
    display: flex;
    padding: 10px;
    background: #ffffff;
    border-top: 1px solid #ddd;
    align-items: flex-end;
}

#amc-ai-input {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 14px;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    overflow-y: auto;
}

#amc-ai-input:focus {
    border-color: #004AAD;
    outline: none;
    box-shadow: 0 0 4px rgba(0,74,173,0.4);
}

#amc-ai-send {
    background: #004AAD;
    color: white;
    border: none;
    padding: 0 16px;
    margin-left: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
}

#amc-ai-send:hover {
    background: #00337A;
}

/* ============================================================
   VOICE INPUT BUTTON (DEPRECATED BUT SAFE)
   ============================================================ */

.amc-ai-voice-btn {
    background: #004AAD;
    color: white;
    border: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.amc-ai-voice-btn:hover {
    background: #00337A;
}

.amc-ai-voice-btn.listening {
    background: #e53935;
    animation: amcVoicePulse 1s infinite;
}

@keyframes amcVoicePulse {
    0% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 0.9; }
}

/* ============================================================
   TYPING INDICATOR
   ============================================================ */

.amc-ai-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #004AAD;
    color: white;
    padding: 10px 14px;
    border-radius: 12px;
    width: fit-content;
    border-bottom-left-radius: 4px;
}

.amc-ai-typing img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.amc-ai-typing-dots {
    display: flex;
    gap: 4px;
}

.amc-ai-typing-dot {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: typingBlink 1.4s infinite ease-in-out;
}

.amc-ai-typing-dot:nth-child(1) { animation-delay: 0s; }
.amc-ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.amc-ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBlink {
    0% { opacity: 0.2; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
    100% { opacity: 0.2; transform: translateY(0); }
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
    #amc-ai-panel {
        width: 100%;
        height: 90%;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }

    #amc-ai-button {
        bottom: 90px;
        right: 20px;
    }

    .amc-ai-icon-img {
        width: 36px;
        height: 36px;
    }

    .amc-ai-avatar-msg {
        width: 30px;
        height: 30px;
    }
}

/* HARD OVERRIDE FOR HOSTINGER INLINE STYLES */
button#amc-ai-button img.amc-ai-icon-img {
    width: 42px !important;
    height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    display: block !important;
}

/* ============================================================
   FIX TIGHT OUTPUT SPACING — REAL CONTAINERS (FINAL INTEGRATION)
   ============================================================ */

/* Expand chat body padding — stronger selector */
#amc-ai-panel #amc-ai-chat-body {
    padding: 22px 20px !important;
    background: #F7F9FC !important;
}

/* Expand message bubble width — stronger selector */
#amc-ai-panel #amc-ai-chat-body .amc-ai-msg {
    max-width: 92% !important;
    margin-bottom: 18px !important;
    line-height: 1.6 !important;
}

/* AI bubble spacing — stronger selector */
#amc-ai-panel #amc-ai-chat-body .amc-ai-msg.ai {
    padding: 14px 16px !important;
    gap: 14px !important;
}

/* User bubble spacing — stronger selector */
#amc-ai-panel #amc-ai-chat-body .amc-ai-msg.user {
    padding: 14px 16px !important;
}

/* Add breathing room above quick actions — stronger selector */
#amc-ai-panel #amc-ai-quick-actions {
    padding-top: 16px !important;
    padding-bottom: 16px !important;
    margin-bottom: 10px !important;
}

/* ============================================================
   ROLLBACK — Restore original spacing
   ============================================================ */

#amc-ai-chat-body {
    padding: 14px !important;
    background: #F7F9FC !important;
}

#amc-ai-chat-body .amc-ai-msg {
    max-width: 80% !important;
    margin-bottom: 12px !important;
    line-height: 1.45 !important;
}

#amc-ai-chat-body .amc-ai-msg.ai {
    padding: 10px 12px !important;
    gap: 10px !important;
}

#amc-ai-chat-body .amc-ai-msg.user {
    padding: 10px 12px !important;
}

#amc-ai-quick-actions {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    margin-bottom: 0 !important;
}


