/* =============================================
   Hadasi Media Accessibility & Cookie Banner
   Accessibility & Cookie Banner
   ============================================= */

/* ─── Accessibility Toggle Button ─── */
#flavflavor-acc-toggle {
    position: fixed;
    bottom: 20px;
    z-index: 999998;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    background: var(--flavflavor-toolbar-btn-bg, #0073aa);
    color: var(--flavflavor-toolbar-btn-icon, #ffffff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    padding: 0;
    line-height: 1;
}

#flavflavor-acc-toggle:hover,
#flavflavor-acc-toggle:focus {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    outline: 3px solid #ffcc00;
    outline-offset: 2px;
}

#flavflavor-acc-toggle.flavflavor-pos-right {
    right: 20px;
}

#flavflavor-acc-toggle.flavflavor-pos-left {
    left: 20px;
}

/* ─── Accessibility Panel ─── */
#flavflavor-acc-panel {
    position: fixed;
    bottom: 90px;
    z-index: 999999;
    width: 320px;
    max-height: 80vh;
    background: var(--flavflavor-toolbar-panel-bg, #ffffff);
    color: var(--flavflavor-toolbar-panel-text, #333333);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

#flavflavor-acc-panel.flavflavor-pos-right {
    right: 20px;
}

#flavflavor-acc-panel.flavflavor-pos-left {
    left: 20px;
}

#flavflavor-acc-panel[aria-hidden="false"] {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Panel header */
.flavflavor-acc-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--flavflavor-toolbar-btn-bg, #0073aa);
    color: var(--flavflavor-toolbar-btn-icon, #ffffff);
    border-radius: 16px 16px 0 0;
}

.flavflavor-acc-panel-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: inherit;
}

#flavflavor-acc-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}

#flavflavor-acc-close:hover,
#flavflavor-acc-close:focus {
    background: rgba(255, 255, 255, 0.2);
    outline: 2px solid #ffcc00;
}

/* Panel body */
.flavflavor-acc-panel-body {
    padding: 16px 20px;
}

/* Group */
.flavflavor-acc-group {
    margin-bottom: 16px;
}

.flavflavor-acc-group-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

/* Button rows */
.flavflavor-acc-btn-row {
    display: flex;
    gap: 8px;
}

.flavflavor-acc-btn-row .flavflavor-acc-btn {
    flex: 1;
    padding: 10px;
    font-size: 16px;
    font-weight: 700;
}

/* Button grid */
.flavflavor-acc-btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* Buttons */
.flavflavor-acc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: 2px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    text-align: center;
    flex-direction: column;
    min-height: 60px;
}

.flavflavor-acc-btn:hover {
    background: rgba(0, 115, 170, 0.08);
    border-color: var(--flavflavor-toolbar-btn-bg, #0073aa);
}

.flavflavor-acc-btn:focus {
    outline: 3px solid #ffcc00;
    outline-offset: 2px;
}

.flavflavor-acc-btn[aria-pressed="true"] {
    background: var(--flavflavor-toolbar-btn-bg, #0073aa);
    color: var(--flavflavor-toolbar-btn-icon, #ffffff);
    border-color: var(--flavflavor-toolbar-btn-bg, #0073aa);
}

.flavflavor-acc-btn svg {
    flex-shrink: 0;
}

/* Reset button */
.flavflavor-acc-reset {
    width: 100%;
    flex-direction: row;
    justify-content: center;
    min-height: auto;
    padding: 10px;
    font-size: 13px;
    border-color: #dc3545;
    color: #dc3545;
}

.flavflavor-acc-reset:hover {
    background: #dc3545;
    color: #fff;
}

/* Statement link */
.flavflavor-acc-statement-link a {
    display: block;
    text-align: center;
    padding: 10px;
    background: rgba(0, 115, 170, 0.06);
    border-radius: 8px;
    color: var(--flavflavor-toolbar-btn-bg, #0073aa);
    text-decoration: none;
    font-weight: 600;
}

.flavflavor-acc-statement-link a:hover {
    background: rgba(0, 115, 170, 0.12);
    text-decoration: underline;
}

.flavflavor-acc-statement-link a:focus {
    outline: 3px solid #ffcc00;
    outline-offset: 2px;
}

/* Hint */
.flavflavor-acc-hint {
    text-align: center;
    opacity: 0.6;
    margin-bottom: 0;
}

.flavflavor-acc-hint kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    font-family: monospace;
}

/* ─── Accessibility Body Classes ─── */

/* High contrast */
body.flavflavor-high-contrast,
body.flavflavor-high-contrast * {
    background-color: #000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}

body.flavflavor-high-contrast a {
    color: #00ffff !important;
    text-decoration: underline !important;
}

body.flavflavor-high-contrast img {
    filter: brightness(1.2) contrast(1.2) !important;
}

body.flavflavor-high-contrast #flavflavor-acc-panel,
body.flavflavor-high-contrast #flavflavor-acc-toggle,
body.flavflavor-high-contrast #flavflavor-cookie-banner {
    background-color: #111 !important;
    color: #ffff00 !important;
}

/* Grayscale */
body.flavflavor-grayscale {
    filter: grayscale(100%) !important;
}

/* Highlight links */
body.flavflavor-highlight-links a {
    outline: 3px solid #ff6600 !important;
    outline-offset: 2px !important;
    background: rgba(255, 102, 0, 0.1) !important;
}

/* Readable font */
body.flavflavor-readable-font,
body.flavflavor-readable-font * {
    font-family: Arial, Helvetica, 'Noto Sans Hebrew', sans-serif !important;
    letter-spacing: 0.5px !important;
    word-spacing: 2px !important;
}

/* Stop animations */
body.flavflavor-stop-animations,
body.flavflavor-stop-animations * {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
}

body.flavflavor-stop-animations *::before,
body.flavflavor-stop-animations *::after {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
}

/* Big cursor */
body.flavflavor-big-cursor,
body.flavflavor-big-cursor * {
    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='M7 2l12 11.2-5.8.5 3.3 7.3-2.2 1-3.2-7.4L7 18z'/%3E%3C/svg%3E"), auto !important;
}

/* ─── Cookie Banner ─── */
#flavflavor-cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999997;
    background: var(--flavflavor-cookie-bg, #1a1a2e);
    color: var(--flavflavor-cookie-text, #ffffff);
    padding: 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

.flavflavor-cookie-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

#flavflavor-cookie-text {
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.flavflavor-cookie-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.flavflavor-cookie-link {
    color: var(--flavflavor-cookie-text, #ffffff);
    opacity: 0.8;
    text-decoration: underline;
    white-space: nowrap;
}

.flavflavor-cookie-link:hover,
.flavflavor-cookie-link:focus {
    opacity: 1;
    outline: 2px solid #ffcc00;
    outline-offset: 2px;
}

#flavflavor-cookie-accept {
    background: var(--flavflavor-cookie-btn-bg, #e94560);
    color: var(--flavflavor-cookie-btn-text, #ffffff);
    border: none;
    padding: 10px 28px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
}

#flavflavor-cookie-accept:hover {
    filter: brightness(1.15);
    transform: scale(1.03);
}

#flavflavor-cookie-accept:focus {
    outline: 3px solid #ffcc00;
    outline-offset: 2px;
}

/* ─── Skip to content link (WCAG requirement) ─── */
.flavflavor-skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000000;
    background: #000;
    color: #fff;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 8px 8px;
    transition: top 0.2s;
}

.flavflavor-skip-link:focus {
    top: 0;
    outline: 3px solid #ffcc00;
}

/* ─── Focus styles for entire site (WCAG 2.4.7) ─── */
*:focus-visible {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
    #flavflavor-acc-panel {
        width: calc(100vw - 20px);
        right: 10px !important;
        left: 10px !important;
        bottom: 80px;
        max-height: 70vh;
    }

    #flavflavor-acc-toggle {
        width: 48px;
        height: 48px;
    }

    #flavflavor-acc-toggle.flavflavor-pos-right {
        right: 10px;
    }

    #flavflavor-acc-toggle.flavflavor-pos-left {
        left: 10px;
    }

    .flavflavor-cookie-inner {
        flex-direction: column;
        text-align: center;
        padding: 16px 20px;
    }

    .flavflavor-cookie-actions {
        flex-direction: column;
        width: 100%;
    }

    #flavflavor-cookie-accept {
        width: 100%;
    }

    .flavflavor-acc-btn-grid {
        grid-template-columns: 1fr;
    }
}
