/* СИНЭО Voice Robot - Modern Glassmorphism Design */

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --accent: #22d3ee;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(34, 211, 238, 0.2) 0%, transparent 40%);
    animation: pulse 15s ease-in-out infinite;
    z-index: -1;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

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

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo-icon {
    width: 60px;
    height: 60px;
    background: var(--gradient);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: var(--shadow);
}

.logo-icon-img {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.robot-face-img {
    width: 120px !important;
    height: 120px !important;
    max-width: 120px !important;
    max-height: 120px !important;
    border-radius: 50%;
    object-fit: cover;
    z-index: 2;
    transition: transform 0.3s;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.3);
}

.robot-avatar.speaking .robot-face-img {
    animation: robot-bounce 0.5s ease-in-out infinite;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
}

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

/* Glass Card */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-glass);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
}

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

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

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

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

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.message.assistant .message-avatar {
    background: var(--gradient);
}

.message.user .message-avatar {
    background: var(--accent);
    color: var(--bg-dark);
}

.message-content {
    max-width: 80%;
    padding: 0.875rem 1.25rem;
    border-radius: 18px;
    line-height: 1.5;
}

.message.assistant .message-content {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message.user .message-content {
    background: var(--primary);
    border-bottom-right-radius: 4px;
}

/* Input Area */
.chat-input-area {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.chat-input {
    flex: 1;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.875rem 1rem;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

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

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
}

.btn-mic {
    background: var(--bg-glass);
    border: 2px solid var(--border);
    color: var(--text);
}

.btn-mic:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-mic.recording {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
    color: var(--error);
    animation: pulse-recording 1.5s ease-in-out infinite;
}

@keyframes pulse-recording {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }
}

/* Stage Indicator */
.stage-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--bg-glass);
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

.stage-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--gradient);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Script Stages */
.script-stages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stage-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.3s;
}

.stage-item.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
}

.stage-item.completed {
    opacity: 0.6;
}

.stage-number {
    width: 28px;
    height: 28px;
    background: var(--bg-glass);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.stage-item.active .stage-number {
    background: var(--gradient);
}

.stage-item.completed .stage-number {
    background: var(--success);
}

.stage-name {
    flex: 1;
    font-size: 0.875rem;
}

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    margin-top: 1rem;
    background: var(--bg-glass);
    border-radius: 12px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

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

.status-dot.connected {
    background: var(--success);
    animation: blink 2s infinite;
}

.status-dot.disconnected {
    background: var(--error);
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Visualizer */
.audio-visualizer {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 1rem;
    background: var(--bg-glass);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.visualizer-bar {
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 2px;
    transition: height 0.1s ease;
}

.visualizer-bar.active {
    animation: visualize 0.5s ease-in-out infinite;
}

@keyframes visualize {

    0%,
    100% {
        height: 20px;
    }

    50% {
        height: 40px;
    }
}

/* Loading */
.loading {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: var(--primary-light);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }
}

/* Large Mic Button */
.mic-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
}

/* Robot Avatar */
.robot-avatar {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.robot-face {
    font-size: 4rem;
    z-index: 2;
    transition: transform 0.3s;
}

.robot-avatar.speaking .robot-face {
    animation: robot-bounce 0.5s ease-in-out infinite;
}

@keyframes robot-bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Speaking waves animation */
.speaking-waves {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.robot-avatar.speaking .speaking-waves {
    opacity: 1;
}

.speaking-waves span {
    position: absolute;
    border: 3px solid var(--primary);
    border-radius: 50%;
    animation: speaking-wave 1.5s ease-out infinite;
}

.speaking-waves span:nth-child(1) {
    width: 80px;
    height: 80px;
    animation-delay: 0s;
}

.speaking-waves span:nth-child(2) {
    width: 110px;
    height: 110px;
    animation-delay: 0.3s;
}

.speaking-waves span:nth-child(3) {
    width: 140px;
    height: 140px;
    animation-delay: 0.6s;
}

@keyframes speaking-wave {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

.btn-mic-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--gradient);
    border: none;
    font-size: 3rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-mic-large:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 50px rgba(99, 102, 241, 0.5);
}

.btn-mic-large.recording {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    animation: pulse-recording 1.5s ease-in-out infinite;
    box-shadow: 0 10px 40px rgba(239, 68, 68, 0.4);
}

.mic-hint {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Call Button (Phone Simulation) */
.btn-call-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    font-size: 3rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 40px rgba(16, 185, 129, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-call-large:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 50px rgba(16, 185, 129, 0.5);
}

.btn-call-large.calling {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    animation: pulse-call 1s infinite;
}

.btn-call-large.connected {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 10px 40px rgba(239, 68, 68, 0.4);
}

.btn-call-large.connected:hover {
    box-shadow: 0 15px 50px rgba(239, 68, 68, 0.6);
}

@keyframes pulse-call {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 10px 40px rgba(245, 158, 11, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 15px 60px rgba(245, 158, 11, 0.7);
    }
}

.call-hint {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    margin-top: 0.5rem;
}


/* Transcript */
.transcript-container {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.transcript-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 500;
}

.transcript {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 0.5rem;
}

.transcript::-webkit-scrollbar {
    width: 4px;
}

.transcript::-webkit-scrollbar-track {
    background: transparent;
}

.transcript::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.transcript-entry {
    padding: 0.75rem 1rem;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    animation: slideIn 0.3s ease-out;
}

.transcript-entry.robot {
    border-left: 3px solid var(--primary);
}

.transcript-entry.user {
    border-left: 3px solid var(--accent);
}

.transcript-entry.system {
    border-left: 3px solid var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.entry-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.entry-icon {
    font-size: 0.875rem;
}

.entry-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.entry-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
}

.entry-text {
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text);
}

/* Client Info JSON Display */
.client-info-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
}

.client-info-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.client-info-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient);
}

.json-display {
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    color: #e2e8f0;
    background: transparent;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* JSON Syntax Highlighting */
.json-key {
    color: #a78bfa;
    font-weight: 500;
}

.json-string {
    color: #34d399;
}

.json-number {
    color: #fbbf24;
}

.json-null {
    color: #94a3b8;
    font-style: italic;
}

.json-boolean {
    color: #f472b6;
}

/* Animated pulse when data updates */
.client-info-container.updated {
    animation: info-pulse 0.5s ease-out;
}

@keyframes info-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}