/**
 * SmartCemic Accessibility Widget Styles
 * Version 2.0.0 - Fixed layout and overflow
 */

/* Widget Container */
.acc-widget {
    position: fixed !important;
    bottom: 24px !important;
    left: 24px !important;
    z-index: 2147483646 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Toggle Button */
.acc-widget-toggle {
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

.acc-widget-toggle:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.5) !important;
}

.acc-widget-toggle svg {
    width: 28px !important;
    height: 28px !important;
}

/* Panel */
.acc-widget-panel {
    position: fixed !important;
    bottom: 90px !important;
    left: 24px !important;
    width: 360px !important;
    max-width: calc(100vw - 48px) !important;
    max-height: calc(100vh - 120px) !important;
    background: #1a1f2e !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(20px) scale(0.95) !important;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s !important;
    z-index: 2147483647 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.acc-widget-panel.open {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
}

/* Header */
.acc-widget-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 16px 20px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-radius: 16px 16px 0 0 !important;
    flex-shrink: 0 !important;
}

.acc-widget-header h3 {
    margin: 0 !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.acc-widget-close {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    color: white !important;
    font-size: 24px !important;
    font-weight: 300 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    padding-bottom: 2px !important;
    transition: background 0.2s !important;
    flex-shrink: 0 !important;
}

.acc-widget-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

/* Content */
.acc-widget-content {
    padding: 16px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    flex: 1 !important;
    min-height: 0 !important;
}

.acc-widget-content::-webkit-scrollbar {
    width: 6px;
}

.acc-widget-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.acc-widget-content::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 3px;
}

/* Sections */
.acc-widget-section {
    margin-bottom: 20px !important;
}

.acc-widget-section-last {
    margin-bottom: 0 !important;
}

.acc-widget-section h4 {
    color: #94a3b8 !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin: 0 0 12px 0 !important;
}

/* Font Controls */
.acc-font-controls {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    padding: 8px !important;
    border-radius: 10px !important;
}

.acc-font-btn {
    min-width: 40px !important;
    height: 36px !important;
    border-radius: 8px !important;
    background: rgba(102, 126, 234, 0.2) !important;
    border: 1px solid rgba(102, 126, 234, 0.3) !important;
    color: #e2e8f0 !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
}

.acc-font-btn:hover {
    background: rgba(102, 126, 234, 0.4) !important;
}

.acc-font-btn.acc-reset {
    padding: 0 12px !important;
    margin-left: auto !important;
    font-size: 0.75rem !important;
}

.acc-font-size-display {
    flex: 1 !important;
    text-align: center !important;
    color: white !important;
    font-weight: 600 !important;
}

/* Toggle Buttons */
.acc-toggle-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
}

.acc-toggle {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 12px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 10px !important;
    color: #cbd5e1 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    text-align: left !important;
}

.acc-toggle:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(102, 126, 234, 0.3) !important;
}

.acc-toggle.active {
    background: rgba(16, 185, 129, 0.2) !important;
    border-color: rgba(16, 185, 129, 0.5) !important;
    color: #10b981 !important;
}

.acc-toggle .acc-icon {
    width: 20px !important;
    text-align: center !important;
    font-size: 1rem !important;
    flex-shrink: 0 !important;
}

.acc-toggle span:last-child {
    font-size: 0.8rem !important;
    line-height: 1.3 !important;
}

/* Color Options */
.acc-color-options {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
}

.acc-color-option {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 8px 4px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    color: #cbd5e1 !important;
    font-size: 0.65rem !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.acc-color-option:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.acc-color-option.active {
    background: rgba(16, 185, 129, 0.2) !important;
    border-color: rgba(16, 185, 129, 0.5) !important;
    color: #10b981 !important;
}

.acc-color-preview {
    width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
}

.acc-color-normal {
    background: linear-gradient(135deg, #ef4444 0%, #22c55e 50%, #3b82f6 100%) !important;
}

.acc-color-protanopia {
    background: linear-gradient(135deg, #a5a500 0%, #22c55e 50%, #3b82f6 100%) !important;
}

.acc-color-deuteranopia {
    background: linear-gradient(135deg, #d4a500 0%, #d4a500 50%, #3b82f6 100%) !important;
}

.acc-color-tritanopia {
    background: linear-gradient(135deg, #ef4444 0%, #22c55e 50%, #ef4444 100%) !important;
}

/* Reset Button */
.acc-reset-all {
    width: 100% !important;
    padding: 14px !important;
    background: rgba(239, 68, 68, 0.15) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    border-radius: 10px !important;
    color: #f87171 !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    transition: background 0.2s !important;
}

.acc-reset-all:hover {
    background: rgba(239, 68, 68, 0.25) !important;
}

/* Accessibility Effects */
html.acc-high-contrast { filter: contrast(1.4) !important; }
html.acc-dyslexia-font, html.acc-dyslexia-font * { font-family: 'OpenDyslexic', 'Comic Sans MS', Arial, sans-serif !important; letter-spacing: 0.05em !important; }
html.acc-reduced-motion, html.acc-reduced-motion * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
html.acc-focus-highlight *:focus { outline: 3px solid #fbbf24 !important; outline-offset: 3px !important; }
html.acc-link-highlight a { background-color: rgba(251, 191, 36, 0.3) !important; text-decoration: underline !important; }
html.acc-large-pointer, html.acc-large-pointer * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' stroke='%23fff' stroke-width='1' d='M5.5 3.21V20.8l4.86-4.86h6.78L5.5 3.21z'/%3E%3C/svg%3E") 0 0, auto !important; }

/* Reading Guide */
.acc-reading-guide-bar { position: fixed; left: 0; right: 0; height: 30px; pointer-events: none; z-index: 2147483645; }
.acc-reading-guide-line { width: 100%; height: 2px; background: linear-gradient(90deg, transparent, #fbbf24, #fbbf24, transparent); position: absolute; top: 50%; box-shadow: 0 0 10px rgba(251, 191, 36, 0.5); }

/* Color Blind Filters */
html.acc-protanopia { filter: saturate(0.8) sepia(0.2) hue-rotate(-10deg) !important; }
html.acc-deuteranopia { filter: saturate(0.7) sepia(0.3) hue-rotate(10deg) !important; }
html.acc-tritanopia { filter: saturate(0.9) sepia(0.1) hue-rotate(-30deg) !important; }

/* Responsive */
@media (max-width: 480px) {
    .acc-widget { bottom: 16px !important; left: 16px !important; }
    .acc-widget-toggle { width: 50px !important; height: 50px !important; }
    .acc-widget-panel { bottom: 76px !important; left: 12px !important; right: 12px !important; width: auto !important; }
    .acc-toggle-group { grid-template-columns: 1fr 1fr !important; gap: 6px !important; }
    .acc-color-options { grid-template-columns: repeat(2, 1fr) !important; }
}
