/**
 * Widget Accesibilitate WCAG 2.1
 * Compatibil cu Joomla 3, 4, 5
 * @version 1.0.0
 */

/* Container principal widget */
.accessibility-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Buton principal de deschidere */
.accessibility-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #2196F3;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: all 0.3s ease;
    position: relative;
}

.accessibility-toggle:hover {
    background: #1976D2;
    transform: scale(1.1);
}

.accessibility-toggle:focus {
    outline: 3px solid #FFC107;
    outline-offset: 2px;
}

.accessibility-toggle .icon {
    width: 32px;
    height: 32px;
    fill: white;
}

/* Panoul de opțiuni */
.accessibility-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 320px;
    max-height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.accessibility-panel.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header panel */
.accessibility-header {
    background: #2196F3;
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accessibility-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.accessibility-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.accessibility-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.accessibility-close:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Conținut panel */
.accessibility-content {
    padding: 16px;
    overflow-y: auto;
    max-height: 500px;
}

/* Secțiuni */
.accessibility-section {
    margin-bottom: 24px;
}

.accessibility-section:last-child {
    margin-bottom: 0;
}

.accessibility-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Butoane de acțiune */
.accessibility-button {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
    text-align: left;
}

.accessibility-button:hover {
    background: #e0e0e0;
    border-color: #2196F3;
}

.accessibility-button:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

.accessibility-button.active {
    background: #E3F2FD;
    border-color: #2196F3;
    color: #1976D2;
}

.accessibility-button .icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
}

.accessibility-button .label {
    flex: 1;
}

.accessibility-button .status {
    font-size: 12px;
    color: #666;
}

.accessibility-button.active .status {
    color: #1976D2;
}

/* Slider pentru dimensiune text */
.text-size-slider {
    width: 100%;
    margin: 12px 0;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-container input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2196F3;
    cursor: pointer;
    transition: all 0.2s;
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    background: #1976D2;
    transform: scale(1.2);
}

.slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2196F3;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.slider-container input[type="range"]::-moz-range-thumb:hover {
    background: #1976D2;
    transform: scale(1.2);
}

.slider-value {
    min-width: 45px;
    text-align: center;
    font-weight: 600;
    color: #2196F3;
}

/* Controale cititor vocal */
.speech-controls {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.speech-controls button {
    flex: 1;
    padding: 10px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.speech-controls button:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.speech-controls button:focus {
    outline: 3px solid #FFC107;
    outline-offset: 2px;
}

.speech-controls button.stop {
    background: #f44336;
}

.speech-controls button.stop:hover {
    background: #da190b;
}

.speech-controls button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Buton reset */
.reset-button {
    width: 100%;
    padding: 12px;
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-top: 16px;
    transition: all 0.2s;
}

.reset-button:hover {
    background: #f57c00;
    transform: translateY(-2px);
}

.reset-button:focus {
    outline: 3px solid #FFC107;
    outline-offset: 2px;
}

/* Indicatori de stare */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    margin-left: 8px;
}

.status-indicator.active {
    background: #4CAF50;
}

/* Moduri de contrast */
body.high-contrast {
    filter: contrast(1.5);
}

body.dark-mode {
    background: #1a1a1a !important;
    color: #ffffff !important;
}

body.dark-mode * {
    background-color: #1a1a1a !important;
    color: #ffffff !important;
    border-color: #444 !important;
}

body.dark-mode img {
    opacity: 0.8;
}

body.grayscale {
    filter: grayscale(100%);
}

body.invert-colors {
    filter: invert(1) hue-rotate(180deg);
}

body.invert-colors img,
body.invert-colors video {
    filter: invert(1) hue-rotate(180deg);
}

/* Highlight pentru link-uri */
body.highlight-links a {
    background: yellow !important;
    color: black !important;
    padding: 2px 4px !important;
    border-radius: 2px !important;
}

/* Cursor mare */
body.big-cursor,
body.big-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 2 L2 28 L12 20 L16 28 L20 26 L16 18 L26 18 Z" fill="black" stroke="white" stroke-width="2"/></svg>') 0 0, auto !important;
}

/* Ghid de citire */
body.reading-guide::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(33, 150, 243, 0.8);
    z-index: 999998;
    pointer-events: none;
    transform: translateY(-50%);
}

/* Spațiere text */
body.text-spacing * {
    letter-spacing: 0.12em !important;
    word-spacing: 0.16em !important;
    line-height: 1.8 !important;
}

/* Ajustare dimensiune text - suport pentru Joomla 3 */
body[style*="font-size"] * {
    font-size: inherit !important;
}

/* Asigură că dimensiunea textului se aplică corect */
body {
    font-size: 1em;
}

/* Responsive */
@media (max-width: 768px) {
    .accessibility-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .accessibility-toggle {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .accessibility-panel {
        width: calc(100vw - 20px);
        max-width: 320px;
    }
}

/* Animație pentru cititor vocal activ */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.speaking .accessibility-toggle {
    animation: pulse 1.5s infinite;
}

/* Accesibilitate îmbunătățită */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus vizibil pentru toate elementele interactive */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid #FFC107;
    outline-offset: 2px;
}