:root {
    --primary-color: #0066cc;
    --secondary-color: #e6e6e6;
    --text-color: #333;
    --bg-color: #fff;
    --panel-bg: #1d1d1dc4;
    --panel-bg-modal: #9d9d9d;
    --panel-border: #e0e0e0;
    --btn-bg: #f5f5f5;
    --btn-border: #ddd;
}

/* Base Styles */
body {
    /* color: var(--text-color); */
    background-color: var(--bg-color);
    transition: all 0.3s ease;
}

/* Accessibility Themes */
body.dark-contrast {
    --text-color: #f2f2f2;
    --bg-color: #121212;
    --primary-color: #4a90e2;
    --secondary-color: #333;
    --text-dark: #e3e3e3;
    --header-text-color: #f2f2f2;
    --bg-gray-2: #f2f2f2;
    color: #f2f2f2;
    --background-color-alf-a: #121212;
}

.dark-contrast .article-body-area {
    background-color: #121212;
    color: #ffffff;
    --font-color: #d0d0d0;
}

body.light-contrast {
    --text-color: #333;
    --bg-color: #f9f9f9;
}

body.high-contrast {
    --text-color: #000;
    --bg-color: #fff;
    --primary-color: #000;
}

article * .high-contrast {
    --text-color: #000 !important;
    --bg-color: #fff !important;
    --primary-color: #000 !important;
}

body.high-saturation {
    filter: saturate(2);
}

body.low-saturation {
    filter: saturate(0.5);
}

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

.a11y-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.a11y-modal-content {
    background-color: var(--panel-bg-modal);
    padding: 2rem;
    border-radius: 8px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.a11y-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding-left: 6px;
    padding-right: 6px;
}

.a11y-modal-body {
    margin-top: 1.5rem;
    line-height: 1.6;
}

/* Stili per contrasto alto */
body.high-contrast .a11y-modal-content {
    border: 3px solid #000;
}

/* Panel Styles */
.accessibility-panel {
    position: fixed;
    top: 69px;
    right: 9px;
    background-color: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px 0 0 8px;
    box-shadow: 0 2px 5px 5px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    min-width: 280px;
    z-index: 1000;
    transition: transform 0.3s ease, opacity 0.3s ease;
    backdrop-filter: blur(10px);
}

.accessibility-panel.hidden {
    /* transform: translateY(-50%) translateX(100%); */
    opacity: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.02rem;
    color: aliceblue;
}

.close-panel {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.panel-section {
    margin-bottom: 1.5rem;
}

.panel-section h3 {
    margin-top: 0;
    margin-bottom: 0.8rem;
    font-size: 1rem;
    color: aliceblue;
}

/* Button Styles */
.accessibility-buttons,
.color-options {
    display: grid;
    gap: 0.8rem;
}

.accessibility-buttons {
    grid-template-columns: repeat(3, 1fr);
}

.color-options {
    grid-template-columns: repeat(2, 1fr);
}

.accessibility-panel button:not(.close-panel) {
    background-color: #d8d8d8a3;
    color: inherit;
    border: 1px solid var(--btn-border);
    border-radius: 4px;
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    opacity: 1;
}

.accessibility-panel button:not(.close-panel):hover {
    background-color: #e9e9e9;
}

/* Toggle Button */
.accessibility-toggle {
    position: relative;
    font-size: 36px;
    right: 0;
    /* top: 50%; */
    /* transform: translateY(-50%); */
    /* background-color: var(--primary-color); */
    color: white;
    border: none;
    border-radius: 4px 0 0 4px;
    /* padding: 0.8rem 0.5rem; */
    cursor: pointer;
    z-index: 999;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transition: background-color 0.2s ease;
}

.accessibility-toggle:hover {
    /* background-color: #0052a3; */
}

/* Responsive Design */
@media (max-width: 768px) {
    .accessibility-panel {
        width: 240px;
    }

    .accessibility-buttons {
        grid-template-columns: 1fr;
    }
}