/* VaniAI Core CSS Stylesheet - Premium Glassmorphism & Aesthetics */

:root {
    --bg-color: #0b071a;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.05);
    --card-border-glow: rgba(99, 102, 241, 0.25);
    
    --primary-color: #6366f1; /* Indigo */
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary-color: #06b6d4; /* Cyan */
    --accent-purple: #a855f7; /* Violet */
    --accent-emerald: #10b981; /* Emerald Green */
    --accent-amber: #f59e0b; /* Amber Gold */
    --accent-crimson: #ef4444; /* Crimson Red */
    
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    
    --font-header: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets & animations */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Background Animated Ambient Glow Blobs */
.glow-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(130px);
    z-index: -1;
    opacity: 0.4;
    animation: blob-float 20s infinite alternate ease-in-out;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--primary-glow) 0%, rgba(0,0,0,0) 70%);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.3) 0%, rgba(0,0,0,0) 70%);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.2) 0%, rgba(0,0,0,0) 70%);
    top: 50%;
    left: 45%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes blob-float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, -40px) scale(1.15); }
    100% { transform: translate(-30px, 60px) scale(0.9); }
}

/* Application Layout Container */
.app-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Premium Glassmorphic Card Mixin */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
}

/* Header Area */
.glass-header {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.5));
}

.logo-text h1 {
    font-family: var(--font-header);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.status-panel {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: relative;
}

.pulse-dot.green {
    background-color: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
}

.pulse-dot.green::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent-emerald);
    animation: pulse-ring 1.5s infinite;
}

.pulse-dot.red {
    background-color: var(--accent-crimson);
    box-shadow: 0 0 8px var(--accent-crimson);
}

.pulse-dot.red::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent-crimson);
    animation: pulse-ring 1.5s infinite;
}

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

.sip-uri-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(6, 182, 212, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--secondary-color);
}

/* Dashboard Layout Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.grid-col-left, .grid-col-right {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Metrics Cards Row */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.metric-card {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}

.metric-icon.blue { background: rgba(99, 102, 241, 0.1); color: var(--primary-color); border: 1px solid rgba(99, 102, 241, 0.2); }
.metric-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.2); }
.metric-icon.purple { background: rgba(168, 85, 247, 0.1); color: var(--accent-purple); border: 1px solid rgba(168, 85, 247, 0.2); }
.metric-icon.emerald { background: rgba(6, 182, 212, 0.1); color: var(--secondary-color); border: 1px solid rgba(6, 182, 212, 0.2); }

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

.metric-info h3 {
    font-family: var(--font-header);
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: 2px;
}

.pulse-text {
    animation: text-pulse 2s infinite alternate;
}

@keyframes text-pulse {
    0% { opacity: 0.8; }
    100% { opacity: 1; text-shadow: 0 0 10px rgba(16, 185, 129, 0.4); }
}

.green-text { color: var(--accent-emerald); }

/* Panel Card Settings */
.panel-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-family: var(--font-header);
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h2 i {
    color: var(--primary-color);
}

.badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.badge-active {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: var(--accent-crimson) !important;
    animation: badge-pulse 1.5s infinite alternate;
}

@keyframes badge-pulse {
    0% { box-shadow: 0 0 4px rgba(239, 68, 68, 0.2); }
    100% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.4); }
}

/* Call Logs Panel & Rows */
.logs-panel {
    flex-grow: 1;
    min-height: 480px;
}

.logs-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: 400px;
    padding-right: 6px;
}

.logs-container::-webkit-scrollbar {
    width: 6px;
}
.logs-container::-webkit-scrollbar-track {
    background: transparent;
}
.logs-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}
.logs-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.1);
}

.log-item {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.log-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(99, 102, 241, 0.2);
    transform: translateX(4px);
}

.log-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-phone {
    font-weight: 600;
    font-size: 0.95rem;
}

.log-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
}

.log-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sentiment-tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 50px;
    text-transform: capitalize;
}

.sentiment-tag.positive { background: rgba(16, 185, 129, 0.1); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.2); }
.sentiment-tag.neutral { background: rgba(245, 158, 11, 0.1); color: var(--accent-amber); border: 1px solid rgba(245, 158, 11, 0.2); }
.sentiment-tag.negative { background: rgba(239, 68, 68, 0.1); color: var(--accent-crimson); border: 1px solid rgba(239, 68, 68, 0.2); }

.log-arrow {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-muted);
    gap: 16px;
    padding: 40px 0;
}

.empty-state i {
    font-size: 2.5rem;
    color: var(--primary-glow);
}

/* Visual Editor Form Elements */
.config-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label i {
    color: var(--secondary-color);
}

.glass-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: var(--transition-smooth);
    outline: none;
}

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

select.glass-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
}

.text-area {
    resize: none;
    line-height: 1.5;
}

/* Premium Dynamic Buttons */
.glow-btn {
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-family: var(--font-header);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(1px);
}

.icon-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Call Simulator & Virtual Phone */
.simulator-body {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
    align-items: start;
}

.virtual-phone {
    background: #000;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-radius: 36px;
    overflow: hidden;
    height: 340px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), inset 0 0 10px rgba(255,255,255,0.05);
}

.phone-screen {
    flex-grow: 1;
    background: radial-gradient(circle at top, #1c1538 0%, #080512 80%);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.phone-network-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
}

.phone-calling-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.caller-avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.6rem;
    color: #e2e8f0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.phone-calling-info h4 {
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 700;
}

.phone-calling-info span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Animated Speech Audio Waveform */
.audio-waveform-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    height: 30px;
    margin: 10px 0;
    opacity: 0;
    transition: var(--transition-smooth);
}

.audio-waveform-container.active {
    opacity: 1;
}

.wave-bar {
    width: 3px;
    height: 10px;
    background: var(--secondary-color);
    border-radius: 4px;
    animation: wave-bounce 0.8s ease-in-out infinite alternate;
}

.wave-bar:nth-child(even) {
    background: var(--primary-color);
    animation-delay: 0.15s;
    height: 18px;
}
.wave-bar:nth-child(3n) { animation-delay: 0.3s; height: 14px; }
.wave-bar:nth-child(4n) { animation-delay: 0.45s; height: 24px; }

@keyframes wave-bounce {
    0% { transform: scaleY(0.4); }
    100% { transform: scaleY(1.4); }
}

.phone-status-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 170px;
    line-height: 1.3;
}

.phone-controls {
    padding: 16px;
    background: #080611;
    display: flex;
    justify-content: center;
}

.phone-btn {
    border: none;
    border-radius: 12px;
    padding: 10px 20px;
    font-family: var(--font-header);
    font-weight: 600;
    font-size: 0.85rem;
    width: 100%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.call-start-btn {
    background: var(--accent-emerald);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}
.call-start-btn:hover { background: #059669; }

.call-end-btn {
    background: var(--accent-crimson);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}
.call-end-btn:hover { background: #dc2626; }

.hidden {
    display: none !important;
}

/* Transcript Console */
.live-transcript-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    height: 340px;
    display: flex;
    flex-direction: column;
}

.transcript-title {
    padding: 12px 16px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.transcript-content {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.transcript-content::-webkit-scrollbar {
    width: 4px;
}
.transcript-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
}

.system-message {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
    margin: auto 0;
}

.chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    animation: bubble-fade 0.25s ease-out;
}

@keyframes bubble-fade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-bubble.customer {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

.chat-bubble.agent {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.18);
    align-self: flex-end;
    border-bottom-right-radius: 3px;
    color: var(--text-primary);
}

.speaker-tag {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 4px;
    display: block;
}
.customer .speaker-tag { color: var(--secondary-color); }
.agent .speaker-tag { color: var(--primary-color); }

/* Modal Detail Dialog styling */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 3, 10, 0.7);
    backdrop-filter: blur(12px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
}

.modal-content {
    width: 100%;
    max-width: 600px;
    padding: 24px;
    animation: modal-enter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-enter {
    from { transform: scale(0.9) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: var(--font-header);
    font-size: 1.25rem;
    font-weight: 700;
}

.call-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 14px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.call-meta-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.divider {
    border: none;
    border-bottom: 1px solid var(--card-border);
    margin: 16px 0;
}

.transcript-section h4 {
    font-family: var(--font-header);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.full-transcript-text {
    max-height: 250px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    font-size: 0.88rem;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.full-transcript-text::-webkit-scrollbar {
    width: 4px;
}
.full-transcript-text::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
}

/* Responsiveness adjustments */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .simulator-body {
        grid-template-columns: 1fr;
    }
    .virtual-phone {
        height: 260px;
    }
}
