/**
 * Public pages styles
 * Used on homepage, aanmelden, afmelden, voorkeuren pages
 *
 * Uses --brand-* CSS variables from generated tpl_*.css
 */

/* Base layout */
body.public-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header - uses brand colors */
.public-header {
    background-color: var(--brand-header-bg, #ffffff);
    color: var(--brand-header-fg, #000);
    padding: 1rem 0;
}

.public-header .logo {
    max-height: 60px;
    max-width: 250px;
}

.public-header a {
    color: var(--brand-header-fg, #000) !important;
    text-decoration: none !important;
}

.public-header .h4 {
    color: var(--brand-header-fg, #000);
}

/* Main content */
.public-main {
    flex: 1;
    padding: 2rem 0;
}

/* Footer - uses brand colors */
.public-footer {
    background-color: var(--brand-footer-bg, #f8f9fa);
    color: var(--brand-footer-fg, #000);
    padding: 1.5rem 0;
    margin-top: auto;
    font-size: 0.875rem;
}

.public-footer a {
    color: var(--brand-footer-fg, #000) !important;
}

/* Icons */
.icon-large {
    font-size: 4rem;
}

.footer-logo {
    max-height: 30px;
}

/* Honeypot field - hidden off screen */
.honeypot-field {
    position: absolute;
    left: -9999px;
}

/* Success animation */
@keyframes scaleIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.animate-scale-in {
    animation: scaleIn 0.5s ease-out;
}

/* ============================================
   ACCESSIBILITY MODE (WCAG AA/AAA)
   ============================================ */

/* Accessibility toggle button */
button.accessibility-toggle {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 1050;
    background: #fff;
    border: 2px solid #333;
    border-radius: 50%;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px;
    min-height: 48px;
    max-width: 48px;
    max-height: 48px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: background 0.2s, color 0.2s;
    line-height: 1 !important;
    font-size: 16px;
}

.accessibility-toggle:hover,
.accessibility-toggle:focus {
    background: #333;
    color: #fff;
    outline: 3px solid #007bff;
    outline-offset: 2px;
}

button.accessibility-toggle i.bi {
    font-size: 24px;
    line-height: 1 !important;
    height: 24px !important;
    width: 24px;
}

/* Accessibility panel */
.accessibility-panel {
    position: fixed;
    bottom: 72px;
    right: 16px;
    z-index: 1049;
    background: #fff;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    min-width: 280px;
    display: none;
}

.accessibility-panel.show {
    display: block;
}

.accessibility-panel h6 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #333;
    font-weight: 700;
}

.accessibility-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #ddd;
}

.accessibility-option:last-child {
    border-bottom: none;
}

.accessibility-option label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
}

/* High Contrast Mode - WCAG AAA (7:1) */
body.high-contrast {
    --brand-primary: #000000 !important;
    --brand-secondary: #000000 !important;
    --brand-header-bg: #000000 !important;
    --brand-header-fg: #ffffff !important;
    --brand-footer-bg: #000000 !important;
    --brand-footer-fg: #ffffff !important;
    --brand-background: #ffffff !important;
    background-color: #ffffff !important;
    color: #000000 !important;
}

body.high-contrast * {
    border-color: #000000 !important;
}

body.high-contrast a {
    color: #000000 !important;
    text-decoration: underline !important;
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
}

body.high-contrast a:hover,
body.high-contrast a:focus {
    color: #000000 !important;
    background-color: #ffff00 !important;
    outline: 3px solid #000000 !important;
    outline-offset: 2px;
}

body.high-contrast .btn {
    background-color: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #000000 !important;
}

body.high-contrast .btn:hover,
body.high-contrast .btn:focus {
    background-color: #333333 !important;
    outline: 3px solid #000000 !important;
    outline-offset: 2px;
}

body.high-contrast .btn-outline-secondary {
    background-color: #ffffff !important;
    color: #000000 !important;
}

body.high-contrast .btn-danger {
    background-color: #990000 !important;
    border-color: #990000 !important;
}

body.high-contrast .form-control,
body.high-contrast .form-select {
    border: 2px solid #000000 !important;
    background-color: #ffffff !important;
    color: #000000 !important;
}

body.high-contrast .form-control:focus,
body.high-contrast .form-select:focus {
    outline: 3px solid #000000 !important;
    outline-offset: 2px;
    box-shadow: none !important;
    background-color: #ffff00 !important;
}

body.high-contrast .form-check-input {
    border: 2px solid #000000 !important;
    width: 1.5em !important;
    height: 1.5em !important;
}

body.high-contrast .form-check-input:checked {
    background-color: #000000 !important;
}

body.high-contrast .text-muted {
    color: #333333 !important;
}

body.high-contrast .alert {
    border: 2px solid #000000 !important;
    background-color: #ffffff !important;
    color: #000000 !important;
}

body.high-contrast .card {
    border: 2px solid #000000 !important;
}

body.high-contrast .badge {
    background-color: #000000 !important;
    color: #ffffff !important;
}

body.high-contrast .public-header {
    background-color: #000000 !important;
    color: #ffffff !important;
}

body.high-contrast .public-header a,
body.high-contrast .public-header .h4 {
    color: #ffffff !important;
}

body.high-contrast .public-footer {
    background-color: #000000 !important;
    color: #ffffff !important;
}

body.high-contrast .public-footer a {
    color: #ffffff !important;
}

/* Large Text Mode */
body.large-text {
    font-size: 1.25rem !important;
}

/* ============================================
   DYSLEXIC FONT MODE (OpenDyslexic)
   ============================================ */

@font-face {
    font-family: 'OpenDyslexic';
    src: url('/fonts/opendyslexic/OpenDyslexic-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('/fonts/opendyslexic/OpenDyslexic-Bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('/fonts/opendyslexic/OpenDyslexic-Italic.woff') format('woff');
    font-weight: normal;
    font-style: italic;
    font-display: swap;
}

body.dyslexic-font,
body.dyslexic-font * {
    font-family: 'OpenDyslexic', Arial, sans-serif !important;
}

/* Apply spacing only to content, not body itself */
body.dyslexic-font .public-main,
body.dyslexic-font .public-main * {
    line-height: 1.8 !important;
    word-spacing: 0.2em !important;
    letter-spacing: 0.05em !important;
}

/* Exclude accessibility widget from dyslexic font changes */
body.dyslexic-font button.accessibility-toggle,
body.dyslexic-font button.accessibility-toggle *,
body.dyslexic-font .accessibility-panel,
body.dyslexic-font .accessibility-panel * {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
    word-spacing: 0 !important;
    letter-spacing: 0 !important;
}

body.dyslexic-font button.accessibility-toggle i.bi {
    line-height: 1 !important;
    height: 24px !important;
}

body.large-text h1 { font-size: 2.5rem !important; }
body.large-text h2 { font-size: 2rem !important; }
body.large-text h3 { font-size: 1.75rem !important; }
body.large-text p, body.large-text li { line-height: 1.8 !important; }

body.large-text .btn {
    padding: 0.75rem 1.5rem !important;
    font-size: 1.125rem !important;
}

body.large-text .form-control,
body.large-text .form-select {
    font-size: 1.125rem !important;
    padding: 0.75rem !important;
}

/* Focus indicators - always visible */
body.high-contrast :focus-visible {
    outline: 3px solid #000000 !important;
    outline-offset: 2px;
}

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    z-index: 9999;
    text-decoration: none;
    font-weight: bold;
}

.skip-link:focus {
    top: 0;
}

/* ============================================
   TEXT-TO-SPEECH (TTS) STYLES
   ============================================ */

/* TTS Widget */
.tts-widget {
    margin-bottom: 1rem;
}

.tts-controls {
    display: inline-flex;
    align-items: center;
}

.tts-btn-text {
    margin-left: 0.5rem;
}

/* TTS Highlighting - voegt class toe aan parent element, geen innerHTML wijziging */
.tts-speaking {
    background-color: #fff3cd !important;
    border-radius: 3px;
    box-shadow: 0 0 0 3px #fff3cd;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

/* High contrast mode TTS */
body.high-contrast .tts-speaking {
    background-color: #ffff00 !important;
    box-shadow: 0 0 0 3px #ffff00;
    outline: 2px solid #000000;
}

/* TTS in accessibility panel */
.tts-panel-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #ddd;
}

.tts-panel-section label {
    font-size: 0.875rem;
}

/* Mobile responsive */
@media (max-width: 576px) {
    .tts-widget .tts-btn-text {
        display: none;
    }

    .tts-controls .btn {
        padding: 0.5rem 0.75rem;
    }
}
