/* --------------------------------------------------
   1. SCREEN READER ONLY CLASS
   -------------------------------------------------- */
/* Hides content visually but keeps it accessible to screen readers */
.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;
}

/* Allow screen reader only text to be focusable when navigated to via keyboard */
.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}


/* --------------------------------------------------
   2. SKIP LINK
   -------------------------------------------------- */
.skip-link {
    position: fixed;
    left: 20px;
    top: -100px;

    background-color: #f4a925;
    color: #fff !important;
    padding: 12px 35px;

    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    white-space: nowrap;

    border-radius: 0 0 35px 35px;

    border: none;
    outline: none;

    z-index: 9999;
    transition: top 0.3s ease, transform 0.3s ease;
}

.skip-link:focus {
    top: 0;

    transform: scale(1.02);

    outline: none;
    border: none;
}

.skip-link:hover {
    background-color: #e09820;
    transform: scale(1.02);
}

.skip-link:active {
    transform: scale(0.98);
}

/* --------------------------------------------------
   3. FOCUS INDICATORS
   -------------------------------------------------- */
/* Base focus reset - hide default outline for mouse users */
*:focus {
    outline: none;
}

/* Modern focus-visible styles - only shows for keyboard users */
*:focus-visible {
    outline: 2px solid #f4a925;
    outline-offset: 3px;
    border-radius: 4px;
    transition: outline-offset 0.2s ease;
}

/* Enhanced focus for interactive elements with smooth glow effect */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #f4a925;
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(244, 169, 37, 0.15);
    transition: box-shadow 0.2s ease, outline-offset 0.2s ease;
}

/* Buttons get special treatment with inset glow */
button:focus-visible {
    outline: 2px solid #f4a925;
    outline-offset: 2px;
    box-shadow:
            0 0 0 4px rgba(244, 169, 37, 0.15),
            inset 0 0 0 2px rgba(244, 169, 37, 0.1);
}

/* Links get a subtle underline enhancement */
a:focus-visible {
    outline: 2px solid #f4a925;
    outline-offset: 4px;
    text-decoration: underline;
    text-decoration-color: #f4a925;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

/* Form inputs get inner glow for better UX */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #f4a925;
    outline-offset: 0px;
    box-shadow:
            0 0 0 3px rgba(244, 169, 37, 0.2),
            inset 0 0 0 1px rgba(244, 169, 37, 0.3);
    border-color: #f4a925;
}

/* Card-like elements (product tiles, etc.) */
.product-preview-tile:focus-within,
.blog-preview-item:focus-within {
    outline: 2px solid #f4a925;
    outline-offset: 4px;
    box-shadow:
            0 0 0 4px rgba(244, 169, 37, 0.1),
            0 4px 12px rgba(244, 169, 37, 0.15);
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

/* Skip link with modern appearance */
.skip-link:focus {
    outline: 2px solid #fff;
    outline-offset: -4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Icon buttons (heart, info, etc.) */
.btn-to-wishlist:focus-visible,
.info-icon:focus-visible {
    outline: 2px solid #f4a925;
    outline-offset: 4px;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(244, 169, 37, 0.2);
}

/* Search button special styling */
.search-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -2px;
    box-shadow:
            0 0 0 4px rgba(255, 255, 255, 0.3),
            0 4px 12px rgba(244, 169, 37, 0.4);
}

/* Navigation menu items */
nav a:focus-visible,
nav button:focus-visible {
    outline: 2px solid #f4a925;
    outline-offset: 4px;
    background-color: rgba(244, 169, 37, 0.08);
    border-radius: 4px;
}

/* Header buttons (Therapeuten-Login, Label-Lizenz) */
.therapist-login-header-button:focus-visible,
.label-license-header-button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    box-shadow:
            0 0 0 4px rgba(255, 255, 255, 0.3),
            0 4px 16px rgba(244, 169, 37, 0.3);
    transform: scale(1.02);
}

/* Checkbox and radio - modern custom focus */
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    outline: 2px solid #f4a925;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(244, 169, 37, 0.15);
}

/* Slick slider controls */
.slick-arrow:focus-visible,
.slick-dots button:focus-visible {
    outline: 2px solid #f4a925;
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(244, 169, 37, 0.2);
    border-radius: 50%;
}

/* Filter buttons */
.filter-delete-btn:focus-visible {
    outline: 2px solid #f4a925;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(244, 169, 37, 0.2);
    border-radius: 50%;
}

/* Menu toggle (hamburger) */
.m-menu__toggle:focus-visible {
    outline: 2px solid #f4a925;
    outline-offset: 4px;
    border-radius: 4px;
    box-shadow: 0 0 0 4px rgba(244, 169, 37, 0.15);
}

/* Merkzettel/Wishlist links in header */
.search-wishlist-container a:focus-visible {
    outline: 2px solid #f4a925;
    outline-offset: 4px;
    border-radius: 8px;
    box-shadow: 0 0 0 4px rgba(244, 169, 37, 0.2);
}

/* Product comparison links */
.most-popular-comparisons-container > div > a:focus-visible {
    outline: 2px solid #f4a925;
    outline-offset: 4px;
    box-shadow: 0 0 0 4px rgba(244, 169, 37, 0.15);
    border-radius: 8px;
}

/* High Contrast Mode - ensures visibility */
@media (prefers-contrast: more) {
    *:focus-visible {
        outline: 3px solid #f4a925 !important;
        outline-offset: 2px;
    }

    button:focus-visible,
    a:focus-visible {
        outline: 3px solid #f4a925 !important;
        box-shadow: 0 0 0 2px rgba(244, 169, 37, 0.4) !important;
    }
}

/* Reduced Motion - simpler, instant focus indicators */
@media (prefers-reduced-motion: reduce) {
    *:focus-visible,
    button:focus-visible,
    a:focus-visible {
        transition: none !important;
        transform: none !important;
    }

    .product-preview-tile:focus-within,
    .blog-preview-item:focus-within {
        transform: none !important;
    }
}

/* Dark elements (on blue background) need white focus */
.content-section-wrapper-bg-strong *:focus-visible,
.content-section-wrapper-bg-strong button:focus-visible,
.content-section-wrapper-bg-strong a:focus-visible {
    outline: 2px solid #fff;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2);
}

/* Ensure trending supplement links on blue background use white */
.supplements-trend-container a:focus-visible {
    outline: 2px solid #fff;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.15);
}

/* Footer elements on dark background */
.footer a:focus-visible,
.footer button:focus-visible {
    outline: 2px solid #f4a925;
    outline-offset: 3px;
    background-color: rgba(244, 169, 37, 0.1);
    box-shadow: 0 0 0 4px rgba(244, 169, 37, 0.15);
}


/* --------------------------------------------------
   4. BUTTON ACCESSIBILITY
   -------------------------------------------------- */
/* Ensure buttons look clickable */
button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* For buttons that look like links */
button.link-style {
    background: none;
    border: none;
    color: inherit;
    text-decoration: underline;
    padding: 0;
}

/* Subscore toggle button accessibility */
.subscore-toggle-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    width: auto;
}

.subscore_expander {
    cursor: pointer;
    padding: 4px 8px;
    min-width: 30px;
    min-height: 30px; /* Ensure minimum touch target size */
}


/* --------------------------------------------------
   5. TOUCH TARGET SIZES
   -------------------------------------------------- */
/* WCAG 2.1 requires minimum 44x44px touch targets */
button,
a,
.btn-zum-merkzettel {
    min-width: 44px;
    min-height: 44px;
}

button.filter-delete-btn {
    min-width: 24px;
    min-height: 24px;
}

.therapist-and-license-buttons a {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* For checkboxes and radios, ensure the LABEL provides adequate touch target */
input[type="checkbox"],
input[type="radio"] {
    /* Keep native size or use reasonable custom size */
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
}

/* Ensure labels have adequate padding for touch targets - ONLY in forms and filter areas */
form input[type="checkbox"] + label,
form input[type="radio"] + label,
.input_filter_container input[type="checkbox"] + label,
.input_filter_container input[type="radio"] + label,
fieldset input[type="checkbox"] + label,
fieldset input[type="radio"] + label {
    display: inline-block;
    padding: 4px 8px;
    line-height: 20px;
    cursor: pointer;
    vertical-align: middle;
}

/* Exception for inline text links */
a:not([class]) {
    min-width: auto;
    min-height: auto;
}

/* --------------------------------------------------
   6. REDUCED MOTION SUPPORT
   -------------------------------------------------- */
/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --------------------------------------------------
   7. HIGH CONTRAST MODE SUPPORT
   -------------------------------------------------- */
@media (prefers-contrast: more) {
    button:not(:focus):not(:focus-visible):not(.btn-to-wishlist):not(.btn-zum-merkzettel):not(.search-btn):not(.m-menu__toggle):not(.info-icon):not(.cookie-settings-btn):not(.subscore-toggle-btn):not(.subscore_expander),
    input:not(:focus):not(:focus-visible):not(.search-input-field):not(#search-input),
    select:not(:focus):not(:focus-visible),
    textarea:not(:focus):not(:focus-visible) {
        border: 2px solid currentColor !important;
    }

    /* Remove borders from specific elements completely */
    .btn-to-wishlist,
    .btn-zum-merkzettel,
    .product-preview-tile,
    .search-input-field,
    #search-input,
    .cookie-settings-btn,
    .subscore-toggle-btn,
    .subscore_expander,
    .btn-to-wishlist *,
    .btn-zum-merkzettel * {
        border: none !important;
    }

    /* Search input container keeps its styling */
    .search-input-container {
        border: 1px solid #ccc !important;
    }

    /* Focus states should use brand colors for better visibility */
    .btn-to-wishlist:focus-visible,
    .btn-zum-merkzettel:focus-visible,
    .search-input-field:focus-visible,
    #search-input:focus-visible,
    .cookie-settings-btn:focus-visible,
    .subscore-toggle-btn:focus-visible,
    .subscore_expander:focus-visible {
        outline: 3px solid #f4a925 !important;
        outline-offset: 2px;
        border: none !important;
    }

    /* Increase text contrast */
    body {
        color: #000;
        background: #fff;
    }

    /* Make sure links are clearly visible */
    a {
        text-decoration: underline !important;
        text-decoration-thickness: 2px;
    }
}

/* --------------------------------------------------
   8. FORCED COLORS MODE (Windows High Contrast)
   -------------------------------------------------- */
@media (forced-colors: active) {
    .skip-link:focus {
        forced-color-adjust: none;
        background: ButtonText;
        color: ButtonFace;
    }
}


/* --------------------------------------------------
   9. FORM LABELS & FIELDSETS
   -------------------------------------------------- */
/* Ensure labels are properly styled */
label {
    cursor: pointer;
    display: inline-block;
}

/* Fieldset styling */
fieldset {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
}

legend {
    padding: 0 10px;
    font-weight: bold;
}

/* Make fieldsets accessible without visual borders when needed */
fieldset.no-border {
    border: none;
    padding: 0;
    margin: 0;
}

fieldset.no-border legend {
    padding: 0;
}


/* --------------------------------------------------
   10. ARIA LIVE REGIONS
   -------------------------------------------------- */
/* Ensure live regions don't cause visual jumps */
[aria-live="polite"],
[aria-live="assertive"],
[role="status"],
[role="alert"] {
    position: relative;
}


/* --------------------------------------------------
   11. TABLE ACCESSIBILITY
   -------------------------------------------------- */
/* Better table caption visibility */
caption {
    padding: 10px;
    font-weight: bold;
    text-align: left;
}

/* Ensure table headers stand out */
th {
    font-weight: bold;
    text-align: left;
}


/* --------------------------------------------------
   12. IMAGE ACCESSIBILITY
   -------------------------------------------------- */
/* Ensure decorative images are properly hidden */
img[alt=""],
img[alt=" "],
img[role="presentation"] {
    /* Decorative images should have empty alt */
}

/* --------------------------------------------------
   13. NAVIGATION IMPROVEMENTS
   -------------------------------------------------- */
/* Pagination accessibility */
nav[aria-label="Seitennummerierung"] a[aria-current="page"] {
    font-weight: bold;
    text-decoration: underline;
}

/* Filter navigation */
nav[aria-label="Produktfilter"] {
    /* Ensure filter navigation is clearly defined */
}


/* --------------------------------------------------
   14. MODAL/DIALOG ACCESSIBILITY
   -------------------------------------------------- */
/* When modals are open, prevent background scrolling */
body.modal-open {
    overflow: hidden;
}

/* Focus trap for modals */
.modal-content:focus {
    outline: none;
}


/* --------------------------------------------------
   15. LINK STYLING
   -------------------------------------------------- */
/* Ensure links are distinguishable from text */
a {
    text-decoration: underline;
}

a:hover,
a:focus {
    text-decoration: none;
}

/* External links indicator (optional but helpful) */
a[target="_blank"]::after {
    content: " ↗";
    font-size: 0.8em;
    vertical-align: super;
}

/* Exception for buttons styled as links */
.button-link::after {
    content: none;
}


/* --------------------------------------------------
   16. COLOR CONTRAST
   -------------------------------------------------- */
/* Ensure minimum contrast ratios (4.5:1 for normal text) */
/* Check your specific colors with a contrast checker */
/* Example: */
.text-muted {
    color: #666; /* Ensure this meets 4.5:1 against background */
}


/* --------------------------------------------------
   17. ERROR MESSAGES & VALIDATION
   -------------------------------------------------- */
/* Make error messages clearly visible */
.error-message,
[aria-invalid="true"] {
    border-color: #d32f2f;
}

.error-text {
    color: #d32f2f;
    font-weight: bold;
}


/* --------------------------------------------------
   18. LOADING STATES
   -------------------------------------------------- */
/* Loading indicators */
[aria-busy="true"] {
    cursor: wait;
    opacity: 0.6;
}

.loading-spinner {
    /* Add spinner animation if needed */
}


/* --------------------------------------------------
   19. RESPONSIVE FONT SIZES
   -------------------------------------------------- */
/* Ensure text can be resized up to 200% */
html {
    font-size: 100%; /* Use relative units */
}

@media (max-width: 768px) {
    html {
        font-size: 100%; /* Don't make it smaller on mobile */
    }
}


/* --------------------------------------------------
   20. PRINT STYLES
   -------------------------------------------------- */
@media print {
    .skip-link,
    .btn-zum-merkzettel,
    button,
    nav {
        display: none;
    }

    a[href]::after {
        content: " (" attr(href) ")";
    }
}


/* --------------------------------------------------
   21. SPECIFIC COMPONENT FIXES
   -------------------------------------------------- */

/* Filter mobile button */
#filterlink_mobil {
    width: 100%;
    text-align: center;
    padding: 12px;
    background: #f4a925;
    color: white;
    border: none;
    font-size: 16px;
}

#filterlink_mobil:hover,
#filterlink_mobil:focus-visible {
    background: #f4a925;
}

/* Product buttons */
.product-btn {
    min-height: 44px;
    padding: 8px 16px;
}

/* Merkzettel button */
.btn-zum-merkzettel {
    background: transparent;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 8px;
}

.btn-zum-merkzettel:hover,
.btn-zum-merkzettel:focus-visible {
    background: rgba(244, 169, 37, 0.1);
    border-color: #f4a925;
}


/* --------------------------------------------------
   22. UTILITY CLASSES
   -------------------------------------------------- */

/* Visually hidden but available to screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus within container */
.focus-within:focus-within {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* --------------------------------------------------
   23. SLICK SLIDER ACCESSIBILITY (NEW)
   -------------------------------------------------- */
.slick-slider .slick-dots li button:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.slick-arrow:focus {
    outline: 3px solid #3498db;
    outline-offset: 2px;
    z-index: 100;
}

/* --------------------------------------------------
   24. HIGHLIGHT CIRCLES (NEW - for homepage)
   -------------------------------------------------- */
.highlight-circle {
    /* Ensure animations respect motion preferences */
}

@media (prefers-reduced-motion: reduce) {
    .highlight-circle.in-view .circle-svg circle {
        animation: none;
        stroke-dasharray: 596.9 596.9;
    }
}

/* --------------------------------------------------
   25. PRODUCT PREVIEW TILES (NEW)
   -------------------------------------------------- */
.product-preview-tile:focus-within {
    box-shadow: 0 0 0 3px #3498db;
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* --------------------------------------------------
   26. BLOG PREVIEW CARDS (NEW)
   -------------------------------------------------- */
.blog-preview-item:focus-within {
    outline: 2px solid #3498db;
    outline-offset: 2px;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

/* --------------------------------------------------
   27. INFO DIALOG IMPROVEMENTS (NEW)
   -------------------------------------------------- */
#info_dialog[aria-hidden="true"] {
    display: none;
}

#info_dialog[aria-hidden="false"] {
    display: block;
}

.info-icon:focus {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* --------------------------------------------------
   28. HIGH CONTRAST MODE - NUCLEAR OVERRIDES
   -------------------------------------------------- */
@media (prefers-contrast: more) {
    /* Search input should never have a border */
    .search-input-field,
    #search-input,
    input.search-input-field {
        border: none !important;
        outline: none !important;
    }

    /* Cookie settings button should never have a border */
    .cookie-settings-btn,
    button.cookie-settings-btn,
    #open_preferences_center {
        border: none !important;
        background: transparent !important;
    }

    /* Only show outline when focused */
    .search-input-field:focus-visible,
    #search-input:focus-visible {
        outline: 3px solid #f4a925 !important;
        outline-offset: 2px;
        border: none !important;
    }

    /* Cookie button gets orange focus on dark background */
    .cookie-settings-btn:focus-visible,
    #open_preferences_center:focus-visible {
        outline: 3px solid #f4a925 !important;
        outline-offset: 2px;
        border: none !important;
        background: rgba(244, 169, 37, 0.1) !important;
    }

    /* Wishlist buttons should have no border */
    .btn-to-wishlist,
    .btn-zum-merkzettel,
    button.btn-to-wishlist,
    button.btn-zum-merkzettel,
    button.subscore-toggle-btn,
    button.subscore_expander {
        border: none !important;
        background: transparent !important;
    }

    /* Product tiles should have no border */
    .product-preview-tile {
        border: none !important;
    }

    .product-preview-tile-availability {
        color: #2c2c2c !important;
    }

    .product-preview-tile-title {
        color: #000 !important;
        text-decoration: underline !important;
    }
}
