/* ============================================================
   BASE RESET & BODY
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(166, 153, 255, 0.24), transparent 32%),
        radial-gradient(circle at right 20%, rgba(118, 75, 162, 0.18), transparent 26%),
        linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    background: rgba(255,255,255,0.86);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    box-shadow: 0 22px 60px rgba(83, 98, 125, 0.18);
    padding: 24px;
}

/* ============================================================
   INLINE ALERTS
   ============================================================ */
.inline-alert {
    margin: 16px 0;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    border: 1px solid transparent;
}

.inline-alert.error {
    background: #fdecea;
    border-color: #f5c2c7;
    color: #8a1c1c;
}

.inline-alert.warning {
    background: #fff4e5;
    border-color: #f1d1a7;
    color: #7a4b00;
}

/* ============================================================
   ONBOARDING CHAT (text mode)
   ============================================================ */
.chat-container {
    max-width: 700px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(102,126,234,0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 600px;
    max-height: calc(100vh - 80px);
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 28px 24px 22px;
    text-align: center;
}

.chat-header-icon {
    font-size: 2rem;
    margin-bottom: 6px;
}

.chat-header h1 {
    color: white;
    font-size: 22px;
    margin-bottom: 6px;
    font-weight: 700;
}

.chat-header .subtitle {
    color: rgba(255,255,255,0.88);
    font-size: 13px;
    margin: 0;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px;
    background: #f7f8fc;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.message {
    display: flex;
    gap: 10px;
    animation: slideIn 0.28s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bot-message { align-items: flex-start; }
.user-message { align-items: flex-end; flex-direction: row-reverse; }

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.bot-message .message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 0 12px 12px 12px;
    max-width: 72%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    color: #333;
    font-size: 14px;
    line-height: 1.6;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 12px 0 12px 12px;
    max-width: 72%;
    font-size: 14px;
    line-height: 1.6;
}

.message-content p { margin: 0 0 6px; }
.message-content p:last-child { margin-bottom: 0; }

/* Chat options (text mode) */
.chat-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.chat-option-btn {
    background: white;
    border: 2px solid #e0e0e0;
    padding: 10px 14px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #333;
}

.chat-option-btn:hover {
    border-color: #667eea;
    background: #f4f3ff;
    transform: translateX(3px);
}

/* Chat input */
.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    background: white;
    border-top: 1px solid #ececec;
}

.chat-input {
    flex: 1;
    padding: 11px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    transition: border-color 0.25s;
    outline: none;
}

.chat-input:focus { border-color: #667eea; }
.chat-input:disabled { background: #f5f5f5; cursor: not-allowed; }

.chat-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

.chat-send-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============================================================
   TRANSLATION LOADING
   ============================================================ */
.translation-loading-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(102,126,234,0.12);
    padding: 52px 32px;
    max-width: 540px;
    margin: 0 auto;
    text-align: center;
}

.translation-loading-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.translation-loading-card h2 {
    color: #2c3e50;
    font-size: 26px;
    margin-bottom: 28px;
    font-weight: 700;
}

.spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto;
    border: 5px solid #f0f0f0;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 17px;
    color: #34495e;
    margin: 20px 0 6px;
    font-weight: 500;
}

.loading-subtext {
    font-size: 13px;
    color: #7f8c8d;
    margin-bottom: 28px;
}

#translating-language {
    font-weight: 700;
    color: #667eea;
}

.progress-bar-container {
    width: 100%;
    height: 7px;
    background: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
}

.translation-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.loading-spinner-large { margin: 20px auto; }

/* ============================================================
   CHAT-MODE QUESTIONNAIRE
   ============================================================ */
#questionnaire-section {
    max-width: 860px;
    margin: 0 auto;
}

.progress-container {
    background: white;
    padding: 18px 20px;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: #888;
    font-size: 13px;
    margin: 0;
}

.question-container {
    background: white;
    padding: 30px;
    border-radius: 14px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    min-height: 380px;
}

.question-card { animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.question-header {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.question-badge {
    display: inline-block;
    padding: 5px 12px;
    background: #667eea;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.question-type-badge {
    display: inline-block;
    padding: 5px 12px;
    background: #f0f0f0;
    color: #666;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.question-text {
    color: #2d2446;
    font-size: 18px;
    line-height: 1.65;
    margin-bottom: 24px;
    font-weight: 500;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.option-item {
    border: 2px solid #e4e4e4;
    border-radius: 10px;
    transition: all 0.18s;
}

.option-item:hover { border-color: #667eea; background: #f7f6ff; }

.option-label {
    display: flex;
    align-items: flex-start;
    padding: 14px 16px;
    cursor: pointer;
    gap: 12px;
}

.option-label input[type="checkbox"],
.option-label input[type="radio"] {
    margin-top: 3px;
    width: 17px;
    height: 17px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #667eea;
}

.option-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.option-text { color: #333; font-size: 14px; line-height: 1.5; }

.option-code {
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: #aaa;
    background: #f7f7f7;
    padding: 1px 6px;
    border-radius: 3px;
    display: inline-block;
    width: fit-content;
}

.navigation-buttons {
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

/* Buttons */
.btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(102,126,234,0.38);
}

.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary { background: #f0f0f0; color: #555; }
.btn-secondary:hover:not(:disabled) { background: #e4e4e4; }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-danger {
    background: #e53935;
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger:hover { background: #c62828; }

.loading-spinner {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 15px;
}

/* ============================================================
   VOICE SECTION — OUTER WRAP & TOP BAR
   ============================================================ */
.voice-outer-wrap {
    max-width: 1160px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: linear-gradient(180deg, #f5f2ff 0%, #edf0ff 100%);
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(118, 75, 162, 0.16);
    box-shadow: 0 18px 46px rgba(102, 126, 234, 0.18);
    min-height: clamp(560px, calc(100vh - 80px), 900px);
    height: auto;
}

.voice-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.voice-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-topbar-icon { font-size: 1.4rem; }

.voice-topbar-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.btn-end-call {
    background: rgba(255,255,255,0.18);
    color: white;
    border: 1.5px solid rgba(255,255,255,0.5);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-end-call:hover { background: rgba(255,255,255,0.28); }

/* Stages */
.voice-stage {
    padding: 24px;
    flex: 1;
    min-height: 0;
    overflow-y: visible;
}

.voice-stage-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 1fr);
    gap: 22px;
    align-items: stretch;
    height: 100%;
}

.voice-presence-panel,
.voice-conversation-panel {
    min-height: 0;
    min-width: 0;
}

.voice-presence-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
}

.voice-conversation-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    background: rgba(255,255,255,0.72);
    border: 1px solid rgba(118, 75, 162, 0.16);
    border-radius: 22px;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.voice-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #5b4f84;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.voice-avatar-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 22px;
    background: linear-gradient(180deg, #fdfcff 0%, #ffffff 100%);
    border: 1px solid rgba(118, 75, 162, 0.14);
    border-radius: 22px;
    text-align: center;
    box-shadow: 0 12px 28px rgba(102, 126, 234, 0.1);
}

.voice-avatar-orb {
    width: 122px;
    height: 122px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,0.95), rgba(255,255,255,0.15) 32%, transparent 34%),
        linear-gradient(135deg, #667eea 0%, #8f66d9 52%, #764ba2 100%);
    box-shadow: 0 18px 35px rgba(102, 126, 234, 0.28);
    position: relative;
    transition: transform 0.28s ease, box-shadow 0.28s ease, filter 0.28s ease;
}

.voice-avatar-orb::after {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px solid rgba(118, 75, 162, 0.22);
}

.voice-avatar-face {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.9);
    color: #5d47a5;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.voice-avatar-name {
    color: #2d2446;
    font-size: 18px;
    font-weight: 700;
}

.voice-avatar-copy {
    color: #6f6794;
    font-size: 14px;
    line-height: 1.6;
    max-width: 320px;
}

/* ============================================================
   VOICE CONVERSATION BUBBLES
   ============================================================ */
.voice-convo-bubbles {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 180px;
    width: 100%;
    overflow-y: auto;
    padding-right: 6px;
    scroll-behavior: smooth;
}

.assessment-bubbles {
    min-height: 200px;
}

.voice-bubble {
    display: flex;
    gap: 10px;
    width: 100%;
    animation: slideIn 0.25s ease;
}

.voice-bubble.agent { align-items: flex-start; }
.voice-bubble.user  { align-items: flex-end; flex-direction: row-reverse; }

.voice-bubble-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.voice-bubble-text {
    padding: 11px 15px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    width: fit-content;
    min-width: min(160px, 60%);
    max-width: min(78%, 560px);
    word-break: break-word;
}

.voice-bubble.agent .voice-bubble-text {
    background: white;
    color: #2d2446;
    border-radius: 0 14px 14px 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.07);
}

.voice-bubble.user .voice-bubble-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 14px 0 14px 14px;
}

.voice-bubble-text.partial {
    opacity: 0.62;
    font-style: italic;
}

/* ============================================================
   VOICE ONBOARDING — OPTION TAGS
   ============================================================ */
.voice-option-tags-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
    padding: 18px;
    background: rgba(255,255,255,0.84);
    border-radius: 20px;
    border: 1px solid rgba(118, 75, 162, 0.16);
}

.voice-option-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.voice-option-tag {
    padding: 10px 20px;
    border: 2px solid #c5bcf5;
    border-radius: 50px;
    background: white;
    color: #4a3a8c;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
    user-select: none;
}

.voice-option-tag:hover {
    border-color: #667eea;
    background: #f0eeff;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(102,126,234,0.18);
}

.voice-option-tag.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(102,126,234,0.35);
    transform: translateY(-1px);
}

.btn-confirm-selection {
    padding: 11px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 12px rgba(102,126,234,0.3);
}

.btn-confirm-selection:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 18px rgba(102,126,234,0.42);
}

/* ============================================================
   VOICE ONBOARDING — TEXT INPUT
   ============================================================ */
.voice-text-input-wrap {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 18px;
    background: rgba(255,255,255,0.84);
    border-radius: 20px;
    border: 1px solid rgba(118, 75, 162, 0.16);
}

.voice-text-input {
    flex: 1;
    padding: 13px 18px;
    border: 2px solid #c5bcf5;
    border-radius: 50px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: #2d2446;
    background: white;
}

.voice-text-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
}

.voice-text-submit-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    box-shadow: 0 3px 10px rgba(102,126,234,0.3);
}

.voice-text-submit-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 5px 16px rgba(102,126,234,0.4);
}

/* ============================================================
   VOICE ASSESSMENT STAGE
   ============================================================ */
.voice-progress-bar-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Question card */
.voice-question-card {
    background: white;
    border: 1px solid rgba(118, 75, 162, 0.16);
    border-radius: 22px;
    padding: 22px 24px;
    box-shadow: 0 10px 24px rgba(102, 126, 234, 0.1);
    animation: fadeIn 0.3s ease;
    min-width: 0;
}

.voice-question-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.voice-question-text {
    font-size: 18px;
    font-weight: 600;
    color: #2d2446;
    line-height: 1.6;
    margin-bottom: 18px;
}

/* ── Clickable option tags inside question card ── */
.voice-question-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    width: 100%;
    min-width: 0;
}

.voice-question-option-tag {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 9px 18px;
    border: 1.5px solid #d4cdf5;
    border-radius: 50px;
    background: #faf9ff;
    color: #4a3a8c;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.17s;
    user-select: none;
    line-height: 1.35;
    max-width: 100%;
    white-space: normal;
    text-align: left;
    overflow-wrap: anywhere;
}

.voice-option-code {
    font-size: 10px;
    line-height: 1.1;
    letter-spacing: 0.03em;
    opacity: 0.72;
    font-weight: 700;
}

.voice-option-text {
    font-size: 13.5px;
    line-height: 1.35;
}

.voice-question-option-tag:hover {
    border-color: #667eea;
    background: #eeecff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(102,126,234,0.16);
}

.voice-question-option-tag.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(102, 126, 234, 0.28);
    transform: translateY(-1px);
}

.voice-question-option-tag.selected .voice-option-code {
    opacity: 0.88;
}

.voice-question-option-tag.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Question action row */
.voice-question-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.btn-voice-continue {
    padding: 10px 26px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 10px rgba(102,126,234,0.28);
}

.btn-voice-continue:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(102,126,234,0.4);
}

.btn-voice-continue:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.voice-speak-hint {
    font-size: 12.5px;
    color: #999;
}

.voice-speak-hint em {
    color: #764ba2;
    font-style: italic;
    font-weight: 500;
}

/* ── Mic / status indicator ── */
.voice-listen-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: rgba(255,255,255,0.9);
    border-radius: 18px;
    border: 1px solid rgba(118, 75, 162, 0.16);
    box-shadow: 0 8px 20px rgba(102,126,234,0.1);
}

.voice-listen-row.compact {
    align-self: stretch;
}

.voice-listen-row.mobile-status {
    display: none;
}

.voice-status-indicator {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.voice-pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    transition: all 0.3s;
}

.voice-mic-icon { font-size: 1.5rem; z-index: 1; }

/* State colours */
.voice-status-indicator.idle       .voice-pulse-ring { border-color: #ccc; }
.voice-status-indicator.connected  .voice-pulse-ring { border-color: #4caf50; }
.voice-status-indicator.listening  .voice-pulse-ring {
    border-color: #2196F3;
    animation: voice-pulse 1.1s infinite;
}
.voice-status-indicator.speaking   .voice-pulse-ring {
    border-color: #764ba2;
    animation: voice-pulse 0.75s infinite;
}
.voice-status-indicator.thinking   .voice-pulse-ring {
    border-color: #ff9800;
    animation: voice-pulse 1.4s infinite;
}
.voice-status-indicator.loading    .voice-pulse-ring {
    border-color: #9e9e9e;
    animation: voice-pulse 1.9s infinite;
}
.voice-status-indicator.error      .voice-pulse-ring { border-color: #f44336; }

@keyframes voice-pulse {
    0%   { transform: scale(1);    opacity: 1; }
    50%  { transform: scale(1.28); opacity: 0.55; }
    100% { transform: scale(1);    opacity: 1; }
}

.voice-status-text {
    font-size: 13.5px;
    color: #666;
    font-weight: 500;
}

.voice-avatar-orb.speaking {
    transform: scale(1.06);
    filter: saturate(1.12);
    box-shadow: 0 24px 42px rgba(102, 126, 234, 0.34);
}

.voice-avatar-orb.listening,
.voice-avatar-orb.thinking {
    transform: scale(1.03);
}

.voice-avatar-orb.error {
    filter: grayscale(0.08);
}

/* ============================================================
   ADMIN / DASHBOARD STYLES (preserved)
   ============================================================ */
.container-dashboard {
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    padding: 40px;
}

header { text-align: center; margin-bottom: 40px; }
h1 { color: #333; margin-bottom: 10px; }
header p { color: #666; font-size: 14px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: #333; font-weight: 500; }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: #667eea; }

.btn-info  { background: #17a2b8; color: white; }
.btn-small { padding: 6px 12px; font-size: 14px; }
.btn-success { background: #28a745; color: white; }

.login-box { max-width: 400px; margin: 100px auto; }

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

.login-hint { text-align: center; color: #666; font-size: 12px; margin-top: 15px; }

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
}

.stat-card h3 { font-size: 14px; margin-bottom: 10px; opacity: 0.9; }
.stat-number { font-size: 36px; font-weight: bold; }

.table-container { overflow-x: auto; }

.assessments-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.assessments-table th,
.assessments-table td { padding: 12px; text-align: left; border-bottom: 1px solid #e0e0e0; }
.assessments-table th { background: #f8f9fa; font-weight: 600; color: #333; }
.assessments-table tr:hover { background: #f8f9ff; }

.diagnosis-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #667eea;
    color: white;
    border-radius: 20px;
    font-size: 12px;
}

.language-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.no-data { text-align: center; color: #999; padding: 40px; }

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 10px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close { position: absolute; right: 20px; top: 20px; font-size: 28px; font-weight: bold; cursor: pointer; color: #999; }
.close:hover { color: #333; }
.modal-content h2 { margin-bottom: 20px; color: #333; }
.modal-content h3 { margin-top: 25px; margin-bottom: 15px; color: #667eea; }
.modal-content pre { background: #f8f9fa; padding: 15px; border-radius: 5px; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word; }

details { margin-top: 15px; }
summary { cursor: pointer; color: #667eea; font-weight: 500; padding: 10px; background: #f8f9ff; border-radius: 5px; }

.response-code { font-family: 'Courier New', monospace; background: #f8f9fa; padding: 2px 6px; border-radius: 3px; font-size: 11px; color: #666; }
.response-value-A { background: #d4edda; color: #155724; }
.response-value-D { background: #f8d7da; color: #721c24; }
.response-value-N { background: #fff3cd; color: #856404; }
.response-value-S,
.response-value-W,
.response-value-UN { background: #d1ecf1; color: #0c5460; }

/* Thank-you page */
.thank-you-message { text-align: center; padding: 60px 20px; }
.success-icon {
    width: 80px; height: 80px;
    background: #28a745; color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 48px; margin: 0 auto 30px;
}
.thank-you-message h1 { color: #333; margin-bottom: 20px; }
.thank-you-message p { color: #666; margin-bottom: 15px; line-height: 1.6; }

/* Meta badges */
.meta-badge {
    display: inline-block;
    padding: 5px 12px;
    background: #e8eaf6;
    color: #5568d3;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */

/* Enable scroll on panels that need it */
.voice-convo-bubbles,
.assessment-bubbles {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c5bcf5 #f0eeff;
}

.voice-conversation-panel {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c5bcf5 #f0eeff;
}

.voice-presence-panel {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c5bcf5 #f0eeff;
}

.voice-stage {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c5bcf5 #f0eeff;
}

/* WebKit scrollbars (Chrome, Safari, Edge) */
.chat-messages::-webkit-scrollbar,
.voice-stage::-webkit-scrollbar,
.voice-convo-bubbles::-webkit-scrollbar,
.assessment-bubbles::-webkit-scrollbar,
.voice-conversation-panel::-webkit-scrollbar,
.voice-presence-panel::-webkit-scrollbar { width: 7px; }

.chat-messages::-webkit-scrollbar-track,
.voice-stage::-webkit-scrollbar-track,
.voice-convo-bubbles::-webkit-scrollbar-track,
.assessment-bubbles::-webkit-scrollbar-track,
.voice-conversation-panel::-webkit-scrollbar-track,
.voice-presence-panel::-webkit-scrollbar-track {
    background: #f0eeff;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb,
.voice-stage::-webkit-scrollbar-thumb,
.voice-convo-bubbles::-webkit-scrollbar-thumb,
.assessment-bubbles::-webkit-scrollbar-thumb,
.voice-conversation-panel::-webkit-scrollbar-thumb,
.voice-presence-panel::-webkit-scrollbar-thumb {
    background: #c5bcf5;
    border-radius: 10px;
    border: 2px solid #f0eeff;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.voice-stage::-webkit-scrollbar-thumb:hover,
.voice-convo-bubbles::-webkit-scrollbar-thumb:hover,
.assessment-bubbles::-webkit-scrollbar-thumb:hover,
.voice-conversation-panel::-webkit-scrollbar-thumb:hover,
.voice-presence-panel::-webkit-scrollbar-thumb:hover {
    background: #9f8fe8;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .container { padding: 16px; }

    .chat-container { height: 480px; max-height: calc(100vh - 32px); margin: 0; }
    .chat-header { padding: 18px 16px; }
    .chat-header h1 { font-size: 18px; }
    .chat-messages { padding: 14px; }
    .bot-message .message-content,
    .user-message .message-content { max-width: 88%; }

    .voice-outer-wrap {
        border-radius: 16px;
        min-height: auto;
        height: auto;
    }
    .voice-stage {
        padding: 16px;
    }
    .voice-stage-grid {
        grid-template-columns: 1fr;
    }
    .voice-conversation-panel {
        order: 2;
        padding: 16px;
    }
    .voice-presence-panel {
        order: 1;
    }
    .voice-question-card { padding: 16px 18px; }
    .voice-convo-bubbles,
    .assessment-bubbles {
        min-height: 240px;
    }
    .voice-listen-row.mobile-status {
        display: flex;
    }

    .navigation-buttons { flex-direction: column; }
    .btn { width: 100%; }

    .voice-question-options { gap: 8px; }
    .voice-question-option-tag { font-size: 13px; padding: 8px 15px; }

    .dashboard-header { flex-direction: column; gap: 12px; }
}