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

:root {
    --bg-primary: #0f0f12;
    --bg-secondary: #16161d;
    --bg-tertiary: #1c1c26;
    --accent: #10b981;
    --accent-hover: #34d399;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border: rgba(255, 255, 255, 0.08);
    --success: #22c55e;
    --danger: #ef4444;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
}

.logo-text {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.logo-text span {
    color: var(--accent);
}

.status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.connecting {
    background: #f59e0b;
    animation: pulse 1.5s ease-in-out infinite;
}

.status-text {
    color: var(--text-secondary);
}

.main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 32px;
}

.avatar-section {
    position: relative;
}

.avatar-container {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
}

#agent-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

#agent-video.active {
    display: block;
}

.avatar-placeholder {
    text-align: center;
    padding: 40px;
}

.avatar-placeholder.hidden {
    display: none;
}

.avatar-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--accent), #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-icon svg {
    width: 40px;
    height: 40px;
    stroke: white;
    fill: none;
    stroke-width: 1.5;
}

.avatar-placeholder p {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.avatar-placeholder span {
    font-size: 14px;
    color: var(--text-muted);
}

.audio-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    opacity: 0;
    transition: opacity 0.3s;
}

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

.audio-indicator .bar {
    width: 3px;
    height: 20px;
    background: var(--accent);
    border-radius: 2px;
    animation: sound 0.6s infinite ease-in-out;
}

.audio-indicator .bar:nth-child(1) { animation-delay: 0s; }
.audio-indicator .bar:nth-child(2) { animation-delay: 0.1s; }
.audio-indicator .bar:nth-child(3) { animation-delay: 0.2s; }
.audio-indicator .bar:nth-child(4) { animation-delay: 0.3s; }
.audio-indicator .bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes sound {
    0%, 100% { height: 8px; }
    50% { height: 24px; }
}

.user-video-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 180px;
    height: 120px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border);
    display: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.user-video-container.active {
    display: block;
}

#user-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
}

.chat-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.chat-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 300px;
    max-height: 450px;
}

.chat-message {
    padding: 14px 18px;
    border-radius: 12px;
    max-width: 90%;
    font-size: 14px;
    line-height: 1.6;
}

.chat-message.agent {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message.user {
    background: var(--accent);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message .sender {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.chat-input {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.chat-input input {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input input::placeholder {
    color: var(--text-muted);
}

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

.chat-input button {
    width: 44px;
    height: 44px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-input button:hover {
    background: var(--accent-hover);
}

.chat-input button svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 32px 0 16px;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
}

.control-btn:hover:not(:disabled) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

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

.control-btn.active {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.control-btn.primary {
    flex-direction: row;
    gap: 10px;
    padding: 16px 40px;
    background: var(--accent);
    border: none;
    color: white;
    font-size: 15px;
    font-weight: 600;
}

.control-btn.primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.3);
}

.control-btn.primary.connected {
    background: var(--danger);
}

.control-btn.primary.connected:hover:not(:disabled) {
    background: #dc2626;
    box-shadow: 0 8px 30px rgba(239, 68, 68, 0.3);
}

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

.footer-info {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.footer-info a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.footer-info a:hover {
    text-decoration: underline;
}

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

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

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

@media (max-width: 1000px) {
    .main {
        grid-template-columns: 1fr;
    }

    .chat-container {
        max-height: 350px;
    }

    .controls {
        flex-wrap: wrap;
    }

    .container {
        padding: 16px;
    }
}
