/**
 * Taj Alwuqar — Realistic Live Dialogue Experience
 */

.taj-live-dialogue {
    --tl-gold: #b99655;
    --tl-gold-line: rgba(185, 150, 85, 0.28);
    --tl-gold-soft: rgba(185, 150, 85, 0.14);
    --tl-dark: #1a1a1a;
    --tl-muted: #5c5c5c;
    --tl-cream: #faf9f6;
    position: relative;
    width: 100%;
    margin: 0;
    padding: 40px 16px 52px !important;
    overflow: hidden;
    overflow-x: clip;
    background: var(--tl-cream);
}

.taj-live-dialogue-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 52% 42% at 50% 30%, rgba(185, 150, 85, 0.11), transparent 70%),
        linear-gradient(180deg, #fdfcfa 0%, #f5f1e9 50%, #fdfcfa 100%);
}

.taj-live-dialogue-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(185, 150, 85, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(185, 150, 85, 0.018) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 58% at 50% 32%, black 8%, transparent 74%);
    opacity: 0.55;
}

.taj-live-dialogue-inner {
    position: relative;
    z-index: 1;
    max-width: 1140px;
    margin: 0 auto;
    direction: ltr;
    unicode-bidi: isolate;
}

.taj-dialogue-header {
    margin: 0 0 18px;
    text-align: center;
    direction: rtl;
    font-size: clamp(1.15rem, 4.6vw, 1.5rem);
    font-weight: 800;
    color: var(--tl-dark);
    line-height: 1.35;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

.taj-dialogue-stage {
    margin-bottom: 12px;
}

.taj-dialogue-characters {
    display: grid;
    grid-template-columns: 1fr minmax(200px, 340px) 1fr;
    align-items: end;
    gap: 8px 12px;
    min-height: clamp(220px, 34vh, 320px);
}

.taj-dialogue-center-col {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    align-self: center;
    z-index: 4;
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.7s ease 0.08s, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.08s;
}

.taj-dialogue-logo-zone {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.taj-dialogue-logo-glow {
    position: absolute;
    width: clamp(80px, 18vw, 110px);
    height: clamp(80px, 18vw, 110px);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(185, 150, 85, 0.1), transparent 72%);
    filter: blur(8px);
    pointer-events: none;
}

.taj-dialogue-logo {
    position: relative;
    z-index: 1;
    width: clamp(74px, 18vw, 110px);
    height: auto;
    object-fit: contain;
    background: transparent;
}

.taj-dialogue-character {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    opacity: 0;
    transform: translateY(24px) scale(0.96);
    transition:
        opacity 0.55s ease,
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.5s ease;
    filter: saturate(0.95) brightness(0.98);
    will-change: transform, opacity, filter;
}

.taj-dialogue-client {
    grid-column: 1;
    justify-content: flex-end;
    transform: translateX(-20px) translateY(24px) scale(0.96);
}

.taj-dialogue-advisor {
    grid-column: 3;
    justify-content: flex-start;
    transform: translateX(20px) translateY(24px) scale(0.96);
}

.taj-character-wrap {
    transform-origin: 50% 92%;
    line-height: 0;
    background: transparent;
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), filter 0.5s ease;
}

.taj-character-wrap.is-idle {
    animation: tlIdle 3.4s ease-in-out infinite alternate;
}

.taj-dialogue-character.taj-speaking {
    opacity: 1;
    transform: scale(1.06) translateY(-8px);
    filter: saturate(1.05) contrast(1.02) brightness(1.02);
    z-index: 3;
}

.taj-dialogue-character.taj-speaking .taj-character-wrap {
    animation: tlSpeakPulse 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.taj-dialogue-character.taj-listening {
    opacity: 0.9;
    transform: scale(0.97) translateY(0);
    filter: saturate(0.88) brightness(0.94);
    z-index: 1;
}

.taj-dialogue-character.taj-listening .taj-character-wrap {
    animation: tlListen 2.5s ease-in-out infinite alternate;
}

.taj-thinking-dots {
    position: absolute;
    top: 4%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
    z-index: 4;
}

.taj-dialogue-character.taj-thinking .taj-thinking-dots {
    opacity: 1;
}

.taj-thinking-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(185, 150, 85, 0.6);
    animation: tlThinkDot 1.5s ease-in-out infinite;
}

.taj-thinking-dots span:nth-child(2) { animation-delay: 0.18s; }
.taj-thinking-dots span:nth-child(3) { animation-delay: 0.36s; }

.taj-dialogue-client-img,
.taj-dialogue-advisor-img {
    display: block;
    width: auto;
    max-width: 100%;
    height: clamp(180px, 24vh, 250px);
    object-fit: contain;
    object-position: bottom center;
    background: transparent;
    user-select: none;
    pointer-events: none;
}

.taj-dialogue-client-img { transform: none; }
.taj-dialogue-advisor-img { transform: scaleX(-1); }

/* —— Dialogue Card (center scene) —— */
.taj-dialogue-card {
    width: 100%;
    margin: 0;
    padding: 14px 16px 16px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--tl-gold-line);
    border-radius: 18px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.07);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    direction: rtl;
    text-align: center;
}

.taj-dialogue-card.is-transitioning {
    opacity: 1;
}

.taj-speaker-label {
    margin: 0 0 8px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    color: var(--tl-gold);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.taj-dialogue-text-wrap {
    width: 100%;
    min-height: 1.6em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.taj-dialogue-text-wrap.is-exiting {
    opacity: 0;
    transform: translateY(-8px);
}

.taj-dialogue-text {
    margin: 0;
    width: 100%;
    font-size: clamp(12px, 3.1vw, 16px);
    line-height: 1.45;
    font-weight: 600;
    color: var(--tl-dark);
    text-align: center;
    white-space: nowrap;
}

.taj-dialogue-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(12px);
    filter: blur(4px);
    animation: tlWordReveal 0.56s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.taj-typewriter-cursor {
    display: none;
}

.taj-speaker-label--client {
    color: var(--tl-muted);
}

@keyframes tlWordReveal {
    from {
        opacity: 0;
        transform: translateY(12px);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

.taj-dialogue-progress {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
}

.taj-dialogue-progress span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(185, 150, 85, 0.2);
    transition: background 0.35s ease, transform 0.35s ease;
}

.taj-dialogue-progress span.is-active {
    background: var(--tl-gold);
    transform: scale(1.25);
}

.taj-dialogue-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 720px;
    margin: 14px auto 0;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.taj-dialogue-options.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.taj-dialogue-option {
    appearance: none;
    border: 1px solid var(--tl-gold-line);
    background: rgba(255, 255, 255, 0.75);
    border-radius: 16px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--tl-dark);
    cursor: pointer;
    transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.taj-dialogue-option:active { transform: scale(0.98); }

.taj-dialogue-option-active {
    background: rgba(185, 150, 85, 0.14);
    border-color: rgba(185, 150, 85, 0.9);
    box-shadow: 0 10px 24px rgba(185, 150, 85, 0.15);
}

.taj-dialogue-foot {
    margin-top: 16px;
    text-align: center;
    direction: rtl;
}

.taj-dialogue-note {
    margin: 0 0 12px;
    font-size: 0.84rem;
    line-height: 1.65;
    color: var(--tl-muted);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.taj-dialogue-note.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.taj-dialogue-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 26px;
    border-radius: 999px;
    background: var(--tl-dark);
    color: #fff !important;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none !important;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.taj-dialogue-cta.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Entrance */
.taj-live-dialogue.is-live .taj-dialogue-header {
    opacity: 1;
    transform: translateY(0);
}

.taj-live-dialogue.is-live .taj-dialogue-center-col {
    opacity: 1;
    transform: scale(1);
}

.taj-live-dialogue.is-live .taj-dialogue-client,
.taj-live-dialogue.is-live .taj-dialogue-advisor {
    opacity: 0.9;
    transform: scale(0.97) translate(0);
}

.taj-live-dialogue.is-live .taj-dialogue-character.taj-speaking {
    opacity: 1;
    transform: scale(1.06) translateY(-8px);
    filter: saturate(1.05) contrast(1.02) brightness(1.02);
    z-index: 3;
}

.taj-live-dialogue.is-live .taj-dialogue-character.taj-listening {
    opacity: 0.9;
    transform: scale(0.97) translateY(0);
    filter: saturate(0.88) brightness(0.94);
    z-index: 1;
}

@keyframes tlIdle {
    from { transform: translateY(0) scale(1); }
    to { transform: translateY(-4px) scale(1.01); }
}

@keyframes tlSpeakPulse {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.02); }
    100% { transform: translateY(0) scale(1); }
}

@keyframes tlListen {
    from { transform: translateY(0) rotate(0deg); }
    to { transform: translateY(-2px) rotate(0.4deg); }
}

@keyframes tlThinkDot {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
}

/* —— Mobile: logo between characters, dialogue card below —— */
@media (max-width: 767px) {
    .taj-live-dialogue {
        padding: 28px 12px 40px !important;
    }

    .taj-dialogue-header {
        margin-bottom: 12px;
        font-size: clamp(1.05rem, 4.8vw, 1.2rem);
        padding: 0 4px;
    }

    .taj-dialogue-stage {
        margin-bottom: 6px;
    }

    .taj-dialogue-characters {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas: "client advisor";
        grid-template-rows: auto auto;
        align-items: end;
        justify-items: center;
        position: relative;
        gap: 10px 4px;
        min-height: clamp(200px, 48vw, 270px);
        padding-bottom: 0;
    }

    .taj-dialogue-client {
        grid-area: client;
        grid-column: auto;
        grid-row: 1;
        justify-content: center;
        justify-self: end;
        width: 100%;
        transform: translateY(20px) scale(0.96);
    }

    .taj-dialogue-advisor {
        grid-area: advisor;
        grid-column: auto;
        grid-row: 1;
        justify-content: center;
        justify-self: start;
        width: 100%;
        transform: translateY(20px) scale(0.96);
    }

    .taj-dialogue-center-col {
        display: contents;
        opacity: 1;
        transform: none;
        transition: none;
    }

    .taj-live-dialogue.is-live .taj-dialogue-center-col {
        transform: none;
    }

    .taj-dialogue-logo-zone {
        position: absolute;
        left: 50%;
        top: 38%;
        transform: translate(-50%, -50%) scale(0.92);
        z-index: 6;
        width: auto;
        margin: 0;
        opacity: 0;
        transition: opacity 0.65s ease 0.08s, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.08s;
    }

    .taj-live-dialogue.is-live .taj-dialogue-logo-zone {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    .taj-dialogue-card {
        grid-column: 1 / -1;
        grid-row: 2;
        position: relative;
        width: min(92vw, 340px);
        margin: 0 auto;
        padding: 13px 14px 15px;
        border-radius: 16px;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.06);
        opacity: 0;
        transform: translateY(14px);
        transition: opacity 0.6s ease 0.14s, transform 0.6s ease 0.14s;
        z-index: 5;
    }

    .taj-live-dialogue.is-live .taj-dialogue-card {
        opacity: 1;
        transform: translateY(0);
    }

    .taj-dialogue-client-img,
    .taj-dialogue-advisor-img {
        height: clamp(190px, 46vw, 260px);
        max-width: 108%;
    }

    .taj-dialogue-logo {
        width: clamp(52px, 13vw, 68px);
        margin: 0 auto;
    }

    .taj-dialogue-logo-glow {
        width: clamp(64px, 16vw, 80px);
        height: clamp(64px, 16vw, 80px);
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    .taj-speaker-label {
        font-size: 0.58rem;
        margin-bottom: 6px;
        text-align: center;
    }

    .taj-dialogue-text {
        font-size: clamp(13px, 3.7vw, 15px);
        line-height: 1.5;
        white-space: normal;
        text-align: center;
    }

    .taj-dialogue-progress {
        margin-top: 10px;
    }

    .taj-dialogue-options {
        max-width: 100%;
        gap: 8px;
        margin-top: 10px;
    }

    .taj-dialogue-option {
        padding: 10px 10px;
        font-size: 0.82rem;
        border-radius: 12px;
    }

    .taj-dialogue-foot {
        margin-top: 12px;
    }

    .taj-live-dialogue.is-live .taj-dialogue-client,
    .taj-live-dialogue.is-live .taj-dialogue-advisor {
        transform: scale(0.97) translate(0);
    }

    .taj-dialogue-character.taj-speaking,
    .taj-live-dialogue.is-live .taj-dialogue-character.taj-speaking {
        transform: scale(1.03) translateY(-4px);
    }

    .taj-dialogue-character.taj-listening,
    .taj-live-dialogue.is-live .taj-dialogue-character.taj-listening {
        transform: scale(0.96) translateY(0);
    }
}

@media (min-width: 768px) {
    .taj-dialogue-characters {
        grid-template-columns: 1fr minmax(260px, 380px) 1fr;
        gap: 12px 20px;
    }

    .taj-dialogue-center-col {
        gap: 14px;
    }

    .taj-dialogue-card {
        padding: 18px 20px 20px;
        border-radius: 22px;
    }

    .taj-dialogue-text {
        font-size: clamp(13px, 2vw, 17px);
    }

    .taj-dialogue-client-img,
    .taj-dialogue-advisor-img {
        height: clamp(300px, 36vh, 420px);
    }

    .taj-dialogue-logo {
        width: clamp(96px, 12vw, 120px);
    }
}

@media (min-width: 1024px) {
    .taj-live-dialogue {
        padding: 56px 32px 64px !important;
    }

    .taj-dialogue-characters {
        gap: 16px 28px;
        min-height: clamp(380px, 50vh, 520px);
        grid-template-columns: 1fr minmax(300px, 420px) 1fr;
    }

    .taj-dialogue-center-col {
        gap: 18px;
    }

    .taj-dialogue-client-img,
    .taj-dialogue-advisor-img {
        height: clamp(420px, 52vh, 620px);
    }

    .taj-dialogue-logo {
        width: clamp(110px, 9vw, 140px);
    }

    .taj-dialogue-logo-glow {
        width: clamp(140px, 12vw, 180px);
        height: clamp(140px, 12vw, 180px);
    }

    .taj-dialogue-card {
        padding: 22px 24px;
        border-radius: 24px;
    }

    .taj-dialogue-options {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .taj-dialogue-option:hover {
        transform: translateY(-2px);
        border-color: rgba(185, 150, 85, 0.5);
    }
}

@media (max-width: 380px) {
    .taj-dialogue-client-img,
    .taj-dialogue-advisor-img {
        height: clamp(175px, 44vw, 220px);
    }

    .taj-dialogue-logo { width: 44px; }
    .taj-dialogue-card { padding: 12px; }
    .taj-dialogue-text { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
    .taj-character-wrap.is-idle,
    .taj-dialogue-character.taj-speaking .taj-character-wrap,
    .taj-dialogue-character.taj-listening .taj-character-wrap,
    .taj-thinking-dots span,
    .taj-dialogue-word {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }

    .taj-live-dialogue.is-reduced .taj-dialogue-header,
    .taj-live-dialogue.is-reduced .taj-dialogue-center-col,
    .taj-live-dialogue.is-reduced .taj-dialogue-logo-zone,
    .taj-live-dialogue.is-reduced .taj-dialogue-card,
    .taj-live-dialogue.is-reduced .taj-dialogue-character,
    .taj-live-dialogue.is-reduced .taj-dialogue-options,
    .taj-live-dialogue.is-reduced .taj-dialogue-cta,
    .taj-live-dialogue.is-reduced .taj-dialogue-note {
        opacity: 1 !important;
        transform: none !important;
        pointer-events: auto !important;
    }

    @media (max-width: 767px) {
        .taj-live-dialogue.is-reduced .taj-dialogue-logo-zone {
            transform: translate(-50%, -50%) !important;
        }
    }
}
