* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 100%);
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
    background: rgba(15, 15, 30, 0.95);
}

.left-panel {
    width: 30%;
    min-width: 350px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border-right: 1px solid rgba(74, 144, 226, 0.3);
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0f0f1e;
}

.header {
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(74, 144, 226, 0.2);
}

.header h1 {
    font-size: 2rem;
    background: linear-gradient(135deg, #4a90e2 0%, #7b68ee 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

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

.control-section, .script-section, .settings-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(74, 144, 226, 0.1);
}

.control-section h2, .script-section h2, .settings-section h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #4a90e2;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #666;
    transition: all 0.3s ease;
}

.status-indicator.connected .status-dot {
    background: #4ade80;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
}

.status-indicator.speaking .status-dot {
    background: #fbbf24;
    animation: pulse 1s infinite;
}

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

.voice-button {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #4a90e2 0%, #7b68ee 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.voice-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(74, 144, 226, 0.3);
}

.voice-button.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.mic-icon {
    width: 24px;
    height: 24px;
}

.audio-visualizer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 40px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.audio-visualizer.active {
    opacity: 1;
}

.audio-visualizer .bar {
    width: 4px;
    background: linear-gradient(to top, #4a90e2, #7b68ee);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.audio-visualizer .bar:nth-child(1) { animation-delay: 0s; height: 20px; }
.audio-visualizer .bar:nth-child(2) { animation-delay: 0.1s; height: 30px; }
.audio-visualizer .bar:nth-child(3) { animation-delay: 0.2s; height: 25px; }
.audio-visualizer .bar:nth-child(4) { animation-delay: 0.3s; height: 30px; }
.audio-visualizer .bar:nth-child(5) { animation-delay: 0.4s; height: 20px; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

.current-script {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.script-label {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.25rem;
}

.script-name {
    color: #4ade80;
    font-weight: 500;
}

.upload-area {
    border: 2px dashed rgba(74, 144, 226, 0.3);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: rgba(74, 144, 226, 0.6);
    background: rgba(74, 144, 226, 0.05);
}

.upload-area.dragging {
    border-color: #4a90e2;
    background: rgba(74, 144, 226, 0.1);
}

.upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    color: #4a90e2;
}

.upload-text {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.upload-hint {
    font-size: 0.85rem;
    color: #666;
}

.upload-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    display: none;
}

.upload-status.success {
    display: block;
    background: rgba(74, 222, 128, 0.1);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.upload-status.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.setting-item {
    margin-bottom: 1rem;
}

.setting-item label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #888;
}

.setting-item select {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(74, 144, 226, 0.2);
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.95rem;
    cursor: pointer;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(180deg, #1a1a2e 0%, transparent 100%);
    border-bottom: 1px solid rgba(74, 144, 226, 0.2);
}

.chat-header h2 {
    color: #4a90e2;
}

.clear-button {
    padding: 0.5rem 1rem;
    background: rgba(74, 144, 226, 0.1);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 6px;
    color: #4a90e2;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-button:hover {
    background: rgba(74, 144, 226, 0.2);
}

.chat-window {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.welcome-message {
    text-align: center;
    padding: 3rem;
    color: #888;
}

.welcome-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    color: #4a90e2;
}

.welcome-message h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #e0e0e0;
}

.instructions {
    list-style: none;
    margin-top: 1.5rem;
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.instructions li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.instructions li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #4ade80;
}

.message {
    display: flex;
    gap: 1rem;
    animation: fadeIn 0.3s ease;
    margin-bottom: 1rem;
}

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

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

.message.agent {
    justify-content: flex-start;
}

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

.message.user .message-avatar {
    background: linear-gradient(135deg, #4a90e2 0%, #7b68ee 100%);
}

.message.agent .message-avatar {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.message-content {
    max-width: 70%;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(74, 144, 226, 0.1);
}

.message-content p {
    color: #e0e0e0;
    margin: 0;
    word-wrap: break-word;
}

.message.user .message-content {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(123, 104, 238, 0.1) 100%);
    border-color: rgba(74, 144, 226, 0.3);
    margin-left: auto;
    border-radius: 18px 18px 4px 18px;
}

.message.agent .message-content {
    border-radius: 18px 18px 18px 4px;
}

.message-time {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.5rem;
}

.chat-footer {
    padding: 1rem 2rem;
    background: linear-gradient(180deg, transparent 0%, #1a1a2e 100%);
    border-top: 1px solid rgba(74, 144, 226, 0.2);
}

.connection-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.info-label {
    color: #888;
}

.info-value {
    color: #4a90e2;
    font-weight: 500;
}

.error-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #1a1a2e;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    max-width: 500px;
    width: 90%;
}

.modal-content h3 {
    color: #ef4444;
    margin-bottom: 1rem;
}

.modal-content button {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: #ef4444;
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .left-panel {
        width: 100%;
        min-width: auto;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid rgba(74, 144, 226, 0.3);
    }
    
    .message-content {
        max-width: 85%;
    }
}