/* ═══════════════════════════════════════════════════════
   CCTS Accesibilidad v2.0 — Conecta con Tu Salud
   Plugin de accesibilidad liviano y personalizable
   ═══════════════════════════════════════════════════════ */

:root {
    --ccts-accent: #2D6A4F;
    --ccts-panel-bg: #ffffff;
    --ccts-panel-text: #1a1a1a;
    --ccts-panel-muted: #6b7280;
    --ccts-panel-border: #e5e7eb;
    --ccts-panel-radius: 16px;
    --ccts-panel-shadow: 0 20px 60px rgba(0,0,0,.15), 0 0 0 1px rgba(0,0,0,.04);
    --ccts-btn-radius: 10px;
    --ccts-transition: .25s cubic-bezier(.4,0,.2,1);
}

/* ─── Floating Toggle Button ─────────────────────────── */

.ccts-acc-toggle {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999999;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--ccts-accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
    transition: var(--ccts-transition);
    line-height: 1;
    padding: 0;
}

.ccts-acc-toggle:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 28px rgba(0,0,0,.25);
}

.ccts-acc-toggle:focus-visible {
    outline: 3px solid var(--ccts-accent);
    outline-offset: 3px;
}

.ccts-acc-toggle svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    flex-shrink: 0;
}

.ccts-acc-toggle--right { right: 16px; }
.ccts-acc-toggle--left  { left: 16px; }

/* ─── Panel ──────────────────────────────────────────── */

.ccts-acc-panel {
    position: fixed;
    top: 50%;
    transform: translateY(-50%) scale(.95);
    z-index: 999998;
    width: 310px;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--ccts-panel-bg);
    color: var(--ccts-panel-text);
    border-radius: var(--ccts-panel-radius);
    box-shadow: var(--ccts-panel-shadow);
    padding: 20px 16px 14px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--ccts-transition), transform var(--ccts-transition), visibility var(--ccts-transition);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
}

.ccts-acc-panel * {
    font-family: inherit !important;
    box-sizing: border-box;
}

.ccts-acc-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
}

.ccts-acc-panel--right { right: 76px; }
.ccts-acc-panel--left  { left: 76px; }

/* Custom scrollbar */
.ccts-acc-panel::-webkit-scrollbar { width: 4px; }
.ccts-acc-panel::-webkit-scrollbar-track { background: transparent; }
.ccts-acc-panel::-webkit-scrollbar-thumb { background: var(--ccts-panel-border); border-radius: 4px; }

/* ─── Panel Header ───────────────────────────────────── */

.ccts-acc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ccts-panel-border);
}

.ccts-acc-header h3 {
    margin: 0 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--ccts-panel-text) !important;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 !important;
    border: none !important;
}

.ccts-acc-header h3 svg {
    width: 20px;
    height: 20px;
    fill: var(--ccts-accent);
    flex-shrink: 0;
}

.ccts-acc-close {
    background: none !important;
    border: none !important;
    cursor: pointer;
    color: var(--ccts-panel-muted);
    padding: 4px !important;
    border-radius: 6px;
    display: flex;
    transition: var(--ccts-transition);
    line-height: 1;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
}

.ccts-acc-close:hover {
    background: var(--ccts-panel-border) !important;
    color: var(--ccts-panel-text);
}

/* ─── Section Labels ─────────────────────────────────── */

.ccts-acc-section {
    font-size: 10px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--ccts-panel-muted) !important;
    margin: 12px 0 6px !important;
    padding: 0 4px !important;
}

/* ─── Controls ───────────────────────────────────────── */

.ccts-acc-controls {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ccts-acc-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px !important;
    border: 1px solid var(--ccts-panel-border) !important;
    border-radius: var(--ccts-btn-radius) !important;
    background: transparent !important;
    color: var(--ccts-panel-text) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer;
    transition: var(--ccts-transition);
    text-align: left;
    line-height: 1.3 !important;
    margin: 0 !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

.ccts-acc-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--ccts-accent);
    flex-shrink: 0;
}

.ccts-acc-btn:hover {
    background: color-mix(in srgb, var(--ccts-accent) 8%, transparent) !important;
    border-color: color-mix(in srgb, var(--ccts-accent) 30%, transparent) !important;
}

.ccts-acc-btn.is-active {
    background: color-mix(in srgb, var(--ccts-accent) 12%, transparent) !important;
    border-color: var(--ccts-accent) !important;
    color: var(--ccts-accent) !important;
    font-weight: 600 !important;
}

/* ─── Slider Row (font-size, line-height) ────────────── */

.ccts-acc-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--ccts-panel-border);
    border-radius: var(--ccts-btn-radius);
    font-size: 13px !important;
}

.ccts-acc-slider-row svg {
    width: 16px;
    height: 16px;
    fill: var(--ccts-accent);
    flex-shrink: 0;
}

.ccts-acc-slider-row .ccts-label {
    font-weight: 500 !important;
    font-size: 13px !important;
    color: var(--ccts-panel-text) !important;
    white-space: nowrap;
}

.ccts-acc-slider-row button {
    width: 28px;
    height: 28px;
    border: 1px solid var(--ccts-panel-border) !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: var(--ccts-panel-text) !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--ccts-transition);
    line-height: 1 !important;
    padding: 0 !important;
    flex-shrink: 0;
    min-width: 0 !important;
}

.ccts-acc-slider-row button:hover {
    background: var(--ccts-accent) !important;
    color: #fff !important;
    border-color: var(--ccts-accent) !important;
}

.ccts-acc-value {
    min-width: 38px;
    text-align: center;
    font-weight: 600 !important;
    font-size: 11px !important;
    color: var(--ccts-accent) !important;
    flex-shrink: 0;
}

/* ─── Reset ──────────────────────────────────────────── */

.ccts-acc-reset {
    margin-top: 8px;
    padding: 7px !important;
    border: none !important;
    border-radius: var(--ccts-btn-radius) !important;
    background: transparent !important;
    color: var(--ccts-panel-muted) !important;
    font-size: 12px !important;
    cursor: pointer;
    transition: var(--ccts-transition);
    text-align: center;
    width: 100%;
}

.ccts-acc-reset:hover {
    color: var(--ccts-accent) !important;
    background: color-mix(in srgb, var(--ccts-accent) 6%, transparent) !important;
}

/* ─── Footer / Branding ──────────────────────────────── */

.ccts-acc-footer {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--ccts-panel-border);
    text-align: center;
    font-size: 10px !important;
    color: var(--ccts-panel-muted) !important;
    letter-spacing: .02em;
}

.ccts-acc-footer a {
    color: var(--ccts-accent) !important;
    text-decoration: none !important;
    font-weight: 600 !important;
}

.ccts-acc-footer a:hover {
    text-decoration: underline !important;
}

/* ═══════════════════════════════════════════════════════
   APPLIED STATES — These go on <html> and affect the page
   ═══════════════════════════════════════════════════════ */

/* ─── Font Size (JS injects a <style> tag with scaled sizes) ─── */

/* ─── Line Height ────────────────────────────────────── */
html.ccts-lineheight-on body *:not(.ccts-acc-panel):not(.ccts-acc-panel *):not(.ccts-acc-toggle):not(script):not(style):not(svg):not(svg *) {
    line-height: 2.2 !important;
}

/* ─── Spacing ────────────────────────────────────────── */
html.ccts-spacing-on body *:not(.ccts-acc-panel):not(.ccts-acc-panel *):not(.ccts-acc-toggle):not(script):not(style):not(svg):not(svg *) {
    word-spacing: 5px !important;
    letter-spacing: 1.5px !important;
}

/* ─── Align Left ─────────────────────────────────────── */
html.ccts-alignleft-on body *:not(.ccts-acc-panel):not(.ccts-acc-panel *):not(.ccts-acc-toggle) {
    text-align: left !important;
}

/* ─── Dyslexia Font ──────────────────────────────────── */
html.ccts-dyslexia-on body *:not(.ccts-acc-panel):not(.ccts-acc-panel *):not(.ccts-acc-toggle):not(script):not(style):not(svg):not(svg *) {
    font-family: "OpenDyslexic", "Comic Sans MS", "Arial", sans-serif !important;
}

/* ─── High Contrast ──────────────────────────────────── */
html.ccts-contrast-on {
    filter: contrast(1.5) !important;
}
html.ccts-contrast-on .ccts-acc-panel,
html.ccts-contrast-on .ccts-acc-toggle {
    filter: contrast(0.667) !important;
}

/* ─── Invert Colors ──────────────────────────────────── */
html.ccts-invert-on {
    filter: invert(1) hue-rotate(180deg) !important;
}
html.ccts-invert-on img,
html.ccts-invert-on video,
html.ccts-invert-on picture,
html.ccts-invert-on [style*="background-image"],
html.ccts-invert-on .ccts-acc-panel,
html.ccts-invert-on .ccts-acc-toggle {
    filter: invert(1) hue-rotate(180deg) !important;
}

/* ─── Grayscale ──────────────────────────────────────── */
html.ccts-grayscale-on {
    filter: grayscale(1) !important;
}
html.ccts-grayscale-on .ccts-acc-panel,
html.ccts-grayscale-on .ccts-acc-toggle {
    filter: grayscale(0) !important;
}

/* ─── Big Cursor ─────────────────────────────────────── */
html.ccts-cursor-on,
html.ccts-cursor-on * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath d='M8 4l28 20-12 3 8 16-6 2-8-16-10 8V4z' fill='%23111' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") 8 4, auto !important;
}

/* ─── Reading Guide ──────────────────────────────────── */
.ccts-reading-guide {
    position: fixed;
    left: 0;
    width: 100%;
    height: 12px;
    background: var(--ccts-accent);
    opacity: .18;
    pointer-events: none;
    z-index: 999990;
    transition: top .05s linear;
    display: none;
    border-radius: 0;
}

html.ccts-readingguide-on .ccts-reading-guide {
    display: block;
}

/* ─── Highlight Links ────────────────────────────────── */
html.ccts-links-on body a:not(.ccts-acc-panel a) {
    outline: 3px solid var(--ccts-accent) !important;
    outline-offset: 2px !important;
    border-radius: 2px;
    text-decoration: underline !important;
}

/* ─── Stop Animations ────────────────────────────────── */
html.ccts-stopanims-on,
html.ccts-stopanims-on *,
html.ccts-stopanims-on *::before,
html.ccts-stopanims-on *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

html.ccts-stopanims-on .ccts-acc-panel,
html.ccts-stopanims-on .ccts-acc-panel *,
html.ccts-stopanims-on .ccts-acc-toggle {
    transition-duration: .25s !important;
}

/* ─── Hide Images ────────────────────────────────────── */
html.ccts-hideimgs-on body img:not(.ccts-acc-panel img),
html.ccts-hideimgs-on body svg:not(.ccts-acc-panel svg):not(.ccts-acc-toggle svg):not(.ccts-reading-guide),
html.ccts-hideimgs-on body video,
html.ccts-hideimgs-on body picture {
    opacity: 0.05 !important;
}

/* ─── Responsive ─────────────────────────────────────── */

@media (max-width: 520px) {
    .ccts-acc-panel {
        width: calc(100vw - 32px) !important;
        left: 16px !important;
        right: 16px !important;
        max-height: 75vh;
    }
    .ccts-acc-toggle {
        width: 44px;
        height: 44px;
    }
    .ccts-acc-toggle svg {
        width: 22px;
        height: 22px;
    }
}
