@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
}

body { font-family: 'Vazirmatn', sans-serif; background-color: #0f172a; }

/* باقی استایل‌های قبلی شما برای ویجت و مدال در اینجا قرار گیرد */
/* --- متغیرهای سراسری --- */
:root {
    --voice-bg-main: #0f172a;
    --voice-bg-card: rgba(30, 41, 59, 0.4);
    --voice-bg-card-hover: rgba(51, 65, 85, 0.6);
    --voice-border-light: rgba(255, 255, 255, 0.08);
    --voice-text-main: #ffffff;
    --voice-text-muted: #94a3b8;
    --voice-primary: #a855f7;
    --voice-success: #10b981;
    --voice-gradient: linear-gradient(to right, #a855f7, #ec4899);
}

/* کلاس مخفی ساز اجباری */
.hidden { display: none !important; visibility: hidden !important; opacity: 0 !important; }

/* --- دکمه شناور (Sticky Button) --- */
.sticky-voice-widget {
    position: fixed;
    bottom: 24px;
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    transition: all 0.5s ease;
    font-family: 'Vazirmatn', sans-serif;
    direction: rtl;
}

.sticky-voice-widget.hidden { display: none !important; }
.sticky-voice-widget.position-right { right: 24px; left: auto; align-items: flex-end; }
.sticky-voice-widget.position-left { left: 24px; right: auto; align-items: flex-start; }

/* استایل دکمه بستن دکمه شناور */
.sticky-close-btn {
    position: relative; 
    margin-bottom: -12px;
    width: 26px;
    height: 26px;
    background: #ffffff !important;
    color: #4b5563 !important;
    border-radius: 50%;
    border: 1px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    z-index: 20;
    padding: 0;
    transition: all 0.2s ease;
}

.sticky-close-btn svg {
    width: 14px !important;
    height: 14px !important;
    stroke: currentColor;
    stroke-width: 2.5;
    display: block;
    pointer-events: none; /* مهم: کلیک به دکمه منتقل شود */
}

.position-right .sticky-close-btn { margin-right: 8px; }
.position-left .sticky-close-btn { margin-left: 8px; }

.sticky-close-btn:hover {
    background: #fee2e2 !important;
    color: #ef4444 !important;
    border-color: #fca5a5;
    transform: scale(1.1);
}

/* دکمه اصلی شناور */
.sticky-main-btn {
    display: flex; align-items: center; gap: 12px; padding: 12px 20px 12px 12px;
    background: white; border-radius: 9999px; border: none; cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    position: relative; z-index: 10; transition: transform 0.2s; text-align: right;
}
.sticky-main-btn:active { transform: scale(0.95); }

.mic-icon-wrapper {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; background: #fef2f2; color: #dc2626; border-radius: 50%; flex-shrink: 0;
}
.mic-svg { width: 20px; height: 20px; }
.notification-dot {
    position: absolute; top: 0; right: 0; width: 10px; height: 10px;
    background: #2563eb; border: 2px solid white; border-radius: 50%; animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.sticky-text-content { display: flex; flex-direction: column; align-items: flex-start; min-width: 120px; }
.sticky-title { font-size: 14px; font-weight: bold; color: #1f2937; line-height: 1.2; }
.sticky-subtitle { font-size: 11px; color: #6b7280; margin-top: 2px; }
.arrow-icon { width: 16px; height: 16px; color: #9ca3af; margin-right: 4px; }

@media screen and (max-width: 768px) {
    .sticky-voice-widget.position-right { bottom: 16px; right: 16px; }
    .sticky-voice-widget.position-left { bottom: 16px; left: 16px; }
}

/* --- ساختار مدال پاپ آپ --- */
.voice-popup-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 999999;
    display: none; align-items: center; justify-content: center; padding: 1rem; direction: rtl;
}
.voice-popup-modal.active { display: flex; }
.voice-popup-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); cursor: pointer;
}

/* --- دکمه بستن پاپ آپ --- */
.close-popup-btn {
    position: absolute; left: 1rem; top: 1.25rem;
    background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); 
    color: #ffffff !important;
    width: 2.25rem; height: 2.25rem; border-radius: 0.5rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s; z-index: 20; padding: 0;
}

.close-popup-btn svg {
    width: 20px !important;
    height: 20px !important;
    stroke: currentColor;
    stroke-width: 2;
    display: block;
    pointer-events: none; /* مهم */
}

.close-popup-btn:hover { background: rgba(239, 68, 68, 0.8); border-color: rgba(239, 68, 68, 1); }

/* --- کانتینر اصلی فرم --- */
.voice-test-root { position: relative; width: 100%; max-width: 500px; z-index: 10; animation: voiceSlideUp 0.3s ease-out forwards; }
@keyframes voiceSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.voice-test-wrapper { font-family: 'Vazirmatn', sans-serif; direction: rtl; width: 100%; height: auto; max-height: 85vh; display: flex; flex-direction: column; background: var(--voice-bg-main); color: var(--voice-text-main); user-select: none; position: relative; overflow: hidden; border-radius: 1.5rem; border: 1px solid var(--voice-border-light); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); }

/* --- پس‌زمینه‌های نوری --- */
.bg-glow { position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; z-index: 0; }
.bg-glow.top-right { top: 0; right: 0; width: 20rem; height: 20rem; background: rgba(168, 85, 247, 0.1); margin: -5rem -5rem 0 0; }
.bg-glow.bottom-left { bottom: 0; left: 0; width: 16rem; height: 16rem; background: rgba(59, 130, 246, 0.1); margin: 0 0 -5rem -5rem; }

/* --- هدر فرم --- */
.form-header { position: relative; z-index: 10; padding: 1.25rem; text-align: center; border-bottom: 1px solid rgba(51, 65, 85, 0.5); background: rgba(15, 23, 42, 0.95); }
.header-title { font-size: 1.125rem; font-weight: 900; margin-bottom: 0.5rem; background: var(--voice-gradient); -webkit-background-clip: text; color: transparent; }
.progress-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--voice-text-muted); font-weight: bold; margin-bottom: 4px; padding: 0 4px; }
.progress-labels span.active { color: var(--voice-primary); }
.progress-track { height: 4px; background: #1e293b; border-radius: 9999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--voice-gradient); transition: width 0.5s ease-out; border-radius: 9999px; }

/* --- بدنه فرم --- */
.voice-scroll-area { flex: 1; overflow-y: auto; padding: 1.5rem; scrollbar-width: thin; scrollbar-color: #475569 #1e293b; position: relative; z-index: 1; }
.voice-scroll-area::-webkit-scrollbar { width: 6px; }
.voice-scroll-area::-webkit-scrollbar-track { background: #1e293b; }
.voice-scroll-area::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }

.step-content { display: none; opacity: 0; transform: translateY(10px); transition: opacity 0.3s ease, transform 0.3s ease; }
.step-content.active { display: block; opacity: 1; transform: translateY(0); }
.step-title { text-align: center; font-weight: bold; font-size: 1.125rem; margin-bottom: 1rem; color: white; }
.step-subtitle { text-align: center; color: var(--voice-text-muted); font-size: 0.75rem; margin-bottom: 1.5rem; }

/* --- کارت‌های گزینه --- */
.grid-options { display: grid; gap: 0.75rem; }
.grid-2-cols { grid-template-columns: repeat(2, 1fr); }
.option-card { display: flex; align-items:center; gap: 0.75rem; padding: 0.75rem; border-radius: 0.75rem; border: 1px solid var(--voice-border-light); background: var(--voice-bg-card); cursor: pointer; position: relative; overflow: hidden; transition: transform 0.1s, background 0.2s, border-color 0.2s; }
.option-card.vertical { flex-direction: column; text-align: center; padding: 1rem; align-items: center; justify-content: center; }
.option-card.vertical svg { width: 32px; height: 32px; margin-bottom: 0.5rem; color: var(--voice-text-muted); transition: color 0.2s; }
.option-card.vertical.selected svg { color: var(--voice-primary); }
@media (hover: hover) { .option-card:hover { background: var(--voice-bg-card-hover); border-color: rgba(168, 85, 247, 0.3); } }
.option-card:active { transform: scale(0.98); background: #334155; border-color: var(--voice-primary); }
.option-card.selected { border-color: var(--voice-primary); background: linear-gradient(135deg, rgba(88, 28, 135, 0.4), rgba(79, 70, 229, 0.4)); box-shadow: 0 4px 12px rgba(168, 85, 247, 0.2); }

/* --- آیکون‌ها --- */
.icon-box { width: 2.5rem; height: 2.5rem; border-radius: 9999px; background: #1e293b; border: 1px solid #334155; display: flex; align-items: center; justify-content: center; font-size: 1.125rem; flex-shrink: 0; }
.text-amber { color: #fbbf24; }
.text-blue { color: #60a5fa; }
.text-emerald { color: #34d399; }
.text-slate { color: #94a3b8; }
.text-red { color: #f87171; }
.bg-icon-amber { background: rgba(251, 191, 36, 0.2); color: #fbbf24; padding: 8px; border-radius: 8px; }
.bg-icon-blue { background: rgba(96, 165, 250, 0.2); color: #60a5fa; padding: 8px; border-radius: 8px; }
.bg-icon-slate { background: rgba(148, 163, 184, 0.2); color: #94a3b8; padding: 8px; border-radius: 8px; }
.bg-icon-red { background: rgba(248, 113, 113, 0.2); color: #f87171; padding: 8px; border-radius: 8px; }
.card-text-primary { font-weight: bold; font-size: 0.875rem; color: white; margin-bottom: 2px; }
.card-text-secondary { font-size: 10px; color: var(--voice-text-muted); }
.check-icon { opacity: 0; transform: scale(0); transition: all 0.3s; color: var(--voice-primary); margin-right: auto; }
.option-card.vertical .check-icon { position: absolute; top: 10px; right: 10px; margin: 0; }
.option-card.selected .check-icon { opacity: 1; transform: scale(1); }
.border-red-glow { border-color: rgba(239, 68, 68, 0.3); }
.border-red-glow:hover { border-color: rgba(239, 68, 68, 0.6); }

/* --- ورودی‌ها --- */
.input-group { position: relative; margin-bottom: 1rem; }
.input-icon { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); color: var(--voice-text-muted); }
.custom-input { width: 100%; background: #1e293b; border: 2px solid #334155; border-radius: 0.75rem; padding: 0.75rem 2.5rem 0.75rem 1rem; color: white; font-size: 0.875rem; outline: none; transition: border-color 0.2s; }
.custom-input:focus { border-color: var(--voice-primary); }
.privacy-notice { display: flex; align-items: center; gap: 0.75rem; background: rgba(168, 85, 247, 0.1); border: 1px solid rgba(168, 85, 247, 0.2); padding: 0.75rem; border-radius: 0.75rem; }
.privacy-notice i { color: var(--voice-primary); font-size: 1.125rem; }
.privacy-notice p { font-size: 10px; color: #cbd5e1; margin: 0; }

/* --- فوتر --- */
.form-footer { border-top: 1px solid rgba(51, 65, 85, 0.5); padding: 1.2rem; background: rgba(15, 23, 42, 0.98); display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 10; }
.btn-prev { color: var(--voice-text-muted); font-size: 0.75rem; font-weight: bold; background: none; border: none; padding: 0.5rem 0.75rem; cursor: pointer; border-radius: 0.5rem; }
.btn-prev:hover { color: white; background: #1e293b; }
.btn-prev.hidden { display: none; }
.btn-next { background: white; color: #0f172a; border: none; padding: 0.625rem 2rem; border-radius: 0.75rem; font-weight: 900; font-size: 0.875rem; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; transition: transform 0.1s; box-shadow: 0 0 15px rgba(255, 255, 255, 0.1); }
.btn-next:active { transform: scale(0.95); }
.btn-next.btn-submit { background: var(--voice-gradient); color: white; box-shadow: 0 4px 20px rgba(168, 85, 247, 0.4); }

/* --- نتیجه --- */
.result-box { text-align: center; padding: 1.5rem 0; }
.loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; min-height: 200px; }
.success-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; }

.loader { border: 4px solid #334155; border-top: 4px solid var(--voice-primary); border-radius: 50%; width: 3rem; height: 3rem; animation: spin 1s linear infinite; margin: 0 auto 1rem; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.success-icon { width: 6rem; height: 6rem; margin: 0 auto 1.5rem; background: linear-gradient(to top right, #10b981, #2dd4bf); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 3rem; color: white; box-shadow: 0 0 40px rgba(16, 185, 129, 0.4); animation: popIn 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards; }
@keyframes popIn { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.result-title { font-size: 1.5rem; font-weight: 900; margin-bottom: 0.5rem; color: white; }
.result-line { width: 4rem; height: 4px; background: #10b981; border-radius: 2px; margin: 0 auto 1.5rem; }
.result-msg-box { background: rgba(30, 41, 59, 0.5); padding: 1.25rem; border-radius: 1rem; border: 1px solid #334155; margin-bottom: 1.5rem; max-width: 24rem; margin-left: auto; margin-right: auto; }
.result-msg { font-size: 0.875rem; line-height: 1.6; color: #cbd5e1; }
.contact-box { display: flex; align-items: center; gap: 0.75rem; background: rgba(147, 51, 234, 0.2); border: 1px solid rgba(168, 85, 247, 0.3); padding: 0.75rem 1rem; border-radius: 0.75rem; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: 0.8; } }
.contact-text { text-align: right; }
.contact-text div:first-child { font-size: 10px; color: #d8b4fe; }
.contact-text div:last-child { font-size: 0.75rem; font-weight: bold; color: white; }

/* --- استایل‌های CTA --- */
.voice-cta-container { position: relative; width: 100%; max-width: 48rem; margin: 2rem auto; overflow: hidden; border-radius: 1.5rem; background-color: #0f172a !important; border: 1px solid #334155; padding: 1.5rem; font-family: 'Vazirmatn', sans-serif; text-align: right; direction: rtl; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
@media (min-width: 768px) { .voice-cta-container { padding: 2rem; } }
.cta-glow-bg { position: absolute; width: 16rem; height: 16rem; border-radius: 50%; filter: blur(80px); pointer-events: none; z-index: 0; }
.cta-glow-bg.top-right { top: 0; right: 0; background-color: rgba(147, 51, 234, 0.2); margin: -5rem -5rem 0 0; }
.cta-glow-bg.bottom-left { bottom: 0; left: 0; background-color: rgba(37, 99, 235, 0.1); margin: 0 0 -5rem -5rem; }
.voice-cta-content { position: relative; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 1.5rem; }
@media (min-width: 768px) { .voice-cta-content { flex-direction: row; text-align: right; } }
.cta-text-side { flex: 1; text-align: center; }
@media (min-width: 768px) { .cta-text-side { text-align: right; } }
.cta-badge { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.75rem; border-radius: 9999px; background-color: rgba(168, 85, 247, 0.1); border: 1px solid rgba(168, 85, 247, 0.2); margin-bottom: 0.75rem; }
.ping-dot { position: relative; display: flex; height: 0.5rem; width: 0.5rem; }
.ping-animate { position: absolute; display: inline-flex; height: 100%; width: 100%; border-radius: 50%; background-color: #34d399; opacity: 0.75; animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; }
@keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
.ping-static { position: relative; display: inline-flex; border-radius: 50%; height: 0.5rem; width: 0.5rem; background-color: #10b981; }
.badge-text { font-size: 0.75rem; color: #d8b4fe; font-weight: bold; }
.cta-title { font-size: 1.25rem; font-weight: 900; color: #ffffff !important; margin-bottom: 0.5rem; line-height: 1.25; }
@media (min-width: 768px) { .cta-title { font-size: 1.5rem; } }
.cta-desc { font-size: 0.875rem; color: #cbd5e1 !important; line-height: 1.6; margin-bottom: 0; }
@media (min-width: 768px) { .cta-desc { font-size: 1rem; } }
.cta-btn-side { width: 80%; flex-shrink: 0; }
@media (min-width: 768px) { .cta-btn-side { width: auto; } }
.cta-action-btn { position: relative; width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.75rem; background: linear-gradient(to right, #9333ea, #db2777); color: white; padding: 1rem; border-radius: 1rem; font-weight: bold; cursor: pointer; border: none; transition: all 0.3s; box-shadow: 0 10px 15px -3px rgba(88, 28, 135, 0.4); }
@media (min-width: 768px) { .cta-action-btn { width: auto; } }
.cta-action-btn:hover { background: linear-gradient(to right, #a855f7, #ec4899); }
.btn-text { font-size: 1.125rem; }
.btn-icon { transition: transform 0.3s; }
.cta-action-btn:hover .btn-icon { transform: translateX(-4px); }
.cta-sub-text { text-align: center; margin-top: 0.5rem; font-size: 10px; color: #64748b; }