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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    padding: 40px;
    animation: slideUp 0.6s ease-out;
}

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

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

h1 {
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

.selectors {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.role-selector, .voice-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.role-selector label, .voice-selector label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
    white-space: nowrap;
}

.role-selector select, .voice-selector select {
    padding: 10px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    background: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

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

.controls {
    text-align: center;
    margin: 30px 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

button {
    font-size: 16px;
    font-weight: 600;
    padding: 15px 30px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#startBtn {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    transform: scale(1);
}

#startBtn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.3);
}

#stopBtn {
    background: linear-gradient(45deg, #f44336, #da190b);
    color: white;
}

#stopBtn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(244, 67, 54, 0.3);
}

button:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    transform: scale(0.95);
    opacity: 0.6;
}

.status {
    text-align: center;
    margin: 25px 0;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.audio-visualizer {
    width: 100%;
    height: 80px;
    background: linear-gradient(45deg, #2c3e50, #34495e);
    margin: 25px 0;
    border-radius: 15px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
    border: 2px solid #3498db;
}

.chat-log {
    border: none;
    border-radius: 15px;
    padding: 25px;
    height: 400px;
    overflow-y: auto;
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
    margin-top: 25px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

.chat-log::-webkit-scrollbar {
    width: 8px;
}

.chat-log::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-log::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 10px;
}

.message {
    margin: 15px 0;
    padding: 15px 20px;
    border-radius: 20px;
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
    position: relative;
    font-size: 14px;
    line-height: 1.5;
}

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

.user-message {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 5px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.user-message::before {
    content: "👤 ";
    margin-right: 5px;
}

.ai-message {
    background: white;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-left: 4px solid #667eea;
}

.ai-message::before {
    content: "🤖 ";
    margin-right: 5px;
}

#errorContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.error {
    color: white;
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    padding: 15px 20px;
    border-radius: 10px;
    margin: 10px 0;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
    animation: errorSlide 0.3s ease-out;
    min-width: 300px;
}

@keyframes errorSlide {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Efectos de hover y focus mejorados */
.role-selector select:hover, .voice-selector select:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

button:active {
    transform: scale(0.98);
}

/* Responsive design mejorado */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 25px;
        border-radius: 15px;
    }
    
    .header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .selectors {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }
    
    .role-selector, .voice-selector {
        justify-content: center;
        width: 100%;
        max-width: 300px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    button {
        min-width: 200px;
    }
    
    .chat-log {
        height: 300px;
    }
    
    .message {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 20px;
    }
    
    button {
        font-size: 14px;
        padding: 12px 20px;
        min-width: 160px;
    }
    
    .audio-visualizer {
        height: 60px;
    }
    
    .role-selector select, .voice-selector select {
        min-width: 100px;
        font-size: 13px;
    }
}

/* Animación sutil para elementos interactivos */
.role-selector, .voice-selector, .message, button {
    transition: all 0.3s ease;
}

/* Loading states */
.status.loading {
    animation: pulse 2s infinite;
}

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