/**
 * Enhanced styles for Maintenance Compliance Monitoring Agent
 * Includes accessibility improvements and responsive design enhancements
 */

/* Accessibility improvements */
:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bg-gray-50 {
        background-color: white;
    }
    
    .border-gray-200 {
        border-color: #000;
        border-width: 2px;
    }
    
    .text-gray-600 {
        color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .fade-in,
    .transition-colors,
    .transition,
    .progress-bar {
        animation: none !important;
        transition: none !important;
    }
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
    .max-w-7xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Stack workflow steps vertically on mobile */
    .grid.grid-cols-1.lg\\:grid-cols-4 {
        gap: 1rem;
    }
    
    /* Full width panels on mobile */
    .grid.grid-cols-1.xl\\:grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Smaller text on mobile for better readability */
    .text-2xl {
        font-size: 1.5rem;
    }
    
    .text-xl {
        font-size: 1.25rem;
    }
    
    /* Mobile-friendly buttons */
    button {
        min-height: 44px; /* Touch target size */
        font-size: 0.875rem;
    }
    
    /* Mobile modal adjustments */
    .fixed.inset-0 .bg-white.rounded-lg {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .px-4.sm\\:px-6.lg\\:px-8 {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .grid.grid-cols-1.md\\:grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .grid.grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    /* Compact stats cards on very small screens */
    .w-12.h-12 {
        width: 2.5rem;
        height: 2.5rem;
    }
    
    .text-2xl {
        font-size: 1.25rem;
    }
}

/* Enhanced file upload zones */
.file-drop-zone {
    position: relative;
    transition: all 0.3s ease;
}

.file-drop-zone::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, transparent, transparent);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.file-drop-zone:hover::before {
    opacity: 1;
    background: linear-gradient(45deg, #3b82f6, #1d4ed8);
}

.file-drop-zone.drag-over {
    transform: scale(1.02);
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.3);
}

/* Loading spinner for analysis */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Enhanced progress bar */
.progress-container {
    position: relative;
    overflow: hidden;
}

.progress-bar {
    position: relative;
    transition: width 0.5s ease-in-out;
}

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

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

/* Enhanced criteria display */
.criteria-item {
    position: relative;
    transition: all 0.3s ease;
}

.criteria-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.criteria-item.required::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, #ef4444, #dc2626);
    border-radius: 0 2px 2px 0;
}

/* Priority indicators */
.priority-critical {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border-left: 4px solid #ef4444;
}

.priority-high {
    background: linear-gradient(135deg, #fed7aa, #fdba74);
    border-left: 4px solid #f97316;
}

.priority-medium {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-left: 4px solid #f59e0b;
}

.priority-low {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border-left: 4px solid #10b981;
}

/* Enhanced tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #374151;
    color: white;
    padding: 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.tooltip:hover::before {
    opacity: 1;
}

/* Enhanced form elements */
input:focus,
select:focus,
textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

input:invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Print styles */
@media print {
    .no-print,
    header,
    .fixed {
        display: none !important;
    }
    
    .bg-white {
        background: white !important;
    }
    
    .shadow-sm,
    .shadow-lg {
        box-shadow: none !important;
    }
    
    .border {
        border: 1px solid #000 !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .bg-gray-50 {
        background-color: #0f172a;
        color: #f8fafc;
    }
    
    .bg-white {
        background-color: #1e293b;
        color: #f8fafc;
    }
    
    .text-gray-900 {
        color: #f8fafc;
    }
    
    .text-gray-600 {
        color: #cbd5e1;
    }
    
    .text-gray-500 {
        color: #94a3b8;
    }
    
    .border-gray-200 {
        border-color: #475569;
    }
    
    input,
    select,
    textarea {
        background-color: #334155;
        color: #f8fafc;
        border-color: #475569;
    }
}

/* Smooth transitions for interactive elements */
.interactive-element {
    transition: all 0.2s ease-in-out;
}

.interactive-element:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.interactive-element:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Loading states */
.loading {
    pointer-events: none;
    opacity: 0.6;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Status indicators */
.status-indicator {
    position: relative;
    padding-left: 1.5rem;
}

.status-indicator::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background-color: currentColor;
}

.status-pending::before { background-color: #6b7280; }
.status-processing::before { 
    background-color: #3b82f6; 
    animation: pulse 2s infinite;
}
.status-complete::before { background-color: #10b981; }
.status-error::before { background-color: #ef4444; }

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

/* Enhanced card hover effects */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Improved button states */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

/* 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;
}