/* 
 * UI Enhancements CSS - Advanced UX improvements for AidAnnot
 * Modern design patterns, micro-interactions, and visual feedback
 */

/* === LOADING STATES & ANIMATIONS === */
@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-10px) rotate(120deg); }
    66% { transform: translateY(5px) rotate(240deg); }
    100% { transform: translateY(0px) rotate(360deg); }
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.8; }
}

@keyframes slide-in-up {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.loading-state {
    animation: pulse-glow 2s infinite;
}

.slide-in {
    animation: slide-in-up 0.5s ease-out;
}

/* === MODERN VOICE CONTROLS === */
.voice-control-panel {
    background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), 0.1), rgba(var(--bs-primary-rgb), 0.05));
    border: 1px solid rgba(var(--bs-primary-rgb), 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.voice-control-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--bs-primary), transparent);
    transition: left 0.5s;
}

.voice-control-panel:hover::before {
    left: 100%;
}

.voice-btn {
    position: relative;
    background: linear-gradient(135deg, var(--bs-primary), rgba(var(--bs-primary-rgb), 0.8));
    border: none;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    min-width: 160px;
}

.voice-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.voice-btn:hover::before {
    width: 300px;
    height: 300px;
}

.voice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--bs-primary-rgb), 0.4);
}

.voice-btn.recording {
    background: linear-gradient(135deg, #dc3545, #c82333);
    animation: pulse-glow 1.5s infinite;
}

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

.voice-btn:hover .icon {
    transform: scale(1.1);
}

/* === STATUS INDICATORS === */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.status-indicator.success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), rgba(40, 167, 69, 0.05));
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.status-indicator.processing {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 193, 7, 0.05));
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.status-indicator.error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.05));
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.status-indicator .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}

/* === ENHANCED FORM ELEMENTS === */
.form-group-enhanced {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-group-enhanced .form-label {
    font-weight: 600;
    color: var(--bs-dark);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group-enhanced .form-label i {
    color: var(--bs-primary);
}

.floating-label {
    position: relative;
}

.floating-label .form-control {
    padding-top: 1.5rem;
    padding-bottom: 0.5rem;
}

.floating-label .form-label {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    transform: translateY(0.5rem);
    transition: all 0.2s ease;
    pointer-events: none;
    color: var(--bs-secondary);
    font-size: 0.9rem;
}

.floating-label .form-control:focus ~ .form-label,
.floating-label .form-control:not(:placeholder-shown) ~ .form-label {
    transform: translateY(-0.5rem);
    font-size: 0.75rem;
    color: var(--bs-primary);
    font-weight: 600;
}

/* === RESULT DISPLAY === */
.result-container {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.03), rgba(40, 167, 69, 0.01));
    border: 1px solid rgba(40, 167, 69, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    min-height: 200px;
    overflow: hidden;
}

.result-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--bs-success), rgba(var(--bs-success-rgb), 0.5));
}

.result-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--bs-dark);
}

.result-text.empty {
    color: var(--bs-secondary);
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
}

/* === PROGRESS INDICATORS === */
.progress-enhanced {
    background: rgba(var(--bs-primary-rgb), 0.1);
    border-radius: 10px;
    overflow: hidden;
    height: 8px;
}

.progress-enhanced .progress-bar {
    background: linear-gradient(90deg, var(--bs-primary), rgba(var(--bs-primary-rgb), 0.8));
    transition: width 0.3s ease;
    position: relative;
}

.progress-enhanced .progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 2s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* === MOBILE OPTIMIZATIONS === */
@media (max-width: 768px) {
    .voice-control-panel {
        padding: 1rem;
        margin-bottom: 1rem;
        backdrop-filter: none; /* Disable for performance */
    }
    
    .voice-btn {
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
    }
    
    .result-container {
        padding: 1rem;
        min-height: 150px;
        backdrop-filter: none; /* Disable for performance */
    }
    
    .status-indicator {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .dropdown-menu {
        backdrop-filter: none; /* Disable for performance */
        background: rgba(255, 255, 255, 1);
    }
}

/* === DARK THEME SUPPORT === */
[data-bs-theme="dark"] .voice-control-panel {
    background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), 0.2), rgba(var(--bs-primary-rgb), 0.1));
    border-color: rgba(var(--bs-primary-rgb), 0.3);
}

[data-bs-theme="dark"] .result-container {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), rgba(40, 167, 69, 0.05));
    border-color: rgba(40, 167, 69, 0.2);
}

[data-bs-theme="dark"] .form-group-enhanced .form-label {
    color: var(--bs-light);
}

[data-bs-theme="dark"] .result-text {
    color: var(--bs-light);
}

/* === ACCESSIBILITY ENHANCEMENTS === */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .voice-btn:hover {
        transform: none;
    }
}

/* Focus indicators */
.voice-btn:focus-visible {
    outline: 3px solid rgba(var(--bs-primary-rgb), 0.5);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .voice-control-panel {
        border-width: 2px;
    }
    
    .result-container {
        border-width: 2px;
    }
}