/**
 * Theme Custom CSS
 * Light/Dark theme variables for Bootstrap integration
 */

/* ============================================================================
   Theme Variables
   ============================================================================ */

:root {
    /* Light Theme Colors */
    --bs-body-bg: #ffffff;
    --bs-body-color: #212529;
    --bs-border-color: #dee2e6;
    --bs-light-bg: #f8f9fa;

    /* Calendar Colors (Dark theme for hero section) */
    --calendar-bg: rgba(0, 0, 0, 0.3);
    --calendar-header: #ffffff;
    --calendar-day: #ffffff;
    --calendar-day-hover: rgba(255, 255, 255, 0.1);
    --calendar-event: #0d6efd;
    --calendar-current: #fd7e14;
    --bg-secondary: rgba(255, 255, 255, 0.1);
    --bg-tertiary: rgba(255, 255, 255, 0.2);
    --bg-primary: rgba(0, 0, 0, 0.3);
    --bg-overlay: rgba(0, 0, 0, 0.5);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.5);
    --text-inverse: #ffffff;
    --border-color: rgba(255, 255, 255, 0.2);
    --border-dark: rgba(255, 255, 255, 0.3);
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-full: 50%;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
    /* Dark Theme Colors */
    --bs-body-bg: #1a1a1a;
    --bs-body-color: #e0e0e0;
    --bs-border-color: #404040;
    --bs-light-bg: #2d2d2d;

    /* Calendar Colors (same as light mode since calendar is always in dark hero) */
    --calendar-bg: rgba(0, 0, 0, 0.3);
    --calendar-header: #ffffff;
    --calendar-day: #ffffff;
    --calendar-day-hover: rgba(255, 255, 255, 0.1);
    --calendar-event: #0d6efd;
    --calendar-current: #fd7e14;
    --bg-secondary: rgba(255, 255, 255, 0.1);
    --bg-tertiary: rgba(255, 255, 255, 0.2);
    --bg-primary: rgba(0, 0, 0, 0.3);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.5);
    --border-color: rgba(255, 255, 255, 0.2);
    --border-dark: rgba(255, 255, 255, 0.3);
}

/* Apply theme colors to body and components */
body {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark theme adjustments for Bootstrap components */
[data-theme="dark"] {
    /* Navbar */
    .navbar-light {
        background-color: var(--bs-light-bg) !important;
        border-bottom: 1px solid var(--bs-border-color);
    }

    .navbar-light .navbar-brand,
    .navbar-light .navbar-nav .nav-link {
        color: var(--bs-body-color) !important;
    }

    .navbar-light .navbar-nav .nav-link:hover {
        color: #007bff !important;
    }

    .navbar-toggler {
        border-color: var(--bs-border-color);
    }

    /* Cards */
    .card {
        background-color: var(--bs-light-bg);
        border-color: var(--bs-border-color);
        color: var(--bs-body-color);
    }

    /* Forms */
    .form-control,
    .form-select {
        background-color: var(--bs-light-bg);
        border-color: var(--bs-border-color);
        color: var(--bs-body-color);
    }

    .form-control:focus,
    .form-select:focus {
        background-color: var(--bs-light-bg);
        border-color: #007bff;
        color: var(--bs-body-color);
    }

    /* Buttons */
    .btn-outline-secondary {
        color: var(--bs-body-color);
        border-color: var(--bs-border-color);
    }

    .btn-outline-secondary:hover {
        background-color: var(--bs-border-color);
        border-color: var(--bs-border-color);
    }

    /* Tables */
    .table {
        color: var(--bs-body-color);
    }

    .table-striped > tbody > tr:nth-of-type(odd) > * {
        background-color: rgba(255, 255, 255, 0.05);
    }

    /* Modals */
    .modal-content {
        background-color: var(--bs-light-bg);
        color: var(--bs-body-color);
    }

    .modal-header {
        border-bottom-color: var(--bs-border-color);
    }

    .modal-footer {
        border-top-color: var(--bs-border-color);
    }

    /* Badges */
    .badge {
        color: #ffffff;
    }

    /* Top bar */
    .bg-light {
        background-color: var(--bs-light-bg) !important;
    }

    .border-bottom {
        border-bottom-color: var(--bs-border-color) !important;
    }

    /* Footer */
    footer {
        background-color: var(--bs-light-bg);
        border-top: 1px solid var(--bs-border-color);
    }

    /* Event Detail Page Dark Mode */
    section[style*="background-color: #fff"],
    section[style*="background-color:#fff"] {
        background-color: var(--bs-body-bg) !important;
    }

    /* Event detail text colors */
    h1[style*="color: #000"],
    h1[style*="color:#000"],
    h2[style*="color: #000"],
    h2[style*="color:#000"],
    p[style*="color: #000"],
    p[style*="color:#000"],
    div[style*="color: #000"],
    div[style*="color:#000"],
    span[style*="color: #000"],
    span[style*="color:#000"],
    a[style*="color: #000"],
    a[style*="color:#000"] {
        color: var(--bs-body-color) !important;
    }

    /* Event detail specific text */
    div[style*="color: #333"],
    div[style*="color:#333"],
    span[style*="color: #333"],
    span[style*="color:#333"] {
        color: #b0b0b0 !important;
    }

    div[style*="color: #666"],
    div[style*="color:#666"],
    span[style*="color: #666"],
    span[style*="color:#666"] {
        color: #999 !important;
    }

    /* SVG icons - use current color */
    svg[stroke="currentColor"] {
        color: var(--bs-body-color) !important;
    }

    /* Back button border */
    a[style*="border-color:black"],
    a[style*="border-color: black"] {
        border-color: var(--bs-border-color) !important;
    }

    /* Text muted */
    .text-muted {
        color: #999 !important;
    }

    /* "Kein Bild verfügbar" background */
    .bg-light {
        background-color: var(--bs-light-bg) !important;
    }

    /* "Mehr lesen" button - white outline in dark mode */
    .readmore {
        border-color: #fff !important;
        color: #fff !important;
    }

    .readmore:hover {
        background-color: #fff !important;
        color: #1a1a1a !important;
    }

    /* Icon box links (WhatsApp, etc.) - white in dark mode */
    .iconbox a {
        color: #fff !important;
    }

    .iconbox a:hover {
        color: #ccc !important;
    }

    /* SVG icons with fill="currentColor" inherit white color */
    .iconbox svg {
        color: #fff !important;
    }
}

/* Theme Toggle Button States */
#theme-switcher .icon-sun,
#theme-switcher .icon-moon {
    transition: opacity 0.3s ease;
}

/* When in light mode, hide sun icon (show moon to indicate "switch to dark") */
[data-theme="light"] #theme-switcher .icon-sun {
    display: none;
}

/* When in dark mode, hide moon icon (show sun to indicate "switch to light") */
[data-theme="dark"] #theme-switcher .icon-moon {
    display: none;
}

/* Font Size Adjustment */
.font-size-small {
    font-size: 0.875rem;
}

.font-size-large {
    font-size: 1.125rem;
}

/* Accessibility */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Event Card Hover Effect */
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Hero Title Animation */
@media (prefers-reduced-motion: no-preference) {
    .card {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
}

/* ============================================================================
   Theme Switcher Button
   ============================================================================ */

#theme-switcher {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: opacity 0.2s ease;
}

#theme-switcher:hover {
    opacity: 0.8;
}

#theme-switcher:focus {
    /*outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;*/
}

/* Icon visibility based on theme */
[data-theme="light"] #theme-switcher .icon-sun {
    display: none;
}

[data-theme="light"] #theme-switcher .icon-moon {
    display: inline-block;
}

[data-theme="dark"] #theme-switcher .icon-sun {
    display: inline-block;
}

[data-theme="dark"] #theme-switcher .icon-moon {
    display: none;
}

/* Prevent flash of unstyled content */
html.no-transition * {
    transition: none !important;
}

/* Apply theme colors to body */
body {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ============================================================================
   High Contrast Mode
   ============================================================================ */

.contrast-high {
    --kkblau: #000;
    --kkrot: #000;
    --kkzartblau: #eee;
    --kkhellblau: #eee;
    --kkhellgrau: #eee;
    --kkgrau: #000;
    --kkzartgrau: #fff;
}

.contrast-high img {
    filter: grayscale(100%);
}

/* High contrast for hero mask/logo */
.contrast-high .mask-kultur-aktuell {
    filter: grayscale(100%) contrast(150%);
}

.contrast-high .claim {
    color: #fff !important;
}

.contrast-high .currentdate {
    color: #fff !important;
}



/* High contrast for category headings */
.contrast-high .eventcontainer h2,
.contrast-high .exhibcontainer h2 {
    color: #000 !important;
    font-weight: 900 !important;
    background-image: none !important;
    -webkit-text-fill-color: #000 !important;
    text-fill-color: #000 !important;
    background-clip: unset !important;
    -webkit-background-clip: unset !important;
}

.contrast-high .eventcontainer h2::before,
.contrast-high .exhibcontainer h2::before,
.contrast-high .eventcontainer h2::after,
.contrast-high .exhibcontainer h2::after {
    background-color: #000 !important;
}

/* High contrast for calendar */
.contrast-high .calendar-widget {
    filter: grayscale(100%) contrast(150%);
}

.contrast-high .calendar-month-year {
    color: #fff;
    font-weight: 900;
}

.contrast-high .calendar-weekday {
    color: #fff;
    font-weight: 700;
}

.contrast-high .calendar-day {
    color: #fff;
    border: 1px solid #fff;
}

.contrast-high .calendar-day.has-events {
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #000;
}

.contrast-high .calendar-day.weekend {
    background: #888 !important;
    color: #000 !important;
}

.contrast-high .calendar-day.weekend.has-events {
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #000;
}

.contrast-high .calendar-day.current {
    background: #666 !important;
    color: #fff !important;
    border: 2px solid #fff;
}

/* High contrast for buttons */

.contrast-high .badge {
    background-color: #000 !important;
}

.contrast-high .readmore {
    background-color: #fff !important;
    color: #000 !important;
    border: 3px solid #000 !important;
    font-weight: 900 !important;
}

.contrast-high .readmore:hover {
    background-color: #000 !important;
    color: #fff !important;
}

/* High contrast for Bootstrap buttons */
.contrast-high .btn {
    font-weight: 900 !important;
    border-width: 3px !important;
}

.contrast-high .btn-primary {
    background-color: #000 !important;
    border-color: #000 !important;
    color: #fff !important;
}

.contrast-high .btn-primary:hover {
    background-color: #fff !important;
    border-color: #000 !important;
    color: #000 !important;
}

.contrast-high .btn-success {
    background-color: #000 !important;
    border-color: #000 !important;
    color: #fff !important;
}

.contrast-high .btn-success:hover {
    background-color: #fff !important;
    border-color: #000 !important;
    color: #000 !important;
}

.contrast-high .btn-secondary {
    background-color: #fff !important;
    border-color: #000 !important;
    color: #000 !important;
}

.contrast-high .btn-secondary:hover {
    background-color: #000 !important;
    border-color: #000 !important;
    color: #fff !important;
}

.contrast-high .btn-info,
.contrast-high .btn-warning,
.contrast-high .btn-danger {
    background-color: #000 !important;
    border-color: #000 !important;
    color: #fff !important;
}

.contrast-high .btn-info:hover,
.contrast-high .btn-warning:hover,
.contrast-high .btn-danger:hover {
    background-color: #fff !important;
    border-color: #000 !important;
    color: #000 !important;
}

/* High contrast for export page elements */
.contrast-high .headline-block {
    background-color: #fff !important;
}

.contrast-high .headline-block h1,
.contrast-high .headline-block .display-4,
.contrast-high .headline-block .display-1,
.contrast-high .headline-block .display-2,
.contrast-high .headline-block .display-3,
.contrast-high .headline-block .display-5,
.contrast-high .headline-block .display-6 {
    color: #000 !important;
    font-weight: 900 !important;
    background-image: none !important;
    -webkit-text-fill-color: #000 !important;
    text-fill-color: #000 !important;
    background-clip: unset !important;
    -webkit-background-clip: unset !important;
}

.contrast-high .headline-block p,
.contrast-high .headline-block .lead {
    color: #000 !important;
    font-weight: 700 !important;
}

.contrast-high .display-4,
.contrast-high .display-1,
.contrast-high .display-2,
.contrast-high .display-3,
.contrast-high .display-5,
.contrast-high .display-6 {
    color: #000 !important;
    font-weight: 900 !important;
}

.contrast-high h1,
.contrast-high h2,
.contrast-high h3,
.contrast-high h4,
.contrast-high h5,
.contrast-high h6 {
    color: #000 !important;
    font-weight: 900 !important;
}

.contrast-high p {
    color: #000 !important;
}

.contrast-high .card {
    background-color: #fff !important;
    border: 3px solid #000 !important;
    color: #000 !important;
}

.contrast-high .card-body {
    background-color: #fff !important;
    color: #000 !important;
}

.contrast-high .nav-tabs {
    border-bottom: 3px solid #000 !important;
}

.contrast-high .nav-link {
    color: #000 !important;
    border: 3px solid #000 !important;
    background-color: #fff !important;
    font-weight: 900 !important;
}

.contrast-high .nav-link.active {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #000 !important;
}

.contrast-high .nav-link:hover {
    background-color: #eee !important;
    color: #000 !important;
}

.contrast-high .form-control,
.contrast-high .form-select {
    background-color: #fff !important;
    border: 3px solid #000 !important;
    color: #000 !important;
    font-weight: 700 !important;
}

.contrast-high .form-control:focus,
.contrast-high .form-select:focus {
    background-color: #fff !important;
    border-color: #000 !important;
    color: #000 !important;
    box-shadow: 0 0 0 3px #000 !important;
}

.contrast-high .form-label {
    color: #000 !important;
    font-weight: 900 !important;
}

.contrast-high .form-check-input {
    border: 3px solid #000 !important;
}

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

.contrast-high .form-check-label {
    color: #000 !important;
    font-weight: 700 !important;
}

.contrast-high .text-primary {
    color: #000 !important;
}

.contrast-high .text-muted {
    color: #000 !important;
    font-weight: 700 !important;
}

.contrast-high .lead {
    color: #000 !important;
    font-weight: 700 !important;
}

.contrast-high .alert {
    background-color: #fff !important;
    border: 3px solid #000 !important;
    color: #000 !important;
}

.contrast-high code,
.contrast-high pre {
    background-color: #fff !important;
    border: 3px solid #000 !important;
    color: #000 !important;
    font-weight: 700 !important;
}

.contrast-high .api-endpoint,
.contrast-high .api-code {
    background-color: #fff !important;
    border: 3px solid #000 !important;
    color: #000 !important;
}

/* ============================================================================
   Mobile Overflow Fix - Prevents horizontal scrolling
   ============================================================================ */

/* Critical fix: Prevent horizontal overflow on mobile */
/* html {
    overflow-x: hidden !important;
    width: 100%;
    position: relative;
}

body {
    overflow-x: hidden !important;
    width: 100%;
    position: relative;
    margin: 0;
    padding: 0;
}

/* Ensure all containers don't exceed viewport width */
/* .container,
.container-fluid {
    max-width: 100% !important;
    overflow-x: hidden;
    padding-left: 15px;
    padding-right: 15px;
} */

/* Fix for rows that might overflow */
/* .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100%;
} */

/* Fix for header and navigation that might cause overflow */
 header {
    max-width: 100%;
}
/*
header .blackbox,
header .superordinate,
header .navibox {
    max-width: 100%;
    overflow-x: hidden;
} */

/* Ensure columns don't overflow on mobile */
@media (max-width: 767px) {
    .row {
        margin-left: -15px;
        margin-right: -15px;
    }

    [class*="col-"] {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Fix for images that might overflow */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Prevent long text from overflowing */
    body, p, h1, h2, h3, h4, h5, h6, div, section {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Fix for tables on mobile */
    table {
        max-width: 100%;
        overflow-x: auto;
        display: block;
    }

    /* Ensure main content doesn't overflow */
    main {
        overflow-x: hidden;
        max-width: 100%;
    }

    /* Fix footer on mobile */
    footer {
        overflow-x: hidden;
        max-width: 100%;
    }

    footer .container {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* Specific fix for hero section if it causes overflow */
/* .hero-section,
.banner,
.jumbotron {
    max-width: 100%;
    overflow-x: hidden;
} */

/* Fix for modals on mobile */
@media (max-width: 767px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
}

/* Ensure no element exceeds viewport */
* {
    /*max-width: 100%;*/
}

/* Exception for specific elements that need full width */
 /*html, body, .container-fluid, .row {
    max-width: none;
}

.container {
    max-width: 100%;
} */
