/* Chat Interface Styles - Extracted from scenario.html */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #9d0a0e;
    --primary-dark: #9d0a0e;
    --primary-light: #d71921;
    --secondary: #f15a22;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --gray-900: #0f172a;
    --gray-800: #1e293b;
    --gray-700: #334155;
    --gray-600: #475569;
    --gray-500: #64748b;
    --gray-400: #94a3b8;
    --gray-300: #cbd5e1;
    --gray-200: #e2e8f0;
    --gray-100: #f1f5f9;
    --gray-50: #f8fafc;
    --white: #ffffff;
    --gradient: linear-gradient(135deg, #9d0a0e 0%, #f15a22 100%);
    --gradient-2: linear-gradient(135deg, #9d0a0e 0%, #f15a22 100%);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: var(--gray-800);
    line-height: 1.6;
    overflow: hidden;
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.app-container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    min-height: 600px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    color: var(--gray-600);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-2);
}

.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Chat Header */
.chat-header {
    background: var(--white);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-100);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bot-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.bot-info {
    display: flex;
    flex-direction: column;
}

.bot-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.bot-status {
    font-size: 0.8rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.language-selector {
    padding: 0.5rem 0.75rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    color: var(--gray-700);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.language-selector:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

.language-selector:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(157, 10, 14, 0.1);
}

.header-btn {
    width: 36px;
    height: 36px;
    background: var(--gray-100);
    border: none;
    border-radius: 50%;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.header-btn:hover {
    background: var(--gray-200);
    transform: scale(1.05);
}

/* Messages Area */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    padding-bottom: 2rem;
    background: var(--gray-50);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.messages-area::-webkit-scrollbar {
    width: 4px;
}

.messages-area::-webkit-scrollbar-track {
    background: transparent;
}

.messages-area::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.message {
    display: flex;
    gap: 0.75rem;
    animation: messageIn 0.3s ease-out;
    max-width: 75%;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.bot-message-avatar {
    background: var(--gradient-2);
    color: var(--white);
}

.user-message-avatar {
    background: var(--gray-200);
    color: var(--gray-700);
}

.message-content {
    flex: 1;
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.message.bot .message-bubble {
    background: var(--white);
    color: var(--gray-800);
    border-bottom-left-radius: 4px;
}

.message.user .message-bubble {
    background: var(--gradient-2);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.message-bubble:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.message-text {
    font-size: 0.95rem;
    line-height: 1.5;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

.message.bot .message-time {
    color: var(--gray-500);
}

.message.user .message-time {
    color: rgba(255, 255, 255, 0.8);
}

/* Enhanced Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.typing-indicator.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.typing-dots {
    display: flex;
    gap: 0.3rem;
    padding: 0.75rem 1rem;
    background: var(--white);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--gray-100);
}

.typing-dots::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(5, 150, 105, 0.08), transparent);
    animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.2s infinite ease-in-out;
    position: relative;
    z-index: 1;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-6px) scale(1.1);
        opacity: 1;
    }
}

.typing-status {
    font-size: 0.75rem;
    color: var(--primary);
    font-style: italic;
    font-weight: 500;
    animation: pulse 2s infinite;
}

/* Response Area */
.response-container {
    padding: 1.5rem;
    background: var(--white);
    border-top: 1px solid var(--gray-100);
    display: block;
    visibility: visible;
    min-height: 80px;
    position: sticky;
    bottom: 0;
    z-index: 100;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.response-container::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to bottom, transparent, var(--white));
    pointer-events: none;
}

.response-container.has-scroll-above::after {
    content: '↑ Scroll up to see more messages';
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0.8;
    animation: fadeInOut 3s ease-in-out;
    pointer-events: none;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 0.8; }
}

.response-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.response-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 40px;
    width: 100%;
}

.response-btn {
    padding: 0.5rem 1rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    color: var(--gray-700);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.response-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-2);
    transition: left 0.3s ease;
    z-index: -1;
}

.response-btn:hover {
    color: var(--white);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.response-btn:hover::before {
    left: 0;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.welcome-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
}

.welcome-description {
    font-size: 1rem;
    color: var(--gray-600);
    max-width: 450px;
    margin-bottom: 1.5rem;
}

.scenario-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.scenario-card {
    padding: 1.25rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    min-width: 180px;
}

.scenario-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.scenario-card.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--white);
}

.scenario-icon {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.scenario-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.scenario-desc {
    font-size: 0.8rem;
    opacity: 0.8;
}

.start-btn {
    padding: 0.75rem 1.5rem;
    background: var(--gradient-2);
    color: var(--white);
    border: none;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Score Modal - Enhanced Responsive Design */
.score-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    z-index: 1000;
    animation: fadeIn 0.4s ease;
    padding: 1rem;
    overflow-y: auto;
}

.score-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(12px);
    }
}

.score-content {
    background: var(--white);
    border-radius: 24px;
    padding: 3rem;
    max-width: 650px;
    width: 95%;
    min-height: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    animation: slideInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
    position: relative;
    border: 1px solid var(--gray-100);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(60px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.score-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 2rem;
    margin: 0 auto 1.5rem;
    animation: celebrationBounce 2s ease-in-out infinite;
    box-shadow: 0 8px 32px rgba(5, 150, 105, 0.3);
}

@keyframes celebrationBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) scale(1);
    }
    40% {
        transform: translateY(-12px) scale(1.1);
    }
    60% {
        transform: translateY(-6px) scale(1.05);
    }
}

.score-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.score-value {
    font-size: 4.5rem;
    font-weight: 900;
    background: var(--gradient-2);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 1.5rem 0;
    line-height: 1;
    text-shadow: 0 4px 8px rgba(5, 150, 105, 0.2);
}

.score-message {
    color: var(--gray-700);
    margin-bottom: 2.5rem;
    line-height: 1.7;
    font-size: 1.1rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    font-weight: 500;
}

.score-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-item {
    padding: 1.75rem 1.25rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
    border-radius: 18px;
    border: 1px solid var(--gray-100);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.stat-item:hover::before {
    opacity: 1;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.score-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 2rem;
}

.btn {
    padding: 1rem 2rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    min-width: 140px;
    justify-content: center;
}

.btn-primary {
    background: var(--gradient-2);
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

/* Tag Breakdown Styles */
.insight-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
}

.insight-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.insight-title i {
    color: var(--primary);
}

.tag-breakdown-item {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.tag-breakdown-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.tag-breakdown-item.excellent {
    border-left: 4px solid #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.tag-breakdown-item.good {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.tag-breakdown-item.fair {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.tag-breakdown-item.poor {
    border-left: 4px solid #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
}

.tag-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.tag-info {
    flex: 1;
}

.tag-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.tag-link {
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.tag-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.tag-link i {
    font-size: 0.875rem;
    opacity: 0.7;
}

.tag-description {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin: 0;
}

.tag-score {
    text-align: right;
    flex-shrink: 0;
}

.tag-percentage {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-800);
    display: block;
}

.tag-responses {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

.tag-breakdown-bars {
    margin-top: 1rem;
}

.breakdown-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    margin-bottom: 0.75rem;
}

.bar-segment {
    height: 100%;
    transition: all 0.3s ease;
}

.bar-segment.good {
    background: #10b981;
}

.bar-segment.medium {
    background: #3b82f6;
}

.bar-segment.bad {
    background: #ef4444;
}

.breakdown-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}

.legend-item::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-item.good::before {
    background: #10b981;
}

.legend-item.medium::before {
    background: #3b82f6;
}

.legend-item.bad::before {
    background: #ef4444;
}

.legend-item.good {
    color: #065f46;
}

.legend-item.medium {
    color: #1e40af;
}

.legend-item.bad {
    color: #991b1b;
}

/* Responsive Tag Breakdown Styles */
@media (max-width: 768px) {
    .tag-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .tag-score {
        text-align: left;
    }
    
    .tag-percentage {
        font-size: 1.25rem;
    }
    
    .breakdown-legend {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .tag-breakdown-item {
        padding: 1rem;
    }
    
    .insight-section {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
}

@media (max-width: 480px) {
    .tag-name {
        font-size: 1rem;
    }
    
    .tag-description {
        font-size: 0.85rem;
    }
    
    .breakdown-legend {
        font-size: 0.8rem;
    }
    
    .legend-item::before {
        width: 10px;
        height: 10px;
    }

    /* Enhanced mobile styles for small screens */
    .app-container {
        padding: 0;
        border-radius: 0;
    }

    .chat-header {
        padding: 0.75rem 1rem;
    }

    .bot-name {
        font-size: 0.95rem;
    }

    .header-btn {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .messages-area {
        padding: 0.5rem;
    }

    .message-bubble {
        padding: 0.65rem 0.9rem;
        font-size: 0.85rem;
        max-width: calc(100vw - 100px);
    }

    .message-time {
        font-size: 0.6rem;
        margin-top: 0.25rem;
    }

    .response-container {
        padding: 0.75rem;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }

    .response-btn {
        padding: 0.9rem 1rem;
        font-size: 0.85rem;
        min-height: 48px;
    }

    .welcome-screen {
        padding: 0.75rem;
    }

    .welcome-title {
        font-size: 1.25rem;
    }

    .welcome-description {
        font-size: 0.85rem;
    }

    .scenario-card {
        padding: 0.75rem;
    }

    .scenario-title {
        font-size: 0.95rem;
    }

    .scenario-desc {
        font-size: 0.8rem;
    }

    .start-btn {
        padding: 0.9rem 1.25rem;
        font-size: 0.85rem;
    }
}

/* Insight Section - Enhanced Responsive Design */
.insight-section {
    margin-top: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
    border-radius: 18px;
    border: 1px solid var(--gray-100);
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    text-align: left;
}

.insight-section:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.insight-title {
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.insight-title i {
    color: var(--primary);
    background: rgba(5, 150, 105, 0.1);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.insight-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    font-size: 1rem;
    color: var(--gray-600);
    background: var(--white);
    border-radius: 14px;
    padding: 1.5rem 1.75rem;
    border: 1px solid var(--gray-100);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    min-height: 70px;
}

.insight-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--gradient-2);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.insight-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.insight-item:hover::before {
    opacity: 1;
}

.insight-item:last-child {
    margin-bottom: 0;
}

.insight-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    flex: 1;
}

.insight-icon {
    color: var(--primary);
    background: rgba(5, 150, 105, 0.12);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.insight-item:hover .insight-icon {
    background: var(--primary);
    color: var(--white);
    transform: scale(1.1);
}

.insight-metrics {
    text-align: right;
    font-size: 0.95rem;
    color: var(--gray-500);
    font-weight: 500;
    line-height: 1.5;
}

.insight-metrics div:first-child {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
}

/* Mobile Responsive for Insight Section */
@media (max-width: 768px) {
    .insight-section {
        padding: 1.25rem;
        margin-top: 1.25rem;
    }

    .insight-title {
        font-size: 0.9rem;
        margin-bottom: 0.875rem;
    }

    .insight-item {
        padding: 1rem;
        gap: 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .insight-label {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .insight-metrics {
        width: 100%;
        text-align: left;
        font-size: 0.8rem;
    }

    .insight-icon {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .insight-section {
        padding: 1rem;
        border-radius: 12px;
    }

    .insight-title {
        font-size: 0.85rem;
        gap: 0.5rem;
    }

    .insight-title i {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }

    .insight-item {
        padding: 0.875rem;
        border-radius: 10px;
    }

    .insight-icon {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--white);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 2000;
}

.toast.show {
    transform: translateX(0);
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.toast-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.toast-icon.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.toast-message {
    font-size: 0.875rem;
    color: var(--gray-800);
    font-weight: 500;
}

/* Analytics Styles */
.analytics-header {
    padding: 1.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
}

.analytics-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.analytics-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.analytics-actions {
    display: flex;
    gap: 0.75rem;
}

.analytics-export-btn {
    padding: 0.75rem 1.5rem;
    background: var(--gradient-2);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.analytics-export-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--primary-dark);
}

.analytics-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--gray-50);
}

/* Documentation Styles */
.docs-header {
    padding: 1.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.docs-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.docs-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: var(--white);
}

/* Mobile Text Wrapping and Layout Fixes */
.message-text {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    white-space: pre-wrap;
}

.response-btn {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    text-overflow: ellipsis;
}

/* Ensure proper mobile viewport handling */
@supports (-webkit-touch-callout: none) {
    .app-container {
        height: -webkit-fill-available;
    }
}

/* Enhanced Mobile Responsive */
@media (max-width: 768px) {
    .app-container {
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        max-width: 100%;
        margin: 0;
        display: flex;
        flex-direction: column;
    }

    .tab-navigation {
        padding: 0.5rem;
    }

    .tab-btn {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    .chat-header {
        padding: 1rem;
        flex-wrap: wrap;
    }

    .header-left {
        flex: 1;
        min-width: 200px;
    }

    .bot-avatar {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .bot-name {
        font-size: 1rem;
    }

    .bot-status {
        font-size: 0.75rem;
    }

    .header-actions {
        gap: 0.25rem;
    }

    .header-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .messages-area {
        padding: 0.75rem;
        padding-bottom: 2rem;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        min-height: 0;
    }

    .message {
        max-width: 85%;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .message.bot {
        align-self: flex-start;
    }

    .message.user {
        align-self: flex-end;
        flex-direction: row-reverse;
    }

    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .message-bubble {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        max-width: calc(100vw - 120px);
    }

    .message.bot .message-bubble {
        background: var(--white);
        border: 1px solid var(--gray-200);
        border-radius: 18px 18px 18px 4px;
    }

    .message.user .message-bubble {
        background: var(--gradient);
        color: var(--white);
        border-radius: 18px 18px 4px 18px;
    }

    .message-time {
        font-size: 0.65rem;
    }

    .welcome-screen {
        padding: 1rem;
    }

    .welcome-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .welcome-title {
        font-size: 1.5rem;
    }

    .welcome-description {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .response-container {
        padding: 1rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
        background: var(--white);
        border-top: 2px solid var(--gray-100);
        position: sticky;
        bottom: 0;
        z-index: 100;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    }

    .response-label {
        font-size: 0.9rem;
        margin-bottom: 1rem;
        font-weight: 600;
        color: var(--gray-700);
    }

    .response-options {
        gap: 0.75rem;
        flex-direction: column;
        max-height: 35vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .response-btn {
        padding: 1rem 1.25rem;
        font-size: 0.9rem;
        line-height: 1.5;
        width: 100%;
        text-align: left;
        min-height: 52px;
        border-radius: 12px;
        box-shadow: var(--shadow-sm);
        transition: all 0.2s ease;
        border: 1px solid var(--gray-200);
        background: var(--white);
        color: var(--gray-800);
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }

    .response-btn:hover,
    .response-btn:active {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
        background: var(--primary);
        color: var(--white);
    }

    .scenario-selector {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }

    .scenario-card {
        width: 100%;
        padding: 1rem;
        text-align: center;
    }

    .start-btn {
        padding: 1rem 1.5rem;
        font-size: 0.9rem;
        width: 100%;
        justify-content: center;
    }

    .typing-indicator {
        padding: 0.5rem 0;
    }

    .typing-dots {
        padding: 0.5rem 0.75rem;
    }

    .score-modal {
        padding: 1rem;
        align-items: center;
        justify-content: center;
    }

    .score-content {
        width: 100%;
        max-width: none;
        padding: 2.5rem 2rem;
        margin: 0;
        border-radius: 20px;
        max-height: 90vh;
        overflow-y: auto;
        min-height: auto;
    }

    .score-icon {
        width: 75px;
        height: 75px;
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    .score-title {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }

    .score-value {
        font-size: 3.5rem;
        margin: 1rem 0;
    }

    .score-message {
        font-size: 1rem;
        margin-bottom: 2rem;
        line-height: 1.6;
    }

    .score-stats {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin-bottom: 2rem;
    }

    .stat-item {
        padding: 1.5rem 1.25rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        min-height: 80px;
    }

    .stat-value {
        font-size: 1.75rem;
        margin-bottom: 0;
    }

    .stat-label {
        font-size: 0.9rem;
    }

    .score-actions {
        flex-direction: column;
        gap: 1.25rem;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: 1.25rem 1.5rem;
        font-size: 1.05rem;
        border-radius: 12px;
        min-height: 50px;
    }

    .insight-section {
        padding: 1.75rem;
        margin-top: 1.75rem;
    }

    .insight-title {
        font-size: 1rem;
        margin-bottom: 1.25rem;
    }

    .insight-item {
        padding: 1.25rem;
        gap: 1rem;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        min-height: 80px;
    }

    .insight-label {
        width: 100%;
        margin-bottom: 0.75rem;
    }

    .insight-metrics {
        width: 100%;
        text-align: left;
        font-size: 0.9rem;
    }

    .insight-icon {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }

    .analytics-header,
    .docs-header {
        padding: 1rem;
    }

    .analytics-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .analytics-export-btn {
        width: 100%;
        justify-content: center;
    }

    .analytics-header-top {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .toast {
        right: 1rem;
        left: 1rem;
        bottom: 1rem;
        padding: 0.75rem 1rem;
    }

    .docs-content {
        padding: 1rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .app-container {
        min-height: 100vh;
        min-height: 100dvh;
    }

    .response-container {
        padding: 0.75rem;
        padding-bottom: 1.5rem;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--white);
        border-top: 2px solid var(--primary);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
        z-index: 1000;
    }

    .messages-area {
        padding-bottom: 120px;
    }

    .response-btn {
        padding: 1rem;
        font-size: 0.85rem;
        min-height: 44px;
        border-radius: 10px;
    }

    .tab-btn {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }

    .chat-header {
        padding: 0.75rem;
    }

    .messages-area {
        padding: 0.5rem;
    }

    .response-container {
        padding: 0.75rem;
    }

    .welcome-screen {
        padding: 0.75rem;
    }

    .welcome-title {
        font-size: 1.25rem;
    }

    .scenario-card {
        padding: 0.75rem;
    }

    .response-btn {
        padding: 0.75rem;
        font-size: 0.8rem;
    }

    /* Score Modal for Extra Small Devices */
    .score-modal {
        padding: 0.5rem;
        align-items: center;
        justify-content: center;
    }

    .score-content {
        border-radius: 16px;
        height: auto;
        max-height: 95vh;
        min-height: auto;
        padding: 2rem 1.5rem;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        overflow-y: auto;
    }

    .score-icon {
        width: 65px;
        height: 65px;
        font-size: 1.6rem;
        margin-bottom: 1.25rem;
    }

    .score-title {
        font-size: 1.75rem;
        margin-bottom: 0.75rem;
    }

    .score-value {
        font-size: 3rem;
        margin: 1rem 0;
    }

    .score-message {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
        line-height: 1.5;
    }

    .score-stats {
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .stat-item {
        padding: 1.25rem 1rem;
        border-radius: 14px;
        min-height: 70px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }

    .score-actions {
        gap: 1rem;
        margin-top: 1rem;
    }

    .btn {
        padding: 1rem 1.25rem;
        font-size: 0.95rem;
        border-radius: 12px;
        min-height: 48px;
    }

    .insight-section {
        padding: 1.5rem;
        margin-top: 1.5rem;
    }

    .insight-title {
        font-size: 0.95rem;
        gap: 0.5rem;
    }

    .insight-title i {
        width: 26px;
        height: 26px;
        font-size: 0.8rem;
    }

    .insight-item {
        padding: 1rem;
        border-radius: 12px;
        min-height: 70px;
    }

    .insight-icon {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }
}

/* Loading and Warning Messages */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--gray-600);
    font-style: italic;
}

.warning-message {
    background: #fff3cd;
    color: #856404;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    text-align: center;
    border: 1px solid #ffeaa7;
    font-size: 0.9rem;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Ro
le Selection Styles */
.role-selection {
    width: 100%;
    max-width: 600px;
    margin: 2rem auto;
}

.role-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
    text-align: center;
    margin-bottom: 2rem;
}

.role-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.role-card {
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.role-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.role-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.role-card:hover::before {
    opacity: 0.05;
}

.role-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(157, 10, 14, 0.05) 0%, rgba(241, 90, 34, 0.05) 100%);
}

.role-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.role-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.role-desc {
    font-size: 0.875rem;
    color: var(--gray-600);
    position: relative;
    z-index: 1;
}

.scenario-selection {
    width: 100%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.back-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.back-btn:hover {
    background: var(--gray-100);
    transform: translateX(-4px);
}

.back-btn i {
    font-size: 0.875rem;
}

.scenario-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Responsive adjustments for role selection */
@media (max-width: 640px) {
    .role-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .role-card {
        padding: 1.5rem 1rem;
    }
    
    .role-icon {
        font-size: 2.5rem;
    }
    
    .role-title {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }
}
