/* ai-widget.css */
@import url('https://fonts.googleapis.com/css2?family=Noto+Nastaliq+Urdu:wght@400;700&family=Orbitron:wght@600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* Floating Container (Bottom Left, Horizontal Layout) */
.ai-widget-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 10000;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: opacity 0.25s ease;
}

/* The Circular Action Button */
.ai-widget-btn {
    width: 62px;
    height: 62px;
    background: #EFA23A;
    /* Brand primary */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 26px;
    box-shadow: 0 6px 20px rgba(239, 162, 58, 0.45);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 3px solid #ffffff;
    flex-shrink: 0;
}

.ai-widget-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 25px rgba(239, 162, 58, 0.65);
}

.ai-widget-btn.processing {
    background: #fcd34d;
    color: #b45309;
    cursor: wait;
    animation: aiPulseBtn 1s infinite;
}

.ai-widget-btn.active {
    background: #ef4444;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.45);
}

@keyframes aiPulseBtn {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.92;
    }

    50% {
        transform: scale(1.06);
        opacity: 1;
    }
}

/* The Expansion Box (Idle Text Pill) */
.ai-widget-content {
    background: var(--cream, #FDFBF6);
    border-radius: 30px;
    min-height: 50px;
    display: flex;
    align-items: center;
    padding: 6px 18px;
    box-shadow: 0 4px 18px rgba(28, 27, 24, 0.1);
    border: 1.5px solid #EFA23A;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ai-widget-content:hover {
    box-shadow: 0 6px 22px rgba(239, 162, 58, 0.25);
    transform: translateY(-1px);
}

/* Idle Text */
.ai-widget-text {
    color: var(--ink, #1C1B18);
    font-size: 13.5px;
    font-weight: 700;
    direction: ltr;
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
}

.ai-widget-text i {
    color: #EFA23A;
    font-size: 18px;
    animation: aiArrowBounce 1.5s infinite ease-in-out;
}

@keyframes aiArrowBounce {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(-4px);
    }
}

.ai-widget-text span {
    font-family: 'Noto Nastaliq Urdu', 'Noto Sans Arabic', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.9;
    padding-top: 4px;
    letter-spacing: -0.2px;
}

/* Responsive Pill on Mobile */
@media (max-width: 600px) {
    .ai-widget-container {
        bottom: max(20px, env(safe-area-inset-bottom + 10px));
        left: max(15px, env(safe-area-inset-left));
        gap: 10px;
    }
    .ai-widget-btn {
        width: 52px;
        height: 52px;
        font-size: 22px;
    }

    .ai-widget-content {
        max-width: calc(100vw - 90px);
        padding: 5px 12px;
        min-height: 46px;
    }

    .ai-widget-text {
        gap: 6px;
    }

    .ai-widget-text span {
        font-size: 11.5px;
        line-height: 1.6;
        white-space: normal;
    }
}

/* =========================================================
   FULLSCREEN ACTIVE CALL SCREEN (ZERO FLICKER GPU LAYER)
   ========================================================= */
.ai-call-screen-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 30px 20px 45px;
    box-sizing: border-box;

    /* Low Opacity Frosted Glass Background (Stable & GPU Accelerated) */
    background: rgba(10, 12, 18, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    overflow: hidden;
    user-select: none;
}

.ai-call-screen-overlay.active {
    display: flex;
}

/* Warm Ambient Glow Layer (Zero mouse flicker) */
.ai-call-screen-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(239, 162, 58, 0.15), rgba(121, 40, 202, 0.12) 50%, rgba(6, 8, 14, 0.4) 100%);
    pointer-events: none;
    z-index: 0;
}

/* Call HUD Top Header */
.ai-call-top-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    max-width: 900px;
    padding: 0 10px;
    pointer-events: none;
}

.ai-call-lang-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(239, 162, 58, 0.18);
    border: 1px solid rgba(239, 162, 58, 0.5);
    color: #EFA23A;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
    pointer-events: auto;
}

/* Center Status Text */
.ai-call-center-info {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: auto;
    margin-bottom: auto;
    pointer-events: none;
}

.ai-call-status {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    letter-spacing: 0.5px;
    font-family: 'Noto Nastaliq Urdu', 'Plus Jakarta Sans', sans-serif;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.7);
}

/* Soundwaves Canvas (Hardware Accelerated, Pointer-Events None) */
#aiWidgetCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
}

/* Bottom Bar & End Call Button */
.ai-call-bottom-bar {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    justify-content: center;
}

.ai-widget-stop-btn {
    background: #ef4444;
    color: #ffffff;
    border: none;
    border-radius: 35px;
    padding: 14px 34px;
    font-size: 16px;
    font-weight: 800;
    font-family: 'Plus Jakarta Sans', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 6px 25px rgba(239, 68, 68, 0.55);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-widget-stop-btn:hover {
    background: #dc2626;
    transform: scale(1.06);
    box-shadow: 0 8px 30px rgba(239, 68, 68, 0.75);
}

/* =========================================================
   CLEAN LUXURY POPUP (CENTERED, NO FLAGS, NO BADGE)
   ========================================================= */
.ai-clean-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100001;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ai-clean-overlay.show {
    display: flex;
    opacity: 1;
}

.ai-clean-popup {
    background: #ffffff;
    border-radius: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    transform: scale(0.92) translateY(15px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: #1C1B18;
}

.ai-clean-overlay.show .ai-clean-popup {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.ai-clean-popup::before {
    content: '';
    display: block;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #EFA23A 0%, #F59E0B 50%, #EFA23A 100%);
}

/* Header Centered */
.ai-clean-header {
    padding: 24px 24px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-align: center;
}

.ai-clean-header-content {
    text-align: center;
    width: 100%;
    padding: 0 28px;
}

.ai-clean-header h3 {
    font-size: 21px;
    font-weight: 800;
    color: #0F172A;
    margin: 0 0 4px;
    line-height: 1.4;
    text-align: center;
    font-family: 'Noto Nastaliq Urdu', 'Plus Jakarta Sans', sans-serif;
}

.ai-clean-header p {
    font-size: 13px;
    color: #64748B;
    margin: 0;
    font-weight: 500;
    text-align: center;
}

.ai-clean-close {
    position: absolute;
    top: 18px;
    right: 20px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #F1F5F9;
    border: none;
    color: #64748B;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.ai-clean-close:hover {
    background: #E2E8F0;
    color: #0F172A;
    transform: rotate(90deg);
}

/* Body */
.ai-clean-body {
    padding: 0 24px 24px;
    box-sizing: border-box;
}

/* Language Tiles Grid (Clean without flags) */
.ai-lang-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.ai-lang-tile {
    background: #F8FAFC;
    border: 1.5px solid #E2E8F0;
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    user-select: none;
}

.ai-lang-tile:hover {
    background: #FFFBEB;
    border-color: #FCD34D;
    transform: translateY(-1px);
}

.ai-lang-tile.active {
    background: #FFFBEB;
    border-color: #EFA23A;
    box-shadow: 0 4px 15px rgba(239, 162, 58, 0.2);
}

.ai-tile-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.ai-tile-name {
    font-size: 15px;
    font-weight: 700;
    color: #0F172A;
    line-height: 1.3;
}

.ai-tile-sub {
    font-size: 11px;
    color: #64748B;
    font-weight: 500;
}

.ai-tile-radio {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid #CBD5E1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 11px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ai-lang-tile.active .ai-tile-radio {
    background: #EFA23A;
    border-color: #EFA23A;
}

/* Compact Dropdown Select */
.ai-clean-select-box {
    position: relative;
    width: 100%;
    margin-bottom: 18px;
}

.ai-clean-select {
    width: 100%;
    background: #F8FAFC;
    border: 1.5px solid #E2E8F0;
    border-radius: 12px;
    padding: 10px 36px 10px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: #0F172A;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: all 0.2s ease;
}

.ai-clean-select:focus {
    border-color: #EFA23A;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(239, 162, 58, 0.15);
}

.ai-select-chevron {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748B;
    font-size: 14px;
    pointer-events: none;
}

/* Start Call CTA Button */
.ai-start-voice-btn {
    width: 100%;
    background: linear-gradient(135deg, #1C1B18 0%, #292823 100%);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    padding: 14px 20px;
    font-size: 15.5px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 6px 20px rgba(28, 27, 24, 0.25);
}

.ai-start-voice-btn:hover {
    background: linear-gradient(135deg, #EFA23A 0%, #f59e0b 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 162, 58, 0.4);
}

.ai-start-voice-btn i {
    font-size: 18px;
}

/* Footer note: Trained and powered by Raytrace team */
.ai-popup-powered {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #94A3B8;
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.ai-popup-powered i {
    color: #EFA23A;
    font-size: 14px;
}

/* Post-call Check badge */
.ai-postcall-check {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #ECFDF5;
    border: 2px solid #A7F3D0;
    color: #059669;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.15);
}

.ai-postcall-title {
    font-size: 20px;
    font-weight: 800;
    color: #0F172A;
    text-align: center;
    margin: 0 0 6px;
    font-family: 'Noto Nastaliq Urdu', 'Plus Jakarta Sans', sans-serif;
}

.ai-postcall-sub {
    font-size: 13px;
    color: #64748B;
    text-align: center;
    margin: 0 0 16px;
}

.ai-postcall-desc {
    font-size: 14px;
    line-height: 1.85;
    color: #334155;
    margin: 0 0 20px;
    font-family: 'Noto Nastaliq Urdu', 'Plus Jakarta Sans', sans-serif;
    text-align: center;
    padding: 0 8px;
}

.ai-post-cta {
    width: 100%;
    padding: 13px 18px;
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
    font-family: 'Plus Jakarta Sans', sans-serif;
    border: none;
    margin-bottom: 10px;
}

.ai-post-cta.primary {
    background: #EFA23A;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(239, 162, 58, 0.35);
}

.ai-post-cta.primary:hover {
    background: #e0942c;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(239, 162, 58, 0.5);
}

.ai-post-cta.whatsapp {
    background: #25D366;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.3);
}

.ai-post-cta.whatsapp:hover {
    background: #20bd5a;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
}

.ai-post-cta.dismiss {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    color: #64748B;
    font-size: 13.5px;
    font-weight: 600;
}

.ai-post-cta.dismiss:hover {
    background: #F1F5F9;
    color: #0F172A;
}

/* =========================================================
   ATTENTION SPOTLIGHT — highlights the widget on page load
   ========================================================= */

/* Dark dimmed backdrop with a transparent "hole" over the button */
.ai-spotlight-hole {
    position: fixed;
    bottom: 11px;
    left: 11px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(10, 12, 18, 0.55);
    z-index: 99997;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.ai-spotlight-hole.show {
    opacity: 1;
}

/* Radar-style pulsing rings around the button */
.ai-radar-ring {
    position: fixed;
    bottom: 11px;
    left: 11px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2.5px solid #EFA23A;
    z-index: 99998;
    pointer-events: none;
    opacity: 0;
}

.ai-radar-ring.show {
    animation: aiRadarPulse 2s ease-out infinite;
}

.ai-radar-ring.ring2.show {
    animation-delay: 1s;
}

@keyframes aiRadarPulse {
    0% {
        transform: scale(0.7);
        opacity: 0.9;
    }

    100% {
        transform: scale(1.9);
        opacity: 0;
    }
}

/* Callout tooltip pointing at the widget */
.ai-spotlight-tooltip {
    position: fixed;
    bottom: 118px;
    left: 20px;
    max-width: 250px;
    z-index: 100000;
    background: #ffffff;
    color: #1C1B18;
    padding: 14px 18px;
    border-radius: 16px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.28);
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.ai-spotlight-tooltip.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.ai-spotlight-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 34px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    transform: rotate(45deg);
}

.ai-spotlight-tooltip-text {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.9;
    font-family: 'Noto Nastaliq Urdu', 'Plus Jakarta Sans', sans-serif;
    display: block;
    text-align: right;
    direction: rtl;
}

.ai-spotlight-close {
    position: absolute;
    top: -9px;
    right: -9px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #1C1B18;
    color: #fff;
    border: 2px solid #fff;
    font-size: 13px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

@media (max-width: 600px) {

    .ai-spotlight-hole,
    .ai-radar-ring {
        bottom: 4px;
        left: 0px;
        width: 82px;
        height: 82px;
    }

    .ai-spotlight-tooltip {
        bottom: 92px;
        left: 12px;
        max-width: calc(100vw - 60px);
        padding: 12px 16px;
    }

    .ai-spotlight-tooltip-text {
        font-size: 12px;
        line-height: 1.7;
    }
}

@media (max-width: 480px) {
    .ai-clean-popup {
        border-radius: 20px;
    }

    .ai-clean-header {
        padding: 20px 16px 14px;
    }

    .ai-clean-header-content {
        padding: 0 15px;
    }

    .ai-clean-body {
        padding: 0 18px 20px;
    }

    .ai-lang-cards-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .ai-lang-tile {
        padding: 10px 12px;
    }

    .ai-tile-name {
        font-size: 14px;
    }

    .ai-tile-sub {
        font-size: 10.5px;
    }
}