/* ============================================================
   AMC ACADEMY TECH — WORLD-CLASS AI UI STYLESHEET
   Phase 2.5 — Avatar-Integrated Edition (Unified Final)
   ============================================================ */

/* ============================================================
   FLOATING BUTTON — AVATAR-INTEGRATED
   ============================================================ */

#amc-ai-button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #004AAD;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999999;
}

#amc-ai-button img.amc-ai-icon-img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

#amc-ai-button:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

/* ============================================================
   AI PANEL — FLOATING CHAT WINDOW (FULL HEIGHT FIXED)
   ============================================================ */

#amc-ai-panel {
    width: 380px;
    height: 100vh !important;
    background: white;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    position: fixed !important;
    top: 0 !important;
    right: 20px !important;
    bottom: 0 !important;
    display: none;
    flex-direction: column;
    overflow: hidden !important;
    transform: none !important;
    opacity: 0;
    z-index: 999999999 !important;
}

.amc-ai-panel-open {
    display: flex !important;
    flex-direction: column;
    visibility: visible !important;
    opacity: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    height: 100vh !important;
    max-height: 100vh !important;
    touch-action: auto !important;
    pointer-events: auto !important;
    animation: amcSlideUp 0.35s ease forwards;
}

@keyframes amcSlideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   HEADER
   ============================================================ */

#amc-ai-header {
    background: #004AAD;
    color: white;
    padding: 16px;
    position: relative;
    flex-shrink: 0 !important;
}

#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 — FIXED & FLEXIBLE
   ============================================================ */

#amc-ai-chat-body {
    flex: 1 !important;
    padding: 22px 20px;
    overflow-y: auto !important;
    background: #F7F9FC;
    scroll-behavior: smooth;
    box-sizing: border-box;
}

/* ============================================================
   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;
    white-space: pre-wrap;
}

.amc-ai-msg.ai {
    background: #004AAD;
    color: white;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 10px;
}

.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%;
}

.amc-ai-msg-text {
    flex: 1;
    line-height: 1.5;

    /* ⭐ Correct formatting for pretty‑printed JSON */
    white-space: pre-wrap;
    font-family: Consolas, "Courier New", monospace;
    word-break: break-word;
    overflow-y: auto;
}

.amc-ai-msg.ai.streaming {
    border-left: 3px solid #FFD700;
}


/* ============================================================
   COMPRESSED CHAT SUMMARY BUBBLE
   ============================================================ */

.chat-summary {
    background: #eef3ff;
    padding: 8px 12px;
    margin-bottom: 12px;
    border-left: 3px solid #4a6cf7;
    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); }
}

/* ============================================================
   INPUT BAR
   ============================================================ */

.amc-ai-input-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #ffffff;
    border-top: 1px solid #ddd;
    position: sticky;
    bottom: 0;
    z-index: 9999;
    pointer-events: auto;
    touch-action: auto;
    width: 100%;
}

#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
   ============================================================ */

.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); }
}

/* ============================================================
   DESKTOP OVERRIDE — FULL HEIGHT
   ============================================================ */

@media (min-width: 601px) {
    #amc-ai-panel {
        height: 100vh !important;
        top: 0 !important;
        bottom: 0 !important;
    }
}

/* ============================================================
   MOBILE RESPONSIVE — FULL HEIGHT
   ============================================================ */

@media (max-width: 600px) {
    #amc-ai-panel {
        width: 100% !important;
        height: 100vh !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        border-radius: 0 !important;
    }

    #amc-ai-button {
        bottom: 90px;
        right: 20px;
    }

    .amc-ai-icon-img {
        width: 36px;
        height: 36px;
    }

    .amc-ai-avatar-msg {
        width: 30px;
        height: 30px;
    }
}

/* ============================================================
   HOSTINGER INLINE STYLE OVERRIDE
   ============================================================ */

button#amc-ai-button img.amc-ai-icon-img {
    width: 42px;
    height: 42px;
    max-width: 42px;
    max-height: 42px;
    min-width: 42px;
    min-height: 42px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* ============================================================
   FIX TIGHT OUTPUT SPACING — REAL CONTAINERS
   ============================================================ */

#amc-ai-panel #amc-ai-chat-body {
    flex: 1 !important;
    padding: 22px 20px;
    background: #F7F9FC;
    overflow-y: auto !important;
    box-sizing: border-box;
}

#amc-ai-panel #amc-ai-chat-body .amc-ai-msg {
    max-width: 92%;
    margin-bottom: 18px;
    line-height: 1.6;
}

#amc-ai-panel #amc-ai-chat-body .amc-ai-msg.ai {
    padding: 14px 16px;
    gap: 14px;
}

#amc-ai-panel #amc-ai-chat-body .amc-ai-msg.user {
    padding: 14px 16px;
}

#amc-ai-panel #amc-ai-quick-actions {
    padding-top: 16px;
    padding-bottom: 16px;
    margin-bottom: 10px;
}

/* ============================================================
   AMC BRAND — MODE SELECTOR BAR
   ============================================================ */

#amc-ai-mode-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px;
    background: #F7F9FC;
    border-top: 1px solid #dce3ef;
    border-bottom: 1px solid #dce3ef;
    margin-top: 10px;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.amc-brand-btn {
    background: #06203A;
    border: 2px solid #0A84FF;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
    flex: 1 1 calc(50% - 12px);
    text-align: center;
}

.amc-brand-btn:hover {
    background: #0A84FF;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(10,132,255,0.6);
}

/* ============================================================
   ELEMENTOR / HOSTINGER OVERRIDE FIXES
   ============================================================ */

.elementor-widget,
.elementor-widget-container,
.elementor-column,
.elementor-section,
body,
html,
.homepage-wrapper,
#hero,
.home-grid,
.home-right {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

/* ============================================================
   FINAL OVERRIDE — FORCE FULL HEIGHT
   ============================================================ */

html body #amc-ai-panel {
    height: 100vh !important;
    top: 0 !important;
    bottom: 0 !important;
}

/* ============================================================
   LAPTOP VIEWPORT FIX — WINDOWS 125% SCALING
   ============================================================ */

#amc-ai-panel {
    height: 100svh !important;
    max-height: 100svh !important;
}

/* Mobile viewport refinement */
@media (max-width: 600px) {
    #amc-ai-panel {
        height: 100dvh !important;
        max-height: 100dvh !important;
    }
}

/* Mobile spacing refinement (Samsung / Android / iPhone) */
@media (max-width: 600px) {
    #amc-ai-panel {
        padding-top: env(safe-area-inset-top);
        padding-bottom: calc(env(safe-area-inset-bottom) + 12px);
    }

    #amc-ai-header {
        padding: 14px 16px;
    }

    .amc-ai-input-bar {
        padding: 10px 16px;
    }

    #pro-login-box {
        top: 75px !important;
        left: 16px !important;
        right: 16px !important;
    }
}

/* ===============================
   LAPTOP NAVIGATION FIX (1024px–1440px)
   =============================== */

@media (min-width: 1024px) and (max-width: 1440px) {

    .nav-wrapper {
        overflow-x: auto !important;
        white-space: nowrap !important;
        display: flex !important;
        align-items: center !important;
    }

    .main-nav {
        display: inline-flex !important;
        gap: 18px !important;
        white-space: nowrap !important;
    }

    .main-nav a {
        flex-shrink: 0 !important;
        padding: 0 14px !important;
        font-size: 15px !important;
    }

    .nav-wrapper::-webkit-scrollbar {
        display: none !important;
    }

    .nav-scroll {
        display: block !important;
        width: 32px !important;
        height: 32px !important;
        font-size: 22px !important;
        cursor: pointer !important;
    }
}


/* ============================================================
   AMC AI — SUBSCRIPTION FOOTER (PROFESSIONAL UI)
   ============================================================ */

#amc-ai-subscription-footer {
    margin-top: 18px;
    padding: 16px 20px;
    border-top: 1px solid #e3e3e3;
    background: #fafafa;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.amc-ai-subscription-header {
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.amc-ai-subscription-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.amc-subscribe-btn {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    background: #0078ff;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.amc-subscribe-btn:hover {
    background: #005fcc;
    transform: translateY(-1px);
}

.amc-subscribe-btn:active {
    transform: translateY(0px);
}
