/* ABA Exam — Chat Interface */

.aba-chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
    background: var(--aba-white);
    border-radius: var(--aba-radius-lg);
    border: 1px solid var(--aba-gray-200);
    overflow: hidden;
}

.aba-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--aba-gray-50);
    border-bottom: 1px solid var(--aba-gray-200);
}

.aba-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aba-chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--aba-pale-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.aba-chat-header-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--aba-navy);
}

.aba-chat-header-status {
    font-size: 12px;
    color: var(--aba-gray-500);
}

.aba-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.aba-chat-message {
    display: flex;
    gap: 10px;
    max-width: 80%;
    animation: aba-slide-up 0.3s ease;
}

.aba-chat-message.examiner {
    align-self: flex-start;
}

.aba-chat-message.candidate {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.aba-chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.aba-chat-message.examiner .aba-chat-message-avatar {
    background: var(--aba-pale-blue);
}

.aba-chat-message.candidate .aba-chat-message-avatar {
    background: #d1fae5;
}

.aba-chat-message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
}

.aba-chat-message.examiner .aba-chat-message-bubble {
    background: var(--aba-gray-100);
    color: var(--aba-gray-800);
    border-bottom-left-radius: 4px;
}

.aba-chat-message.candidate .aba-chat-message-bubble {
    background: var(--aba-navy);
    color: var(--aba-white);
    border-bottom-right-radius: 4px;
}

.aba-chat-message-time {
    font-size: 11px;
    color: var(--aba-gray-400);
    margin-top: 4px;
    text-align: right;
}

.aba-chat-message.candidate .aba-chat-message-time {
    color: rgba(255,255,255,0.6);
}

/* Typing indicator */
.aba-chat-typing {
    display: flex;
    gap: 10px;
    align-self: flex-start;
    max-width: 80%;
    padding: 4px 0;
}

.aba-chat-typing-bubble {
    display: inline-flex;
    padding: 12px 20px;
    background: var(--aba-gray-100);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

/* Input area */
.aba-chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 16px 20px;
    background: var(--aba-gray-50);
    border-top: 1px solid var(--aba-gray-200);
}

.aba-chat-input-wrapper {
    flex: 1;
    position: relative;
}

.aba-chat-input {
    width: 100%;
    min-height: 44px;
    max-height: 120px;
    padding: 10px 16px;
    border: 2px solid var(--aba-gray-200);
    border-radius: var(--aba-radius-lg);
    font-family: var(--aba-font);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    background: var(--aba-white);
}

.aba-chat-input:focus {
    border-color: var(--aba-blue);
}

.aba-chat-input::placeholder {
    color: var(--aba-gray-400);
}

.aba-chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--aba-blue);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.aba-chat-send-btn:hover {
    background: var(--aba-dark-blue);
    transform: scale(1.05);
}

.aba-chat-send-btn:disabled {
    background: var(--aba-gray-300);
    cursor: not-allowed;
    transform: none;
}

.aba-chat-send-btn svg {
    width: 20px;
    height: 20px;
}

/* Voice button */
.aba-chat-voice-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--aba-white);
    border: 2px solid var(--aba-gray-200);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.aba-chat-voice-btn:hover {
    border-color: var(--aba-blue);
    color: var(--aba-blue);
}

.aba-chat-voice-btn.recording {
    background: var(--aba-red);
    border-color: var(--aba-red);
    color: white;
    animation: aba-pulse 1.5s ease infinite;
}

.aba-chat-voice-btn svg {
    width: 20px;
    height: 20px;
}

/* Voice transcript overlay */
.aba-voice-transcript {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--aba-white);
    border: 2px solid var(--aba-blue);
    border-radius: var(--aba-radius);
    padding: 12px 16px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--aba-gray-700);
    box-shadow: var(--aba-shadow);
    animation: aba-slide-up 0.3s ease;
}

.aba-voice-transcript-label {
    font-size: 11px;
    color: var(--aba-blue);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.aba-voice-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 20px;
}

.aba-voice-waveform-bar {
    width: 3px;
    background: var(--aba-blue);
    border-radius: 2px;
    animation: aba-waveform 0.5s ease infinite alternate;
}

.aba-voice-waveform-bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.aba-voice-waveform-bar:nth-child(2) { height: 14px; animation-delay: 0.1s; }
.aba-voice-waveform-bar:nth-child(3) { height: 20px; animation-delay: 0.2s; }
.aba-voice-waveform-bar:nth-child(4) { height: 12px; animation-delay: 0.3s; }
.aba-voice-waveform-bar:nth-child(5) { height: 16px; animation-delay: 0.4s; }

@keyframes aba-waveform {
    from { transform: scaleY(0.4); }
    to { transform: scaleY(1); }
}

/* System messages in chat */
.aba-chat-system {
    align-self: center;
    text-align: center;
    padding: 8px 20px;
    background: var(--aba-yellow-light);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    max-width: 90%;
}

.aba-chat-system.info {
    background: var(--aba-pale-blue);
    color: var(--aba-dark-blue);
}

.aba-chat-system.success {
    background: var(--aba-green-light);
    color: #15803d;
}

/* ======================================================
   SOE / OSCE Dark Theme — scoped under .aba-soe-main, .aba-osce-main
   ====================================================== */

.aba-soe-main .aba-chat-messages,
.aba-osce-main .aba-chat-messages {
    padding: 24px 28px;
    gap: 18px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.aba-soe-main .aba-chat-message.examiner .aba-chat-message-avatar,
.aba-osce-main .aba-chat-message.examiner .aba-chat-message-avatar {
    background: rgba(255,255,255,0.08);
}

.aba-soe-main .aba-chat-message.candidate .aba-chat-message-avatar,
.aba-osce-main .aba-chat-message.candidate .aba-chat-message-avatar {
    background: rgba(34,197,94,0.12);
}

.aba-soe-main .aba-chat-message.examiner .aba-chat-message-bubble,
.aba-osce-main .aba-chat-message.examiner .aba-chat-message-bubble {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.92);
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(8px);
}

.aba-soe-main .aba-chat-message.candidate .aba-chat-message-bubble,
.aba-osce-main .aba-chat-message.candidate .aba-chat-message-bubble {
    background: rgba(38,132,255,0.35);
    color: #fff;
    border-bottom-right-radius: 4px;
    backdrop-filter: blur(8px);
}

.aba-soe-main .aba-chat-message-time,
.aba-osce-main .aba-chat-message-time {
    color: rgba(255,255,255,0.3);
}

.aba-soe-main .aba-chat-message.candidate .aba-chat-message-time,
.aba-osce-main .aba-chat-message.candidate .aba-chat-message-time {
    color: rgba(255,255,255,0.4);
}

.aba-soe-main .aba-chat-typing-bubble,
.aba-osce-main .aba-chat-typing-bubble {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(8px);
}

.aba-soe-main .aba-chat-typing .aba-chat-message-avatar,
.aba-osce-main .aba-chat-typing .aba-chat-message-avatar {
    background: rgba(255,255,255,0.08);
}

.aba-soe-main .aba-chat-system,
.aba-osce-main .aba-chat-system {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.65);
    backdrop-filter: blur(6px);
}

.aba-soe-main .aba-chat-system.info,
.aba-osce-main .aba-chat-system.info {
    background: rgba(38,132,255,0.12);
    color: rgba(147,197,253,0.95);
}

.aba-soe-main .aba-chat-system.success,
.aba-osce-main .aba-chat-system.success {
    background: rgba(34,197,94,0.10);
    color: rgba(134,239,172,0.95);
}

.aba-soe-main .aba-chat-input-area,
.aba-osce-main .aba-chat-input-area {
    flex-shrink: 0;
    background: rgba(255,255,255,0.04);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 14px 24px;
}

.aba-soe-main .aba-chat-input,
.aba-osce-main .aba-chat-input {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.95);
    border-radius: 12px;
}

.aba-soe-main .aba-chat-input:focus,
.aba-osce-main .aba-chat-input:focus {
    border-color: rgba(38,132,255,0.5);
    background: rgba(255,255,255,0.08);
}

.aba-soe-main .aba-chat-input::placeholder,
.aba-osce-main .aba-chat-input::placeholder {
    color: rgba(255,255,255,0.3);
}

.aba-soe-main .aba-chat-voice-btn,
.aba-osce-main .aba-chat-voice-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.5);
}

.aba-soe-main .aba-chat-voice-btn:hover {
    border-color: rgba(38,132,255,0.5);
    color: rgba(147,197,253,0.9);
}

.aba-soe-main .aba-chat-voice-btn.recording,
.aba-osce-main .aba-chat-voice-btn.recording {
    background: var(--aba-red);
    border-color: var(--aba-red);
    color: white;
}

.aba-soe-main .aba-chat-send-btn,
.aba-osce-main .aba-chat-send-btn {
    background: rgba(38,132,255,0.5);
    backdrop-filter: blur(6px);
}

.aba-soe-main .aba-chat-send-btn:hover,
.aba-osce-main .aba-chat-send-btn:hover {
    background: rgba(38,132,255,0.7);
}

.aba-soe-main .aba-chat-send-btn:disabled,
.aba-osce-main .aba-chat-send-btn:disabled {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.2);
}

.aba-soe-main .aba-voice-transcript,
.aba-osce-main .aba-voice-transcript {
    background: rgba(15,23,42,0.95);
    border-color: rgba(38,132,255,0.4);
    color: rgba(255,255,255,0.9);
    backdrop-filter: blur(12px);
}

.aba-soe-main .aba-voice-transcript-label,
.aba-osce-main .aba-voice-transcript-label {
    color: rgba(147,197,253,0.9);
}

.aba-soe-main .aba-voice-waveform-bar,
.aba-osce-main .aba-voice-waveform-bar {
    background: rgba(147,197,253,0.7);
}

.aba-soe-main .aba-typing-dot,
.aba-osce-main .aba-typing-dot {
    background: rgba(255,255,255,0.5);
}

/* --- TTS Stop Button --- */
.aba-chat-message-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.aba-chat-message-footer .aba-chat-message-time {
    margin-top: 0;
}

.aba-tts-play-btn,
.aba-tts-stop-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.aba-tts-play-btn:hover,
.aba-tts-stop-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.aba-chat-message.examiner .aba-tts-play-btn {
    display: inline-flex;
}

.aba-chat-message.examiner.tts-playing .aba-tts-play-btn {
    display: none;
}

.aba-chat-message.tts-playing .aba-tts-stop-btn {
    display: inline-flex;
}

.aba-chat-message.tts-playing .aba-chat-message-bubble {
    border-left: 2px solid rgba(38,132,255,0.6);
}

.aba-soe-main .aba-chat-message.tts-playing .aba-chat-message-bubble::after,
.aba-osce-main .aba-chat-message.tts-playing .aba-chat-message-bubble::after {
    content: '';
    position: absolute;
    left: -2px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(38,132,255,0.8);
    animation: aba-tts-pulse 1.5s ease infinite;
}

@keyframes aba-tts-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}
