/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #252422 0%, #1a1816 50%, #252422 100%);
    min-height: 100vh;
    color: #fffcf2;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 25%;
    left: 25%;
    width: 400px;
    height: 400px;
    background: rgba(235, 94, 40, 0.05);
    border-radius: 50%;
    filter: blur(80px);
    animation: pulse-slow 4s ease-in-out infinite;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: 25%;
    right: 25%;
    width: 400px;
    height: 400px;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 50%;
    filter: blur(80px);
    animation: pulse-medium 3s ease-in-out infinite;
    z-index: 0;
}

@keyframes pulse-slow {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
}

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

/* Container */
.container {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.title {
    font-size: 2.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #eb5e28 0%, #ff8c42 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #ccc5b9;
    font-size: 0.9rem;
}

/* Main Card */
.main-card {
    background: rgba(37, 36, 34, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 1.5rem;
    border: 1px solid rgba(64, 61, 57, 0.5);
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 1400px;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

/* Left Column */
.left-column {
    flex: 0 0 500px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Right Column (Chat Area) */
.chat-area {
    flex: 1;
    min-width: 0;
}

/* Voice Circle Container */
.voice-circle-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 2rem;
}

/* Transcribed Text */
.transcribed-text {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 1rem;
    background: rgba(64, 61, 57, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(235, 94, 40, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 20;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.transcribed-label {
    font-size: 0.75rem;
    color: #ccc5b9;
    margin-bottom: 0.25rem;
}

.transcribed-content {
    font-size: 0.875rem;
    color: #fffcf2;
    font-weight: 500;
}

/* Status Badge Container */
.status-badge-container {
    position: absolute;
    top: -2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
}

/* Badges */
.badge {
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.badge-connected {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.5);
}

.badge-connected .badge-dot {
    background: #4ade80;
}

.badge-connecting {
    background: rgba(234, 179, 8, 0.2);
    color: #fbbf24;
    border-color: rgba(234, 179, 8, 0.5);
}

.badge-connecting .badge-dot {
    background: #fbbf24;
}

.badge-disconnected {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.5);
}

.badge-disconnected .badge-dot {
    background: #f87171;
}

.badge-ready {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.5);
}

.badge-ready .badge-dot {
    background: #4ade80;
}

.badge-phase {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.5);
    font-size: 0.7rem;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Voice Circle */
.voice-circle-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.voice-circle {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #eb5e28 0%, #ff8c42 100%);
    box-shadow: 0 20px 40px rgba(235, 94, 40, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s ease;
}

.voice-circle.inactive {
    background: #403d39;
    box-shadow: none;
}

.voice-circle-inner {
    width: 80%;
    height: 80%;
    border-radius: 50%;
    background: #252422;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.mic-icon {
    width: 48px;
    height: 48px;
    color: #eb5e28;
    transition: color 0.3s ease;
}

.voice-circle.inactive .mic-icon {
    color: #ccc5b9;
}

/* Pulse Effects */
.pulse-effects {
    position: absolute;
    inset: 15%;
}

.pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #eb5e28;
    opacity: 0.2;
}

.pulse-1 {
    animation: pulse-ring 1.2s ease-in-out infinite;
}

.pulse-2 {
    animation: pulse-ring 1.6s ease-in-out infinite 0.2s;
    opacity: 0.15;
}

.pulse-3 {
    animation: pulse-ring 2s ease-in-out infinite 0.4s;
    opacity: 0.1;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.2;
    }
    50% {
        transform: scale(1.3);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 0.2;
    }
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #ccc5b9 0%, #d4cfc4 100%);
    color: #252422;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-primary.active {
    background: linear-gradient(135deg, #eb5e28 0%, #ff8c42 100%);
    color: #fffcf2;
    box-shadow: 0 10px 30px rgba(235, 94, 40, 0.3);
}

.btn-primary.end {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: #fffcf2;
    box-shadow: 0 10px 30px rgba(220, 38, 38, 0.3);
}

.btn-secondary {
    background: #403d39;
    color: #ccc5b9;
    border: 1px solid rgba(64, 61, 57, 0.5);
}

.btn-secondary:hover {
    background: rgba(64, 61, 57, 0.8);
}

.btn-terminate {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: #fffcf2;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-terminate:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
    box-shadow: 0 10px 30px rgba(220, 38, 38, 0.4);
}

.btn-icon {
    width: 20px;
    height: 20px;
}

/* Button Loading State */
.btn-loader {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 0.5rem;
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn.loading {
    pointer-events: none;
}

.btn.loading .btn-icon {
    opacity: 0.5;
}

/* Chat Area - Detailed Styling */
.chat-area {
    background: rgba(64, 61, 57, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    border: 1px solid rgba(64, 61, 57, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 600px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid rgba(64, 61, 57, 0.5);
    background: rgba(64, 61, 57, 0.3);
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-icon {
    width: 20px;
    height: 20px;
    color: #eb5e28;
}

.chat-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.download-btn {
    background: none;
    border: none;
    color: #ccc5b9;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.download-btn:hover {
    color: #eb5e28;
    background: rgba(64, 61, 57, 0.5);
}

.download-btn svg {
    width: 20px;
    height: 20px;
}

/* Chat Tabs */
.chat-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(64, 61, 57, 0.5);
    background: rgba(64, 61, 57, 0.3);
}

.chat-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: #ccc5b9;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.chat-tab:hover {
    background: rgba(64, 61, 57, 0.5);
    color: #fffcf2;
}

.chat-tab.active {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.tab-icon {
    font-size: 1rem;
}

.tab-label {
    font-size: 0.875rem;
}

/* Chat Boxes */
.chat-box {
    display: none;
}

.chat-box.active {
    display: block;
}

/* Messages Container */
.messages-container {
    height: 320px;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: #252422;
}

.messages-container::-webkit-scrollbar-thumb {
    background: rgba(235, 94, 40, 0.5);
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(235, 94, 40, 0.7);
}

.empty-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ccc5b9;
    font-size: 0.875rem;
}

/* Message Bubbles */
.message {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease-out;
}

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

.message.user {
    flex-direction: row-reverse;
}

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

.message.user .message-avatar {
    background: #eb5e28;
}

.message.agent .message-avatar {
    background: rgba(204, 197, 185, 0.2);
    border: 1px solid rgba(204, 197, 185, 0.3);
}

.message.agent.selection .message-avatar {
    background: rgba(59, 130, 246, 0.3);
    border: 1px solid rgba(59, 130, 246, 0.5);
}

.message.agent.scenario .message-avatar {
    background: rgba(168, 85, 247, 0.3);
    border: 1px solid rgba(168, 85, 247, 0.5);
}

.message.agent.feedback .message-avatar {
    background: rgba(34, 197, 94, 0.3);
    border: 1px solid rgba(34, 197, 94, 0.5);
}

.message-avatar svg {
    width: 20px;
    height: 20px;
}

.message.user .message-avatar svg {
    color: #fffcf2;
}

.message.agent .message-avatar svg {
    color: #ccc5b9;
}

.message.agent.selection .message-avatar svg {
    color: #93c5fd;
}

.message.agent.scenario .message-avatar svg {
    color: #c4b5fd;
}

.message.agent.feedback .message-avatar svg {
    color: #86efac;
}

.message-bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #eb5e28 0%, #ff8c42 100%);
    color: #fffcf2;
    border-top-right-radius: 0.25rem;
}

.message.agent .message-bubble {
    background: rgba(204, 197, 185, 0.2);
    color: #fffcf2;
    border: 1px solid rgba(204, 197, 185, 0.2);
    backdrop-filter: blur(10px);
    border-top-left-radius: 0.25rem;
}

.message.agent.selection .message-bubble {
    background: rgba(59, 130, 246, 0.2);
    color: #dbeafe;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.message.agent.scenario .message-bubble {
    background: rgba(168, 85, 247, 0.2);
    color: #e9d5ff;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.message.agent.feedback .message-bubble {
    background: rgba(34, 197, 94, 0.2);
    color: #bbf7d0;
    border: 1px solid rgba(34, 197, 94, 0.3);
    max-width: 90%;
    white-space: normal;
}

/* Feedback markdown formatting */
.message.agent.feedback .message-bubble strong {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(34, 197, 94, 0.4);
}

.message.agent.feedback .message-bubble strong:first-child {
    margin-top: 0;
}

.message.agent.feedback .message-bubble ul {
    list-style: none;
    padding-left: 0;
    margin: 0.5rem 0;
}

.message.agent.feedback .message-bubble li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.6;
}

.message.agent.feedback .message-bubble li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #22c55e;
    font-weight: bold;
}

.message.system {
    justify-content: center;
    margin: 0.5rem 0;
}

.message.system .message-bubble {
    background: rgba(168, 85, 247, 0.2);
    color: #c4b5fd;
    border: 1px solid rgba(168, 85, 247, 0.5);
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
}

/* Footer */
.footer {
    margin-top: 1.5rem;
    text-align: center;
    color: #ccc5b9;
    font-size: 0.75rem;
}

/* Scenario Selection */
.scenario-selection {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(64, 61, 57, 0.3);
    border-radius: 1rem;
    border: 1px solid rgba(64, 61, 57, 0.5);
}

.selection-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fffcf2;
    margin-bottom: 1.5rem;
    text-align: center;
}

.selection-group {
    margin-bottom: 1.25rem;
}

.selection-group:last-child {
    margin-bottom: 0;
}

.selection-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #ccc5b9;
    margin-bottom: 0.5rem;
}

.selection-dropdown {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(37, 36, 34, 0.8);
    border: 1px solid rgba(235, 94, 40, 0.3);
    border-radius: 0.5rem;
    color: #fffcf2;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.selection-dropdown:hover {
    border-color: rgba(235, 94, 40, 0.5);
    background: rgba(37, 36, 34, 0.95);
}

.selection-dropdown:focus {
    border-color: #eb5e28;
    box-shadow: 0 0 0 3px rgba(235, 94, 40, 0.1);
}

.selection-dropdown option {
    background: #252422;
    color: #fffcf2;
    padding: 0.5rem;
}

/* Hide selection when active */
.scenario-selection.hidden {
    display: none;
}

/* Responsive */
/* Responsive: Stack layout on smaller screens */
@media (max-width: 1024px) {
    .main-card {
        flex-direction: column;
        max-width: 600px;
    }

    .left-column {
        flex: 1;
        width: 100%;
    }

    .chat-area {
        width: 100%;
        height: 500px;
    }
}

@media (max-width: 640px) {
    .title {
        font-size: 2rem;
    }

    .main-card {
        padding: 1.5rem;
    }

    .voice-circle-container {
        width: 160px;
        height: 160px;
    }

    .scenario-selection {
        padding: 1rem;
    }

    .selection-title {
        font-size: 1.1rem;
    }

    .chat-area {
        height: 400px;
    }
}

