/* ═══════════════════════════════════════════════════════════════
   NumeroVision AI — Voice Avatar Widget
   Theme: Deep cosmic / mystical Indian aesthetic
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Tiro+Devanagari+Hindi:ital@0;1&family=Cinzel:wght@600;700&display=swap');

:root {
    --nv-bg:        #07001a;
    --nv-surface:   #0e0028;
    --nv-border:    rgba(199, 125, 255, 0.18);
    --nv-purple:    #7b2ff7;
    --nv-gold:      #f5a623;
    --nv-pink:      #f107a3;
    --nv-text:      #e8d5ff;
    --nv-muted:     #7a6a9a;
    --nv-green:     #6effb4;
    --nv-red:       #ff6b8a;
    --nv-radius:    20px;
    --nv-glow:      0 0 40px rgba(123, 47, 247, 0.3);
}

/* ── Language toggle ────────────────────────────────────────────── */
.nv-lang-toggle {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 18px;
}

.nv-lang-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(199,125,255,0.2);
    border-radius: 20px;
    color: var(--nv-muted);
    font-size: 12px;
    padding: 5px 14px;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
    letter-spacing: 0.03em;
}

.nv-lang-btn:hover {
    background: rgba(123,47,247,0.15);
    border-color: rgba(123,47,247,0.4);
    color: var(--nv-text);
}

.nv-lang-btn.active {
    background: linear-gradient(135deg, rgba(123,47,247,0.35), rgba(241,7,163,0.2));
    border-color: var(--nv-purple);
    color: #fff;
    font-weight: 600;
}

/* Disable toggle during active call */
.nv-lang-btn:disabled,
.nv-phase-active .nv-lang-btn,
.nv-phase-connecting .nv-lang-btn {
    opacity: 0.35;
    pointer-events: none;
    cursor: not-allowed;
}

/* ── Widget container ──────────────────────────────────────────── */
.nv-widget {
    background: linear-gradient(160deg, #0d0025 0%, #07001a 50%, #12002e 100%);
    border: 1px solid var(--nv-border);
    border-radius: var(--nv-radius);
    padding: 32px 24px 28px;
    max-width: 480px;
    margin: 0 auto;
    font-family: 'Tiro Devanagari Hindi', Georgia, serif;
    color: var(--nv-text);
    position: relative;
    overflow: hidden;
    box-shadow: var(--nv-glow), 0 24px 64px rgba(0,0,0,0.6);
}

/* Stars background */
.nv-widget::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 70% 15%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 85% 60%, rgba(255,255,255,0.2) 0%, transparent 100%),
        radial-gradient(1px 1px at 10% 75%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 55% 85%, rgba(255,255,255,0.2) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 40% 50%, rgba(245,166,35,0.2) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.nv-widget > * { position: relative; z-index: 1; }

/* ── Avatar area ───────────────────────────────────────────────── */
.nv-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.nv-avatar-rings {
    position: absolute;
    width: 200px;
    height: 200px;
    pointer-events: none;
}

.nv-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(123, 47, 247, 0.2);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: nv-pulse-ring 3s ease-in-out infinite;
}
.nv-ring-1 { width: 140px; height: 140px; animation-delay: 0s; }
.nv-ring-2 { width: 170px; height: 170px; animation-delay: 0.6s; border-color: rgba(241,7,163,0.15); }
.nv-ring-3 { width: 200px; height: 200px; animation-delay: 1.2s; border-color: rgba(245,166,35,0.1); }

@keyframes nv-pulse-ring {
    0%, 100% { opacity: 0.4; transform: translate(-50%,-50%) scale(1); }
    50%       { opacity: 1;   transform: translate(-50%,-50%) scale(1.05); }
}

.nv-avatar {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #2a0060, #0a0020);
    border: 3px solid rgba(123, 47, 247, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 0 24px rgba(123,47,247,0.4), 0 0 60px rgba(123,47,247,0.1);
    overflow: hidden;
    cursor: default;
    margin-bottom: 12px;
}

/* Speaking state — avatar glows and pulses */
.nv-avatar.nv-speaking {
    border-color: var(--nv-gold);
    box-shadow: 0 0 30px rgba(245,166,35,0.5), 0 0 80px rgba(245,166,35,0.2);
    animation: nv-avatar-pulse 0.6s ease-in-out infinite alternate;
}

@keyframes nv-avatar-pulse {
    from { transform: scale(1); }
    to   { transform: scale(1.04); }
}

/* User speaking — subtle blue glow */
.nv-avatar.nv-user-speaking {
    border-color: #4fc3f7;
    box-shadow: 0 0 20px rgba(79,195,247,0.4);
}

.nv-face {
    width: 110px;
    height: 110px;
    position: relative;
    z-index: 2;
}

/* ── Sound wave ─────────────────────────────────────────────────── */
.nv-soundwave {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 24px;
    opacity: 0;
    transition: opacity 0.2s;
}

.nv-soundwave.nv-active {
    opacity: 1;
}

.nv-soundwave span {
    display: block;
    width: 3px;
    height: 4px;
    background: var(--nv-gold);
    border-radius: 2px;
    transition: height 0.08s ease;
}

.nv-avatar-name {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--nv-gold);
    letter-spacing: 0.05em;
    text-shadow: 0 0 20px rgba(245,166,35,0.4);
}

.nv-avatar-sub {
    font-size: 12px;
    color: var(--nv-muted);
    margin-top: 2px;
    letter-spacing: 0.08em;
}

/* ── Status bar ─────────────────────────────────────────────────── */
.nv-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--nv-muted);
    min-height: 22px;
}

.nv-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nv-muted);
    flex-shrink: 0;
}

.nv-status-dot.nv-status-connecting {
    background: var(--nv-gold);
    animation: nv-blink 0.8s ease-in-out infinite;
}

.nv-status-dot.nv-status-active {
    background: var(--nv-green);
    animation: nv-blink 2s ease-in-out infinite;
}

.nv-status-dot.nv-status-error {
    background: var(--nv-red);
}

@keyframes nv-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* ── Meta (credits + timer) ─────────────────────────────────────── */
.nv-meta {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 14px;
}

.nv-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--nv-muted);
}

.nv-meta-icon { font-size: 14px; }

/* ── Transcript ─────────────────────────────────────────────────── */
.nv-transcript {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--nv-border);
    border-radius: 12px;
    height: 160px;
    overflow-y: auto;
    margin-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--nv-purple) transparent;
}

.nv-transcript-inner {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 100%;
}

.nv-transcript-placeholder {
    color: var(--nv-muted);
    font-size: 13px;
    text-align: center;
    padding: 20px 0;
    font-style: italic;
}

.nv-msg {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 90%;
    animation: nv-msg-in 0.25s ease;
}

@keyframes nv-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nv-msg-user { align-self: flex-end; }
.nv-msg-jyoti, .nv-msg-system { align-self: flex-start; }

.nv-msg-name {
    font-size: 10px;
    color: var(--nv-muted);
    letter-spacing: 0.05em;
}

.nv-msg-text {
    background: rgba(123,47,247,0.2);
    border: 1px solid rgba(123,47,247,0.3);
    border-radius: 12px 12px 12px 2px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--nv-text);
    line-height: 1.5;
}

.nv-msg-user .nv-msg-text {
    background: rgba(245,166,35,0.15);
    border-color: rgba(245,166,35,0.3);
    border-radius: 12px 12px 2px 12px;
}

.nv-msg-system .nv-msg-text {
    background: rgba(110,255,180,0.08);
    border-color: rgba(110,255,180,0.2);
    font-style: italic;
    font-size: 12px;
    color: var(--nv-muted);
}

.nv-msg-live .nv-msg-text::after {
    content: '▋';
    animation: nv-blink 0.7s step-end infinite;
    color: var(--nv-gold);
}

/* ── Buttons ────────────────────────────────────────────────────── */
.nv-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.nv-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-family: 'Tiro Devanagari Hindi', Georgia, serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.nv-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.08);
    opacity: 0;
    transition: opacity 0.2s;
}

.nv-btn:hover::before { opacity: 1; }
.nv-btn:active { transform: scale(0.97); }

.nv-btn-start {
    background: linear-gradient(135deg, var(--nv-purple), var(--nv-pink));
    color: #fff;
    box-shadow: 0 4px 24px rgba(123,47,247,0.4);
}

.nv-btn-start:hover {
    box-shadow: 0 6px 32px rgba(123,47,247,0.6);
    transform: translateY(-1px);
}

.nv-btn-start:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.nv-btn-end {
    background: rgba(255,107,138,0.15);
    color: var(--nv-red);
    border: 1px solid rgba(255,107,138,0.4);
}

.nv-btn-end:hover {
    background: rgba(255,107,138,0.25);
}

.nv-btn-icon { font-size: 18px; }

/* ── Login notice ───────────────────────────────────────────────── */
.nv-login-notice {
    text-align: center;
    font-size: 13px;
    color: var(--nv-muted);
    margin-top: 12px;
}

.nv-login-notice a {
    color: var(--nv-gold);
    text-decoration: none;
}

/* ── Admin CSS (nv-admin.css inline here for single file) ────────── */
.nv-admin .nv-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px 24px;
    margin: 16px 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.nv-admin .nv-card h2 {
    margin: 0 0 16px;
    font-size: 15px;
    color: #7b2ff7;
    border-bottom: 1px solid #f0eaff;
    padding-bottom: 8px;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 520px) {
    .nv-widget { padding: 24px 16px 20px; }
    .nv-avatar { width: 110px; height: 110px; }
    .nv-face   { width: 94px; height: 94px; }
    .nv-btn    { padding: 12px 22px; font-size: 14px; }
    .nv-transcript { height: 130px; }
}
