/* Accessibility Auditor - Frontend Widget Styles */

/* Main Accessibility Widget */
#aa-accessibility-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

/* Toggle Button */
.aa-widget-toggle {
    width: 60px;
    height: 60px;
    background: #0073aa;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.aa-widget-toggle:hover {
    background: #005177;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.6);
}

.aa-widget-toggle:focus {
    outline: 3px solid #ffbf47;
    outline-offset: 2px;
}

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

.aa-widget-toggle:hover::before {
    left: 100%;
}

/* Panel */
.aa-widget-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid #e0e0e0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

.aa-widget-panel.aa-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.aa-widget-panel::before {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 16px;
    height: 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

/* Panel Header */
.aa-widget-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #0073aa, #005177);
    color: white;
    border-radius: 12px 12px 0 0;
}

.aa-widget-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.aa-widget-subtitle {
    margin: 5px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
}

/* Panel Content */
.aa-widget-content {
    padding: 20px;
}

.aa-feature-group {
    margin-bottom: 25px;
}

.aa-feature-group:last-child {
    margin-bottom: 0;
}

.aa-feature-group h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Control Buttons */
.aa-control-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.aa-control-button {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    position: relative;
    overflow: hidden;
}

.aa-control-button:hover {
    background: #e9ecef;
    border-color: #0073aa;
    color: #0073aa;
    transform: translateY(-2px);
}

.aa-control-button.aa-active {
    background: #0073aa;
    border-color: #0073aa;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.aa-control-button.aa-active::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 12px;
    font-weight: bold;
}

/* Slider Controls */
.aa-slider-control {
    margin-bottom: 15px;
}

.aa-slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #495057;
}

.aa-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
    transition: all 0.2s ease;
}

.aa-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0073aa;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 115, 170, 0.3);
    transition: all 0.2s ease;
}

.aa-slider::-webkit-slider-thumb:hover {
    background: #005177;
    transform: scale(1.2);
}

.aa-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0073aa;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 115, 170, 0.3);
}

/* Reset Button */
.aa-reset-button {
    width: 100%;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.aa-reset-button:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Accessibility States */
body.aa-high-contrast {
    filter: contrast(150%) !important;
}

body.aa-high-contrast * {
    text-shadow: none !important;
    box-shadow: none !important;
}

body.aa-dark-mode {
    filter: invert(1) hue-rotate(180deg) !important;
}

body.aa-dark-mode img,
body.aa-dark-mode video,
body.aa-dark-mode iframe,
body.aa-dark-mode svg,
body.aa-dark-mode canvas,
body.aa-dark-mode embed,
body.aa-dark-mode object {
    filter: invert(1) hue-rotate(180deg) !important;
}

body.aa-large-text {
    font-size: 120% !important;
}

body.aa-large-text * {
    font-size: inherit !important;
    line-height: 1.6 !important;
}

body.aa-reading-mode * {
    font-family: Georgia, 'Times New Roman', serif !important;
    line-height: 1.8 !important;
    letter-spacing: 0.05em !important;
}

body.aa-reading-mode p,
body.aa-reading-mode li,
body.aa-reading-mode div {
    text-align: left !important;
    max-width: 65ch !important;
}

/* Focus Enhancement */
body.aa-enhanced-focus *:focus {
    outline: 3px solid #ffbf47 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 6px rgba(255, 191, 71, 0.3) !important;
}

/* Motion Reduction */
body.aa-reduce-motion *,
body.aa-reduce-motion *::before,
body.aa-reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

/* Custom Cursor */
body.aa-large-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path d="M2 2v28l8-8h10l-8-8h8V2H2z" fill="black"/><path d="M3 3v24l6-6h8l-6-6h7V3H3z" fill="white"/></svg>'), auto !important;
}

/* Responsive Design */
@media (max-width: 480px) {
    #aa-accessibility-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .aa-widget-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .aa-widget-panel {
        width: calc(100vw - 30px);
        right: -260px;
        bottom: 65px;
    }
    
    .aa-widget-panel.aa-open {
        right: -260px;
    }
    
    .aa-control-grid {
        grid-template-columns: 1fr;
    }
}

/* High Contrast Mode Compatibility */
@media (prefers-contrast: high) {
    .aa-widget-toggle {
        border: 2px solid;
    }
    
    .aa-widget-panel {
        border: 2px solid;
    }
    
    .aa-control-button {
        border-width: 2px;
    }
}

/* Reduced Motion Compatibility */
@media (prefers-reduced-motion: reduce) {
    .aa-widget-toggle,
    .aa-widget-panel,
    .aa-control-button,
    .aa-slider::-webkit-slider-thumb {
        transition: none !important;
    }
    
    .aa-widget-toggle::before {
        display: none;
    }
}

/* Print Styles */
@media print {
    #aa-accessibility-widget {
        display: none !important;
    }
}

/* Widget Animation */
@keyframes aa-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.aa-widget-toggle.aa-pulse {
    animation: aa-pulse 2s infinite;
}

/* Notification Bubble */
.aa-notification {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: aa-pulse 2s infinite;
}

/* Keyboard Navigation Indicator */
.aa-keyboard-user .aa-control-button:focus,
.aa-keyboard-user .aa-widget-toggle:focus,
.aa-keyboard-user .aa-slider:focus {
    outline: 3px solid #ffbf47 !important;
    outline-offset: 2px !important;
}

/* Screen Reader Support */
.aa-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Loading State */
.aa-widget-loading {
    pointer-events: none;
    opacity: 0.6;
}

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

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