/* Softgozar AI Chat Assistant - Glassmorphism & Modern UI/UX v3.0 */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

/* Launcher Button */
#sg-ai-widget-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 62px;
    height: 62px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
    z-index: 999999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.25);
}

#sg-ai-widget-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.45);
}

#sg-ai-widget-btn.sg-vip {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
    border: 2px solid #a7f3d0;
}

#sg-ai-widget-btn.sg-vip:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 32px rgba(16, 185, 129, 0.6);
}

.sg-ai-crown-badge {
    position: absolute;
    top: -6px;
    right: -4px;
    background: #ffffff;
    color: #047857;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: bounceCrown 2.5s infinite ease-in-out;
}

@keyframes bounceCrown {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-3px) rotate(6deg); }
}

/* Glassmorphism Chat Window */
#sg-ai-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 400px;
    max-width: calc(100% - 32px);
    height: 580px;
    max-height: calc(100vh - 120px);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999;
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    direction: rtl;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

#sg-ai-chat-window.active {
    display: flex;
    animation: slideUpFade 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.sg-ai-header {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff;
    padding: 15px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sg-ai-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sg-ai-avatar-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #60a5fa;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.sg-ai-header-text {
    display: flex;
    flex-direction: column;
}

.sg-ai-header-title {
    font-weight: 700;
    font-size: 14.5px;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sg-ai-status-online {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.sg-ai-header-subtitle {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 1px;
}

.sg-ai-close {
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
}

.sg-ai-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
    transform: rotate(90deg);
}

.sg-ai-header.sg-vip {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.95), rgba(4, 47, 46, 0.95));
    border-bottom: 2px solid #10b981;
}

.sg-ai-header.sg-vip .sg-ai-avatar-icon {
    color: #34d399;
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.35);
}

.sg-vip-badge {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    color: #ffffff;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

/* Chat Body */
.sg-ai-body {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    background: rgba(248, 250, 252, 0.65);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    direction: ltr; /* Move scrollbar to the right */
}

.sg-ai-body::-webkit-scrollbar {
    width: 3px; /* Narrower scrollbar */
}

.sg-ai-body::-webkit-scrollbar-thumb {
    background: rgba(203, 213, 225, 0.8);
    border-radius: 4px;
}

/* VIP Theme Scrollbar */
#sg-ai-chat-window.sg-vip .sg-ai-body::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.6);
}
#sg-ai-chat-window.sg-vip .sg-ai-body::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.9);
}

/* Messages */
.sg-message {
    max-width: 88%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.75;
    word-wrap: break-word;
    direction: rtl; /* Keep text RTL */
}

.sg-message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    color: #0f172a;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.sg-message.bot.streaming::after {
    content: '▋';
    display: inline-block;
    vertical-align: baseline;
    animation: blink 0.8s infinite;
    color: #2563eb;
    margin-right: 4px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.sg-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border-bottom-left-radius: 4px;
    box-shadow: 0 3px 12px rgba(37, 99, 235, 0.3);
}

.sg-message p { margin: 0 0 8px 0; }
.sg-message p:last-child { margin: 0; }

/* Markdown Parsed Elements */
.sg-md-h3 {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin: 12px 0 6px 0;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 4px;
}

.sg-md-h2 {
    font-size: 16.5px;
    font-weight: 700;
    color: #0f172a;
    margin: 14px 0 8px 0;
    border-bottom: 2px solid #cbd5e1;
    padding-bottom: 4px;
}

.sg-md-h1 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 16px 0 10px 0;
}

.sg-md-hr {
    border: none;
    border-top: 1px dashed #cbd5e1;
    margin: 12px 0;
}

.sg-md-ul, .sg-md-ol {
    padding-right: 20px;
    margin: 6px 0 10px 0;
}

.sg-md-li, .sg-md-oli {
    margin-bottom: 4px;
    line-height: 1.6;
}

.sg-md-link {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s;
    direction: ltr;
    display: inline-block;
    word-break: break-all;
    max-width: 100%;
}

.sg-md-link:hover {
    color: #1d4ed8;
}

.sg-message code {
    background-color: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    direction: ltr;
    display: inline-block;
    color: #d97706;
}

.sg-message pre {
    background-color: #0f172a;
    color: #f8fafc;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
    margin: 10px 0;
}

.sg-message pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

/* AI Thinking Indicator Bubble (ChatGPT / Claude Style) */
.sg-message.bot.thinking {
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.95), rgba(219, 234, 254, 0.95));
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 14px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.1);
    animation: pulseThinking 2s infinite ease-in-out;
}

@keyframes pulseThinking {
    0%, 100% { border-color: rgba(59, 130, 246, 0.3); box-shadow: 0 2px 10px rgba(37, 99, 235, 0.08); }
    50% { border-color: rgba(59, 130, 246, 0.7); box-shadow: 0 4px 18px rgba(37, 99, 235, 0.25); }
}

.sg-ai-thinking-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sg-ai-thinking-content .sg-ai-sparkle-svg {
    animation: spinSparkle 2s linear infinite;
    color: #2563eb !important;
    width: 22px !important;
    height: 22px !important;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 6px rgba(37, 99, 235, 0.4));
}

@keyframes spinSparkle {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.18); }
    100% { transform: rotate(360deg) scale(1); }
}

.sg-ai-thinking-text {
    font-size: 13px;
    font-weight: 500;
    background: linear-gradient(90deg, #1e40af 0%, #3b82f6 50%, #1e40af 100%);
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shimmerText 2.5s linear infinite;
}

@keyframes shimmerText {
    to { background-position: 200% center; }
}

/* Footer / Input Bar */
.sg-ai-footer {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(226, 232, 240, 0.6);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sg-ai-input {
    flex: 1;
    padding: 11px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    outline: none;
    font-family: inherit;
    font-size: 13.5px;
    color: #1e293b;
    background: rgba(248, 250, 252, 0.8);
    transition: all 0.2s ease;
}

.sg-ai-input:focus {
    border-color: #2563eb;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.sg-ai-send {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
    flex-shrink: 0;
}

.sg-ai-send:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 14px rgba(37, 99, 235, 0.45);
}

.sg-ai-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* VIP Button Link */
.sg-vip-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff !important;
    padding: 9px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.3);
    transition: all 0.2s ease;
}

.sg-vip-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(245, 158, 11, 0.5);
}

/* AI Floating Promo Callout Badge Above Launcher Button */
.sg-ai-promo-badge {
    position: fixed;
    bottom: 96px;
    right: 24px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 50%, #db2777 100%);
    background-size: 200% 200%;
    animation: sgAiGradientShift 6s ease infinite;
    color: #ffffff;
    border-radius: 25px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999998;
    user-select: none;
    white-space: nowrap;
    direction: rtl;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    overflow: hidden;
}

.sg-ai-promo-badge::before {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 80%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: skewX(-25deg);
    animation: sgAiShimmer 3.5s infinite;
}

.sg-ai-promo-glow {
    position: absolute;
    inset: -3px;
    border-radius: 28px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
    filter: blur(8px);
    opacity: 0.5;
    z-index: -1;
    animation: sgAiPulse 2.5s ease-in-out infinite alternate;
}

.sg-ai-promo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    animation: sgAiIconFloat 3s ease-in-out infinite;
    flex-shrink: 0;
}

.sg-ai-promo-icon .sg-ai-sparkle-svg {
    color: #ffffff;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.8));
}

.sg-ai-promo-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sg-ai-promo-title {
    font-size: 13px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.sg-ai-promo-sub {
    font-size: 10.5px;
    opacity: 0.92;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sg-ai-live-dot {
    width: 5px;
    height: 5px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 5px #22c55e;
    animation: sgAiBlink 1.5s infinite;
    flex-shrink: 0;
}

.sg-ai-promo-close {
    margin-right: 4px;
    font-size: 17px;
    line-height: 1;
    opacity: 0.75;
    transition: opacity 0.2s ease;
    padding: 0 2px;
}

.sg-ai-promo-close:hover {
    opacity: 1;
}

.sg-ai-promo-badge:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

@keyframes sgAiPromoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes sgAiGradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes sgAiShimmer {
    0% { left: -120%; }
    30% { left: 140%; }
    100% { left: 140%; }
}

@keyframes sgAiPulse {
    0% { opacity: 0.4; transform: scale(0.98); }
    100% { opacity: 0.85; transform: scale(1.03); }
}

@keyframes sgAiIconFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-2px) rotate(8deg); }
}

@keyframes sgAiBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Softgozar AI Download Page Banner Styles - Mobile Optimized */
.sg-ai-download-banner {
    position: relative;
    width: 100%;
    margin: 20px 0;
    padding: 18px 22px;
    box-sizing: border-box;
    background: linear-gradient(135deg, #0b1329 0%, #152238 50%, #0d1b3a 100%);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(11, 19, 41, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    direction: rtl;
    font-family: 'Vazirmatn', iransans, yekanRegular, sans-serif;
}

.sg-ai-download-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(11, 19, 41, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.sg-ai-banner-glow {
    position: absolute;
    top: -50%;
    left: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.25) 0%, transparent 70%);
    pointer-events: none;
    filter: blur(20px);
}

.sg-ai-banner-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}

.sg-ai-banner-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.15);
    border: 1px solid rgba(37, 99, 235, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #60a5fa;
    flex-shrink: 0;
    margin-top: 2px;
}

.sg-ai-banner-title-area {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-grow: 1;
    min-width: 0;
}

.sg-ai-banner-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.sg-ai-banner-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
    white-space: nowrap;
}

.sg-ai-banner-online-badge {
    background: #2563eb;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.sg-ai-banner-subtitle {
    margin: 0;
    font-size: 12.5px;
    color: #94a3b8;
    line-height: 1.55;
}

.sg-ai-banner-action {
    display: flex;
    justify-content: flex-end;
}

.sg-ai-banner-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: 22px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}

.sg-ai-banner-btn:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.55);
}

@media (max-width: 600px) {
    .sg-ai-download-banner {
        padding: 14px 16px;
        margin: 12px 0;
    }
    .sg-ai-banner-header {
        gap: 10px;
        margin-bottom: 10px;
    }
    .sg-ai-banner-icon {
        width: 36px;
        height: 36px;
    }
    .sg-ai-banner-title {
        font-size: 13.5px;
    }
    .sg-ai-banner-subtitle {
        font-size: 11.5px;
    }
    .sg-ai-banner-action {
        justify-content: center;
        width: 100%;
        margin-top: 6px;
    }
    .sg-ai-banner-btn {
        width: 100%;
        justify-content: center;
        padding: 8px 14px;
        font-size: 12.5px;
    }
}

/* ==========================================================================
   Mobile-First Responsive UI/UX Styles (iOS/Android Modern Standards)
   ========================================================================== */
@media (max-width: 768px) {
    /* Hide blue AI Circle Launcher button on Mobile */
    #sg-ai-widget-btn {
        display: none !important;
    }

    /* Floating Promo Badge on Mobile: Centered Under Header Logo */
    .sg-ai-promo-badge {
        position: fixed !important;
        top: 104px !important;
        bottom: auto !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        padding: 5px 12px !important;
        font-size: 11px !important;
        border-radius: 18px !important;
        max-width: calc(100vw - 32px) !important;
        z-index: 99999 !important;
        box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4) !important;
    }

    .sg-ai-promo-icon {
        width: 18px;
        height: 18px;
    }

    .sg-ai-promo-title {
        font-size: 10.5px;
    }

    .sg-ai-promo-sub {
        display: none;
    }

    .sg-ai-promo-close {
        font-size: 13px;
        margin-left: 2px;
    }

    /* Full-Screen Bottom Sheet Drawer Modal on Mobile */
    #sg-ai-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile browsers */
        max-width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
        margin: 0;
        box-shadow: none;
        z-index: 9999999;
        border: none;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(25px) saturate(200%);
        -webkit-backdrop-filter: blur(25px) saturate(200%);
    }

    #sg-ai-chat-window.active {
        animation: mobileSheetSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    @keyframes mobileSheetSlideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    /* Mobile Sheet Handle Bar & Header */
    .sg-ai-header {
        padding-top: max(16px, env(safe-area-inset-top));
        padding-bottom: 12px;
        padding-left: 16px;
        padding-right: 16px;
        position: relative;
    }

    /* Notch Drag Handle Bar on Mobile Header */
    .sg-ai-header::before {
        content: "";
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 4px;
    }

    .sg-ai-header-title {
        font-size: 15px;
    }

    .sg-ai-header-subtitle {
        font-size: 11px;
    }

    .sg-ai-avatar-icon {
        width: 34px;
        height: 34px;
    }

    .sg-ai-close {
        width: 36px;
        height: 36px;
        font-size: 18px;
        background: rgba(255, 255, 255, 0.1);
    }

    /* Mobile Chat Body */
    .sg-ai-body {
        padding: 14px 12px;
        gap: 12px;
        -webkit-overflow-scrolling: touch;
    }

    .sg-message {
        max-width: 90%;
        padding: 11px 14px;
        font-size: 14px;
        line-height: 1.65;
        border-radius: 16px;
    }

    .sg-message.bot {
        border-bottom-right-radius: 4px;
    }

    .sg-message.user {
        border-bottom-left-radius: 4px;
    }

    /* Mobile Footer & Input Area with iOS Safe Area Insets */
    .sg-ai-footer {
        padding: 10px 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.98);
        border-top: 1px solid rgba(226, 232, 240, 0.9);
        gap: 8px;
    }

    /* CRITICAL USABILITY FIX: 16px font-size prevents iOS Safari auto-zoom on input focus */
    .sg-ai-input {
        font-size: 16px !important;
        padding: 10px 14px;
        border-radius: 22px;
    }

    .sg-ai-send {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .sg-vip-btn {
        width: 100%;
        justify-content: center;
        padding: 10px;
        font-size: 13.5px;
        border-radius: 10px;
    }
}
