/**
 * 🎨 Voice Assistant - Main Styles v2.0 (Refactorizado)
 *
 * USANDO SISTEMA DE TEMA CENTRALIZADO (theme.css)
 * Mobile-first, accesible, con design tokens unificados
 *
 * ESTRUCTURA:
 * 1. Base Styles & Reset
 * 2. Layout Principal (App Container, Header, Footer)
 * 3. Chat & Mensajes (Burbujas, Typing, Timestamps)
 * 4. Controles de Voz (Botones, Estados)
 * 5. Voice Call Overlay (Modal, Controles)
 * 6. Notificaciones & Toasts
 * 7. Estados Dinámicos (Manipulados por JS)
 * 8. Responsive Design
 * 9. Accesibilidad & Animations
 */

/* =============================================
   🏗️ BASE STYLES & RESET
   ============================================= */
* {
    box-sizing: border-box;
}

html {
    height: 100%;
    touch-action: manipulation;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    margin: 0;
    height: 100%;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Roboto", "Helvetica Neue", sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--theme-text-primary);
    background-color: var(--theme-bg-primary);
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
}

/* Permitir selección de texto en elementos específicos */
.text-input,
.message-bubble,
.welcome-message {
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
}

/* =============================================
   🏠 LAYOUT PRINCIPAL
   ============================================= */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-width: 768px;
    margin: 0 auto;
    background-color: var(--theme-chat-bg);
    position: relative;
    overflow: hidden;
}

/* 📱 HEADER */
.app-header {
    background-color: var(--theme-bg-tertiary);
    border-bottom: 1px solid var(--theme-border-primary);
    z-index: 10;
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    min-height: 60px;
}

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

/* 👤 User Info Section */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.avatar-container {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--theme-bg-tertiary);
    flex-shrink: 0;
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-text-secondary);
    font-size: 1.125rem;
}

.avatar-image:not([style*="display: none"]) + .avatar-fallback {
    opacity: 0;
    pointer-events: none;
}

.user-details {
    min-width: 0;
    flex: 1;
}

.assistant-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--theme-text-primary);
    margin: 0;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 🔗 Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--theme-text-secondary);
    margin-top: 2px;
}

.status-icon {
    font-size: 8px;
    animation: pulse 2s infinite;
}

.connection-status.status-connecting .status-icon {
    color: var(--theme-status-connecting);
    animation: spin 1s linear infinite;
}

.connection-status.status-connected .status-icon {
    color: var(--theme-status-connected);
    animation: none;
}

.connection-status.status-error .status-icon {
    color: var(--theme-status-error);
    animation: pulse 1s infinite;
}

/* 🎛️ Header Controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background-color: var(--theme-bg-tertiary);
    color: var(--theme-text-secondary);
    cursor: pointer;
    transition: all 150ms ease-out;
    font-size: 1rem;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:hover {
    background-color: var(--theme-bg-quaternary);
    color: var(--theme-text-primary);
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn:focus-visible {
    outline: 2px solid var(--theme-primary);
    outline-offset: 2px;
}

/* =============================================
   💬 CHAT CONTAINER & MENSAJES
   ============================================= */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--theme-bg-tertiary) transparent;
}

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

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

.chat-container::-webkit-scrollbar-thumb {
    background-color: var(--theme-bg-tertiary);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background-color: var(--theme-bg-quaternary);
}

/* 👋 Welcome Message */
.welcome-message {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--theme-text-secondary);
    max-width: 300px;
    margin: auto;
}

.welcome-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: var(--theme-bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: var(--theme-primary);
}

.welcome-message h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--theme-text-primary);
    margin: 0 0 0.5rem;
}

.welcome-message p {
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0;
}

/* 💭 Message Bubbles */
.message-bubble {
    max-width: 85%;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    position: relative;
    word-wrap: break-word;
    font-size: 0.875rem;
    line-height: 1.4;
    animation: slideInMessage 250ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
    margin-bottom: 0.25rem;
    text-rendering: optimizeLegibility;
}

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

/* Usuario Messages */
.message-bubble.user {
    background-color: var(--theme-bubble-user-bg);
    color: var(--theme-bubble-user-text);
    margin-left: auto;
    margin-right: 0;
    border-bottom-right-radius: 2px;
}

.message-bubble.user:hover {
    background-color: var(--theme-bubble-user-hover);
}

/* Bot Messages */
.message-bubble.bot {
    background-color: var(--theme-bubble-bot-bg);
    color: var(--theme-bubble-bot-text);
    margin-left: 0;
    margin-right: auto;
    border-bottom-left-radius: 2px;
}

.message-bubble.bot:hover {
    background-color: var(--theme-bubble-bot-hover);
}

/* 🎬 Streaming Animation */
.message-bubble.streaming {
    position: relative;
}

.cursor {
    color: var(--theme-text-primary);
    font-weight: 700;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%,
    50% {
        opacity: 1;
    }
    51%,
    100% {
        opacity: 0;
    }
}

/* ⏰ Timestamps */
.timestamp {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    text-align: right;
    opacity: 0.7;
    color: inherit;
}

.tick {
    margin-left: 2px;
    font-size: 10px;
}

/* ⌨️ Typing Indicator */
.typing-bubble {
    background-color: var(--theme-bubble-bot-bg);
    color: var(--theme-bubble-bot-text);
    margin-left: 0;
    margin-right: auto;
    border-bottom-left-radius: 2px;
    padding: 0.75rem;
    max-width: 80px;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--theme-border-primary);
}

.typing-animation {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    height: 20px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--theme-text-secondary);
    animation: typingBounce 1.4s infinite ease-in-out both;
    opacity: 0.6;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}
.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    40% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* 🔄 TTS Replay Button */
.latest-bot-message {
    position: relative;
    padding-right: 40px;
}

.tts-replay-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--theme-overlay-light);
    color: var(--theme-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: absolute;
    right: 8px;
    top: 8px;
}

.tts-replay-btn:hover {
    background: var(--theme-overlay-medium);
    transform: scale(1.1);
    color: var(--theme-text-primary);
}

.tts-replay-btn:active {
    transform: scale(0.95);
}

.tts-replay-btn.playing {
    background: var(--theme-primary);
    color: white;
    animation: pulse 1.5s infinite;
}

/* =============================================
   📝 MESSAGE INPUT
   ============================================= */
.message-input-container {
    background-color: var(--theme-bg-tertiary);
    border-top: 1px solid var(--theme-border-primary);
    padding: 0.5rem 1rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    flex-shrink: 0;
    z-index: 10;
}

.message-form {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background-color: var(--theme-bg-secondary);
    border-radius: 24px;
    padding: 0.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.text-input-container {
    flex: 1;
    min-width: 0;
}

.text-input {
    width: 100%;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 1rem;
    color: var(--theme-text-primary);
    padding: 0.75rem 1rem;
    resize: none;
    outline: none;
    line-height: 1.4;
    max-height: 120px;
    -webkit-appearance: none;
    border-radius: 12px;
}

.text-input::placeholder {
    color: var(--theme-text-tertiary);
}

.send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background-color: var(--theme-primary);
    color: white;
    cursor: pointer;
    transition: all 150ms ease-out;
    font-size: 1rem;
    -webkit-tap-highlight-color: transparent;
}

.send-btn:hover {
    background-color: var(--theme-primary-hover);
    transform: scale(1.05);
}

.send-btn:active {
    background-color: var(--theme-primary-active);
    transform: scale(0.95);
}

.send-btn:focus-visible {
    outline: 2px solid var(--theme-primary);
    outline-offset: 2px;
}

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

/* =============================================
   🎤 AUDIO & VOICE CONTROLS
   ============================================= */

/* Audio Button States */
.audio-btn {
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.audio-btn:hover:not(.audio-required) {
    transform: scale(1.05);
}

.audio-btn.animate-pulse {
    animation: pulse 2s infinite;
}

.audio-btn.audio-required {
    background-color: var(--theme-warning);
    color: white !important;
    animation: pulse 2s infinite;
}

.audio-btn.enabled {
    background-color: var(--theme-primary);
    color: white !important;
    animation: none;
}

.audio-btn.muted {
    background-color: var(--theme-warning) !important;
    color: white !important;
    animation: none;
}

/* 🔴 PUNTO ROJO del Audio Button - RESTAURADO */
.audio-btn.audio-required::after {
    content: "";
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background-color: var(--theme-error);
    border: 2px solid var(--theme-bg-tertiary);
    border-radius: 50%;
    z-index: 10;
}

/* Call Button */
.call-btn {
    background-color: var(--theme-error);
    color: white;
}

.call-btn.active {
    background-color: var(--theme-primary);
}

/* =============================================
   🎤 VOICE ACTIVITY INDICATOR (Chat Principal)
   ============================================= */

/* Container del indicador de actividad de voz en chat */
.voice-activity-container {
    position: absolute;
    top: calc(1rem + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1020;
    pointer-events: none;
    opacity: 0;
    transition: all var(--voice-transition-normal);
    visibility: hidden;
}

.voice-activity-container.active {
    opacity: 1;
    visibility: visible;
}

/* 🎯 Indicador de micrófono usuario (punto que crece) */
/* 🟢 Indicador visual del micrófono */
.user-mic-indicator {
    /* Tamaño y forma */
    width: 24px;
    height: 24px;
    border-radius: 50%;

    /* Color verde WhatsApp - Usuario hablando */
    background: rgba(0, 168, 132, 0.95);

    /* Bordes y sombras */
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0, 168, 132, 0.4),
        0 0 0 4px rgba(0, 168, 132, 0.15);

    /* Animación sutil de pulso */
    animation: userMicPulse 2s infinite ease-in-out;

    /* Posición relativa para punto interno */
    position: relative;
}

/* Punto blanco interno */
.user-mic-indicator::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    opacity: 0.9;
}

/* Animación del indicador de micrófono */
@keyframes userMicPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 4px rgba(0, 211, 86, 0.2),
            0 2px 8px rgba(0, 211, 86, 0.3);
    }
    50% {
        transform: scale(1.3);
        box-shadow: 0 0 0 8px rgba(0, 211, 86, 0.1),
            0 4px 16px rgba(0, 211, 86, 0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 4px rgba(0, 211, 86, 0.2),
            0 2px 8px rgba(0, 211, 86, 0.3);
    }
}

/* Cuando el usuario deja de hablar */
.user-mic-indicator.inactive {
    background-color: var(--theme-text-secondary);
    animation: none;
    box-shadow: 0 0 0 2px rgba(134, 150, 160, 0.2),
        0 1px 4px rgba(134, 150, 160, 0.3);
}

/* 🏷️ Label del indicador de micrófono */
.user-mic-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--theme-text-primary);
    background: var(--theme-bg-secondary);
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid var(--theme-border-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-align: center;
    min-width: 100px;
}

/* =============================================
   📞 VOICE CALL OVERLAY
   ============================================= */
.call-overlay {
    position: fixed;
    inset: 0;
    background: var(--theme-bg-primary);
    backdrop-filter: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 250ms ease;
    pointer-events: none;
}

.call-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.call-container {
    width: 320px;
    max-width: 90vw;
    background: rgba(32, 44, 51, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--theme-border-secondary);
    border-radius: 24px;
    padding: 2rem 1.5rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-align: center;
    position: relative;
    animation: slideInCall 350ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

/* 🟢 Voice Activity Indicator */
.voice-activity {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    z-index: 20;
}

.voice-activity-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--theme-voice-activity);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 168, 132, 0.4),
        0 0 0 4px rgba(0, 168, 132, 0.1);
    animation: voiceActivityPulse 2s infinite ease-in-out;
}

.voice-activity-content::after {
    content: "";
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    opacity: 0.9;
}

@keyframes voiceActivityPulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(0, 168, 132, 0.4),
            0 0 0 4px rgba(0, 168, 132, 0.1);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(0, 168, 132, 0.6),
            0 0 0 8px rgba(0, 168, 132, 0.2);
    }
}

.voice-activity-content.thinking {
    background: var(--theme-voice-thinking);
    box-shadow: 0 2px 8px rgba(255, 171, 0, 0.4),
        0 0 0 4px rgba(255, 171, 0, 0.1);
    animation: voiceThinkingPulse 1.5s infinite ease-in-out;
}

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

/* 🎭 Call Avatar */
.call-avatar-container {
    margin-bottom: 1.5rem;
}

.call-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    background-color: var(--theme-bg-tertiary);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.5);
    border: 3px solid var(--theme-border-secondary);
}

.call-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 2;
}

.call-avatar-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-text-secondary);
    font-size: 3rem;
    z-index: 1;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.call-avatar-image:not([style*="display: none"]) + .call-avatar-fallback {
    opacity: 0;
    pointer-events: none;
}

/* 📝 Call Info */
.call-info {
    margin-bottom: 2rem;
}

.call-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--theme-text-primary);
    margin: 0 0 0.5rem;
}

.call-status {
    font-size: 0.875rem;
    color: var(--theme-text-secondary);
    margin: 0;
}

/* 🎛️ Call Controls */
.call-controls {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.call-control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 150ms ease-out;
    font-size: 1.25rem;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
}

.call-control-btn:hover {
    transform: scale(1.05);
}

.call-control-btn:active {
    transform: scale(0.95);
}

.call-control-btn:focus-visible {
    outline: 3px solid white;
    outline-offset: 3px;
}

.mute-btn {
    background-color: var(--theme-bg-quaternary);
    color: white;
}

.mute-btn.mic-muted {
    background-color: var(--theme-error);
}

.hangup-btn {
    background-color: var(--theme-error);
    color: white;
}

.hangup-btn:hover {
    background-color: var(--theme-error);
    filter: brightness(1.1);
}

/* =============================================
   📺 CALL SUBTITLES
   ============================================= */
.call-subtitles {
    position: fixed;
    bottom: 140px;
    left: 1rem;
    right: 1rem;
    text-align: center;
    z-index: 1010;
    pointer-events: none;
}

.call-subtitles .subtitle-content {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    line-height: 1.4;
    max-width: 400px;
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.subtitle-cursor {
    animation: blink 1s infinite;
    color: rgba(255, 255, 255, 0.8);
}

/* =============================================
   🍞 TOAST NOTIFICATIONS
   ============================================= */
.toast-base {
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    max-width: 300px;
    pointer-events: auto;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-success {
    background-color: var(--theme-success);
}
.toast-error {
    background-color: var(--theme-error);
}
.toast-warning {
    background-color: var(--theme-warning);
}
.toast-info {
    background-color: var(--theme-info);
}

.toast-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    font-size: 14px;
    line-height: 1;
}

.toast-content {
    flex: 1;
    line-height: 1.4;
}

.toast-icon {
    flex-shrink: 0;
}

/* =============================================
   📶 CONNECTION QUALITY BADGE
   ============================================= */
.connection-badge {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: rgba(32, 44, 51, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--theme-border-secondary);
    border-radius: 20px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.quality-excellent {
    color: var(--theme-success);
}
.quality-good {
    color: var(--theme-warning);
}
.quality-poor {
    color: var(--theme-error);
}
.quality-lost {
    color: var(--theme-error);
}

/* =============================================
   🎭 ESTADOS DINÁMICOS (Manipulados por JS)
   ============================================= */

/* Estados de botones - REQUERIDO POR ui-manager.js */
.btn-success {
    background-color: var(--theme-success) !important;
    color: white !important;
}
.btn-error {
    background-color: var(--theme-error) !important;
    color: white !important;
}
.btn-warning {
    background-color: var(--theme-warning) !important;
    color: white !important;
}
.btn-info {
    background-color: var(--theme-info) !important;
    color: white !important;
}

/* Estados específicos de micrófono - REQUERIDO POR ui-manager.js */
.mic-muted {
    background-color: var(--theme-error) !important;
    color: white !important;
}
.mic-active {
    background-color: var(--theme-bg-quaternary) !important;
    color: var(--theme-text-primary) !important;
}

/* =============================================
   🎨 ANIMACIONES & UTILIDADES
   ============================================= */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

/* =============================================
   ♿ ACCESIBILIDAD
   ============================================= */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--theme-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    :root {
        --theme-border-primary: var(--theme-text-primary);
        --theme-border-secondary: var(--theme-text-primary);
    }
}

/* =============================================
   📱 RESPONSIVE DESIGN
   ============================================= */
@media (min-width: 576px) {
    .message-bubble {
        max-width: 70%;
    }
    .call-container {
        width: 360px;
    }
}

@media (min-width: 768px) {
    .app-container {
        border-left: 1px solid var(--theme-border-primary);
        border-right: 1px solid var(--theme-border-primary);
    }
    .header-content {
        padding: 0 0.5rem;
    }
    .message-bubble {
        max-width: 60%;
    }
    .chat-container {
        padding: 1.5rem;
    }
}

@media (min-width: 992px) {
    .message-bubble {
        max-width: 50%;
    }
}

/* =============================================
   🖨️ PRINT STYLES
   ============================================= */
@media print {
    .app-header,
    .message-input-container,
    .call-overlay {
        display: none !important;
    }
    .chat-container {
        height: auto !important;
        overflow: visible !important;
    }
}
