/**
 * VetPro Voice Assistant - Universal Styling
 * Provides consistent visual styling for voice interface components
 * across all VetPro Enterprise pages
 */

/* === VOICE WIDGET BASE STYLES === */
#vetpro-voice-assistant {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    user-select: none;
}

.voice-widget-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* === MAIN VOICE BUTTON === */
.voice-main-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.voice-main-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.5);
}

.voice-main-btn:active {
    transform: scale(0.95);
}

/* Voice Button States */
.voice-main-btn.listening {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    animation: voicePulse 1.5s infinite ease-in-out;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.6);
}

.voice-main-btn.processing {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.6);
}

.voice-main-btn.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    animation: errorShake 0.5s ease-in-out;
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.6);
}

.voice-main-btn.disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    cursor: not-allowed;
    opacity: 0.6;
}

/* === VOICE BUTTON ICON === */
#micIcon {
    color: white;
    font-size: 24px;
    z-index: 2;
    transition: all 0.3s ease;
}

.voice-main-btn.listening #micIcon {
    color: white;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

.voice-main-btn.processing #micIcon {
    animation: spin 2s linear infinite;
}

/* === PULSE ANIMATION === */
.voice-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

.voice-main-btn.listening .voice-pulse {
    animation: pulsing 2s infinite;
}

/* === STATUS INDICATOR === */
.voice-status {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.1);
    min-width: 120px;
    text-align: center;
}

.voice-status.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(-10px);
}

.voice-status::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 24px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(255, 255, 255, 0.95);
}

.status-text {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    margin: 0;
}

/* === SETTINGS PANEL === */
.voice-settings, .voice-help {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 320px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.1);
    max-height: 500px;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
}

.voice-settings.show, .voice-help.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(-10px) scale(1);
}

/* === PANEL HEADERS === */
.settings-header, .help-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px 16px 0 0;
}

.settings-header h4, .help-header h4 {
    margin: 0;
    color: #374151;
    font-size: 16px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #6b7280;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #374151;
}

/* === PANEL CONTENT === */
.settings-content, .help-content {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.settings-content::-webkit-scrollbar,
.help-content::-webkit-scrollbar {
    width: 6px;
}

.settings-content::-webkit-scrollbar-track,
.help-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.settings-content::-webkit-scrollbar-thumb,
.help-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* === SETTINGS FORM ELEMENTS === */
.setting-group {
    margin-bottom: 20px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.voice-select, .language-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: #374151;
    transition: border-color 0.2s ease;
}

.voice-select:focus, .language-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* === RADIO BUTTONS === */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: normal;
    margin: 0;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.radio-group label:hover {
    background: rgba(102, 126, 234, 0.05);
}

.radio-group input[type="radio"] {
    margin: 0;
    accent-color: #667eea;
}

/* === RANGE SLIDER === */
#speechRate {
    width: 70%;
    margin-right: 10px;
    accent-color: #667eea;
}

#rateValue {
    font-weight: 600;
    color: #667eea;
    font-size: 14px;
    min-width: 40px;
    display: inline-block;
}

/* === CHECKBOXES === */
input[type="checkbox"] {
    accent-color: #667eea;
    margin-right: 8px;
}

/* === COMMAND HELP STYLES === */
.command-category {
    margin-bottom: 20px;
}

.command-category:last-child {
    margin-bottom: 0;
}

.command-category h5 {
    color: #374151;
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.command-category ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.command-category li {
    padding: 8px 12px;
    color: #4b5563;
    font-size: 13px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    margin: 6px 0;
    border-radius: 6px;
    border-left: 3px solid #667eea;
    transition: all 0.2s ease;
}

.command-category li:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    transform: translateX(4px);
}

/* === ANIMATIONS === */
@keyframes voicePulse {
    0%, 100% { 
        transform: scale(1); 
    }
    50% { 
        transform: scale(1.05); 
    }
}

@keyframes pulsing {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === WAKE WORD INDICATOR === */
#wake-word-indicator {
    position: fixed;
    top: 20px;
    right: 120px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border-radius: 50%;
    z-index: 9999;
    animation: wakePulse 2s infinite;
    border: 2px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

@keyframes wakePulse {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.6;
        transform: scale(1.3);
    }
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    #vetpro-voice-assistant {
        bottom: 20px;
        right: 20px;
    }
    
    .voice-main-btn {
        width: 56px;
        height: 56px;
    }
    
    #micIcon {
        font-size: 20px;
    }
    
    .voice-settings, .voice-help {
        width: 280px;
        right: -10px;
    }
    
    .settings-content, .help-content {
        padding: 16px;
    }
    
    #wake-word-indicator {
        top: 15px;
        right: 80px;
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    .voice-settings, .voice-help {
        width: calc(100vw - 40px);
        right: calc(-100vw + 96px);
        max-width: 300px;
    }
}

/* === HIGH CONTRAST MODE === */
@media (prefers-contrast: high) {
    .voice-main-btn {
        border: 2px solid #000;
    }
    
    .voice-status {
        border: 2px solid #000;
        background: #fff;
    }
    
    .voice-settings, .voice-help {
        border: 2px solid #000;
        background: #fff;
    }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    .voice-main-btn,
    .voice-status,
    .voice-settings,
    .voice-help,
    .command-category li {
        transition: none;
    }
    
    .voice-main-btn.listening {
        animation: none;
    }
    
    .voice-pulse {
        animation: none;
    }
    
    #wake-word-indicator {
        animation: none;
    }
}

/* === VOICE FEEDBACK OVERLAY === */
.voice-feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10002;
    backdrop-filter: blur(5px);
}

.voice-feedback-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.voice-waveform {
    display: flex;
    justify-content: center;
    align-items: end;
    gap: 4px;
    height: 60px;
    margin-bottom: 20px;
}

.voice-waveform span {
    width: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    animation: voiceWave 1.2s infinite ease-in-out;
    min-height: 10px;
}

.voice-waveform span:nth-child(1) { animation-delay: -1.1s; }
.voice-waveform span:nth-child(2) { animation-delay: -1.0s; }
.voice-waveform span:nth-child(3) { animation-delay: -0.9s; }
.voice-waveform span:nth-child(4) { animation-delay: -0.8s; }
.voice-waveform span:nth-child(5) { animation-delay: -0.7s; }

@keyframes voiceWave {
    0%, 40%, 100% {
        height: 12px;
        opacity: 0.5;
    }
    20% {
        height: 40px;
        opacity: 1;
    }
}

.voice-feedback-text {
    font-size: 18px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 20px;
}

.voice-cancel-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.voice-cancel-btn:hover {
    background: #dc2626;
}

/* === ACCESSIBILITY ENHANCEMENTS === */
.voice-main-btn:focus,
.close-btn:focus,
.voice-select:focus,
.language-select:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* === UTILITY CLASSES === */
.voice-hidden {
    display: none !important;
}

.voice-disabled {
    pointer-events: none;
    opacity: 0.5;
}

.voice-loading {
    cursor: wait;
}