/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Logo Header */
.logo-header {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    z-index: 0;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.logo-header:hover {
    opacity: 0.8;
}

.app-logo {
    width: 32px;
    height: 32px;
}

.app-name {
    display: none;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8f9fa;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    padding-bottom: 50px;
    padding-top: 30px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}



/* Main content layout */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 20px;
}

/* Panel styles */
.config-panel,
.conversation-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.config-section h2,
.conversation-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-section h2 i,
.conversation-header h2 i {
    color: #667eea;
}

/* Entity configuration cards */
.entity-config {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.entity-card {
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    padding: 20px;
    transition: all 0.3s ease;
    background: #fafafa;
}

.entity-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.1);
}

.entity-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.entity-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.entity-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 2px;
}

.entity-header p {
    color: #718096;
    font-size: 0.9rem;
}

/* Form styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Range input styling */
input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 5px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.speed-value,
.temp-value,
.top-p-value {
    font-size: 0.8rem;
    color: #718096;
    font-weight: 500;
}

/* Button styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-icon {
    padding: 10px;
    border-radius: 8px;
    background: #f7fafc;
    color: #4a5568;
    min-width: 40px;
}

.control-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Conversation panel */
.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #4a5568;
}

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

.status-dot.connected {
    background: #38a169;
}

.status-dot.connecting {
    background: #d69e2e;
    animation: pulse 2s infinite;
}

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

/* Conversation container */
.conversation-container {
    min-height: 500px;
    max-height: 600px;
    overflow-y: auto;
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    padding: 20px;
    background: #fafafa;
    margin-bottom: 20px;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.welcome-icon {
    font-size: 4rem;
    color: #cbd5e0;
    margin-bottom: 20px;
}

.welcome-message h3 {
    font-size: 1.5rem;
    color: #4a5568;
    margin-bottom: 10px;
}

/* Message styles */
.message {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    animation: slideIn 0.5s ease-out;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.message-avatar.entity-1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.message-avatar.entity-2 {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.message-content {
    flex: 1;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.message-sender {
    font-weight: 600;
    color: #2d3748;
}

.message-time {
    font-size: 0.8rem;
    color: #a0aec0;
}

.message-text {
    color: #4a5568;
    line-height: 1.6;
    word-wrap: break-word;
}

.message.speaking {
    opacity: 0.7;
}

.message.speaking .message-avatar {
    animation: speaking 1.5s ease-in-out infinite;
}

@keyframes speaking {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Audio controls */
.audio-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.volume-control {
    flex: 1;
    max-width: 150px;
}

.volume-control input[type="range"] {
    margin: 0;
}

.audio-status {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 500;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    color: #e53e3e;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #a0aec0;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #f7fafc;
    color: #4a5568;
}

.modal-body {
    padding: 25px 30px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e2e8f0;
    text-align: right;
}

/* Circular Waveform visualization */
.waveform-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    position: relative;
}

.waveform-canvas {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: transparent;
    border: 3px solid #e2e8f0;
    transition: all 0.3s ease;
}

.waveform-canvas.entity-1 {
    border-color: rgba(102, 126, 234, 0.3);
}

.waveform-canvas.entity-2 {
    border-color: rgba(240, 147, 251, 0.3);
}

.waveform-container.active .waveform-canvas.entity-1 {
    border-color: #667eea;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.3);
}

.waveform-container.active .waveform-canvas.entity-2 {
    border-color: #f093fb;
    box-shadow: 0 0 30px rgba(240, 147, 251, 0.3);
}

/* Entity title styling */
.entity-title {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 15px;
    margin-top: 0;
    position: relative;
}

.entity-card[data-entity="1"] .entity-title {
    color: #667eea;
}

.entity-card[data-entity="2"] .entity-title {
    color: #f093fb;
}

/* Sample conversations dropdown */
.sample-conversations {
    margin-bottom: 30px;
    text-align: center;
}

.sample-conversations label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2d3748;
    font-size: 1.1rem;
}

.sample-conversations label i {
    margin-right: 8px;
    color: #667eea;
}

.sample-conversations select {
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    font-size: 1rem;
    color: #2d3748;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 300px;
    font-weight: 500;
}

.sample-conversations select:hover {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.sample-conversations select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Character counter and textarea container */
.textarea-container {
    position: relative;
}

.character-counter {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 0.75rem;
    color: #a0aec0;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    user-select: none;
}

.character-counter.warning {
    color: #d69e2e;
}

.character-counter.error {
    color: #e53e3e;
    font-weight: 600;
}

/* Settings toggle button */
.settings-toggle {
    width: 100%;
    padding: 12px 16px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0 10px 0;
    font-family: inherit;
}

.settings-toggle:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

.settings-toggle:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.settings-toggle:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #a0aec0;
    transform: none !important;
}

.settings-toggle:disabled:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
    transform: none;
}

.settings-toggle .fa-cog {
    margin-right: 8px;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.settings-toggle.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Settings panel */
.settings-panel {
    overflow: hidden;
    transition: all 0.3s ease;
    background: #fafafa;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    margin-bottom: 15px;
}

.settings-panel.collapsed {
    max-height: 0;
    border: none;
    margin-bottom: 0;
}

.settings-panel:not(.collapsed) {
    max-height: 500px;
    padding: 20px;
}

/* Responsive design */
@media (max-width: 1200px) {
    .conversation-container {
        min-height: 400px;
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    /* Stack entity cards vertically on mobile */
    .entity-config {
        grid-template-columns: 1fr;
    }
    
    /* Smaller circular waveforms on mobile */
    .waveform-canvas {
        width: 150px;
        height: 150px;
    }
    
    .config-panel,
    .conversation-panel {
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .control-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .conversation-header {
        flex-direction: column;
        gap: 15px;
        align-items: start;
    }
    
    .message {
        gap: 10px;
    }
    
    .message-avatar {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .audio-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .volume-control {
        max-width: none;
        width: 100%;
    }
}

@media (max-width: 480px) {
    /* Even smaller waveforms on very small screens */
    .waveform-canvas {
        width: 120px;
        height: 120px;
    }
    
    .conversation-container {
        min-height: 300px;
        max-height: 400px;
        padding: 15px;
    }
    
    .welcome-message {
        padding: 40px 15px;
    }
    
    .welcome-icon {
        font-size: 3rem;
    }
    
    .settings-panel:not(.collapsed) {
        padding: 15px;
    }
}

/* Custom scrollbar */
.conversation-container::-webkit-scrollbar {
    width: 8px;
}

.conversation-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.conversation-container::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.conversation-container::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Smooth transitions */
* {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
}

/* Footer styles */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid #e2e8f0;
    padding: 12px 0;
    z-index: 1000;
    font-size: 0.8rem;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    color: #64748b;
}

.footer-content a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

.footer-content a:hover {
    color: #667eea;
}

.footer-separator {
    color: #cbd5e0;
}


