/*
 * Enterprise Theme Accessibility Overrides
 * Global contrast and hover readability hardening for light/dark themes.
 */

:root {
    --contrast-light-text: #0f172a;
    --contrast-light-muted: #334155;
    --contrast-dark-text: #f8fafc;
    --motion-interactive-duration: 180ms;
    --motion-surface-duration: 220ms;
}

/* Keep button link states independent from global anchor hover rules */
a.btn,
a.btn:hover,
a.btn:focus,
a.btn:active,
a.btn:visited {
    text-decoration: none;
}

/* Primary button: always readable */
.btn-primary,
a.btn.btn-primary,
button.btn.btn-primary,
.btn-primary:hover,
a.btn.btn-primary:hover,
button.btn.btn-primary:hover,
.btn-primary:focus,
a.btn.btn-primary:focus,
.btn-primary:active,
a.btn.btn-primary:active,
.btn-primary:visited,
a.btn.btn-primary:visited {
    color: #ffffff !important;
}

/* Secondary button: dark mode */
.btn-secondary,
a.btn.btn-secondary,
button.btn.btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.26);
    color: var(--contrast-dark-text) !important;
}

.btn-secondary:hover,
a.btn.btn-secondary:hover,
button.btn.btn-secondary:hover,
.btn-secondary:focus,
a.btn.btn-secondary:focus,
.btn-secondary:active,
a.btn.btn-secondary:active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.38);
    color: var(--contrast-dark-text) !important;
}

/* Secondary button: light mode */
[data-theme="light"] .btn-secondary,
[data-theme="light"] a.btn.btn-secondary,
[data-theme="light"] button.btn.btn-secondary {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: var(--contrast-light-text) !important;
}

[data-theme="light"] .btn-secondary:hover,
[data-theme="light"] a.btn.btn-secondary:hover,
[data-theme="light"] button.btn.btn-secondary:hover,
[data-theme="light"] .btn-secondary:focus,
[data-theme="light"] a.btn.btn-secondary:focus,
[data-theme="light"] .btn-secondary:active,
[data-theme="light"] a.btn.btn-secondary:active {
    background: #cbd5e1;
    border-color: #94a3b8;
    color: var(--contrast-light-text) !important;
}

/* Ghost button contrast */
[data-theme="light"] .btn-ghost,
[data-theme="light"] a.btn.btn-ghost,
[data-theme="light"] button.btn.btn-ghost {
    background: #ffffff;
    border-color: #cbd5e1;
    color: var(--contrast-light-text) !important;
}

[data-theme="light"] .btn-ghost:hover,
[data-theme="light"] a.btn.btn-ghost:hover,
[data-theme="light"] button.btn.btn-ghost:hover {
    background: #eef4ff;
    border-color: #1e5db8;
    color: #0d3a7a !important;
}

/* Fix explicit white-background inline button variants (seen on some pages) */
.btn[style*="background: white"],
.btn[style*="background:#fff"],
.btn[style*="background: #fff"],
.btn[style*="background:#ffffff"],
.btn[style*="background: #ffffff"] {
    background: #ffffff !important;
    border: 1px solid #1e5db8 !important;
    color: #0d3a7a !important;
    box-shadow: none !important;
}

.btn[style*="background: white"]:hover,
.btn[style*="background:#fff"]:hover,
.btn[style*="background: #fff"]:hover,
.btn[style*="background:#ffffff"]:hover,
.btn[style*="background: #ffffff"]:hover {
    background: #eef4ff !important;
    color: #0d3a7a !important;
}

/* Light mode readability for core surfaces */
[data-theme="light"] .card,
[data-theme="light"] .card p,
[data-theme="light"] .admin-card,
[data-theme="light"] .admin-card p,
[data-theme="light"] .cp-card,
[data-theme="light"] .cp-card p,
[data-theme="light"] .sec-muted {
    color: var(--contrast-light-text);
}

[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
    color: var(--contrast-light-text) !important;
}

/* Inline white text inside light admin cards caused unreadable content */
[data-theme="light"] .admin-card [style*="color:#fff"],
[data-theme="light"] .admin-card [style*="color: #fff"],
[data-theme="light"] .admin-card [style*="color:#ffffff"],
[data-theme="light"] .admin-card [style*="color: #ffffff"],
[data-theme="light"] .admin-card [style*="color: white"] {
    color: var(--contrast-light-text) !important;
}

/* Customer portal buttons */
.cp-btn-primary,
.cp-btn-primary:hover,
.cp-btn-primary:focus,
.cp-btn-primary:active {
    color: #ffffff !important;
}

[data-theme="light"] .cp-btn-secondary,
[data-theme="light"] .cp-btn-secondary:hover,
[data-theme="light"] .cp-btn-secondary:focus,
[data-theme="light"] .cp-btn-secondary:active {
    color: var(--contrast-light-text) !important;
}

[data-theme="dark"] .cp-btn-secondary,
[data-theme="dark"] .cp-btn-secondary:hover,
[data-theme="dark"] .cp-btn-secondary:focus,
[data-theme="dark"] .cp-btn-secondary:active {
    color: var(--contrast-dark-text) !important;
}

/* Hover remaster: stable hitboxes and cleaner visual feedback */
.btn,
.glass-btn,
.cp-btn,
.theme-toggle,
.nav-logo,
.card,
.service-card,
.process-step,
.differentiator-item,
.trust-bar-content,
.trust-item,
.stat-card,
.tool-card,
.status-card,
.cp-card {
    transition:
        background-color var(--motion-interactive-duration) ease,
        color var(--motion-interactive-duration) ease,
        border-color var(--motion-interactive-duration) ease,
        box-shadow var(--motion-surface-duration) ease,
        opacity var(--motion-interactive-duration) ease,
        filter var(--motion-interactive-duration) ease !important;
}

.btn:hover,
.btn:focus,
.glass-btn:hover,
.glass-btn:focus,
.theme-toggle:hover,
.theme-toggle:focus,
.nav-logo:hover,
.nav-logo:focus,
.card:hover,
.service-card:hover,
.process-step:hover,
.differentiator-item:hover,
.trust-bar-content:hover,
.trust-item:hover,
.stat-card:hover,
.tool-card:hover,
.status-card:hover,
.cp-card:hover {
    transform: none !important;
}

.card:hover,
.service-card:hover,
.process-step:hover,
.trust-bar-content:hover,
.cp-card:hover {
    box-shadow: 0 18px 34px rgba(3, 10, 20, 0.22) !important;
}

[data-theme="light"] .card:hover,
[data-theme="light"] .service-card:hover,
[data-theme="light"] .process-step:hover,
[data-theme="light"] .trust-bar-content:hover,
[data-theme="light"] .cp-card:hover {
    box-shadow: 0 16px 32px rgba(22, 43, 80, 0.12) !important;
}

.differentiator-item:hover,
.trust-item:hover,
.stat-card:hover,
.status-card:hover {
    box-shadow: 0 10px 24px rgba(3, 10, 20, 0.14) !important;
}

.tool-card:hover {
    box-shadow: 0 14px 30px rgba(30, 93, 184, 0.16) !important;
}

.tool-card:hover .tool-button,
.service-card:hover .service-icon {
    transform: none !important;
}

.btn-primary:hover,
.btn-secondary:hover,
.glass-btn-primary:hover,
.glass-btn-secondary:hover,
.cp-btn-primary:hover,
.cp-btn-secondary:hover,
.cp-btn-success:hover,
.cp-btn-error:hover,
.cp-btn-ghost:hover {
    filter: brightness(1.03);
}

@media (prefers-reduced-motion: reduce) {
    .btn,
    .glass-btn,
    .cp-btn,
    .theme-toggle,
    .nav-logo,
    .card,
    .service-card,
    .process-step,
    .differentiator-item,
    .trust-bar-content,
    .trust-item,
    .stat-card,
    .tool-card,
    .status-card,
    .cp-card,
    .service-icon,
    .tool-button,
    .btn::before,
    .glass-btn::before {
        animation: none !important;
        transition: none !important;
    }
}

/* Layout scroll fix: avoid nested page scrolling in main content areas */
@media (min-width: 769px) {
    .cp-container,
    .ap-shell,
    .ap-main,
    .cp-main {
        overflow: visible !important;
    }

    .cp-main,
    .ap-main {
        height: auto !important;
        max-height: none !important;
    }

    .cp-sidebar,
    .ap-sidebar {
        height: auto !important;
        max-height: none !important;
    }
}

/* Public scroll stability: avoid iOS/Android compositor scroll artifacts from fixed layers */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
    html,
    body {
        background-attachment: scroll !important;
    }

    .background-techlines-overlay,
    .hero-tech-lines,
    .hero-particles {
        display: none !important;
    }

    .navigation,
    .nav-mobile-menu,
    .theme-toggle,
    .footer-minimal,
    .footer-simple,
    .trust-bar-content,
    .card,
    .card-glass,
    .service-card,
    .process-step,
    .differentiator-item,
    .differentiators-image,
    .differentiators-badge,
    .cta-section-gradient,
    .google-rating-badge,
    .review-card,
    .reviews-empty,
    .qualification-trust-marker,
    .status-badge,
    main#mainContent [style*="backdrop-filter"],
    main#mainContent [style*="-webkit-backdrop-filter"] {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .trust-bar-content,
    .google-rating-badge,
    .review-card,
    .reviews-empty,
    .qualification-trust-marker,
    main#mainContent [style*="overflow: hidden"] {
        overflow: visible !important;
    }

    .review-author-avatar,
    .background-techlines-overlay,
    .hero,
    .hero.hero-compact,
    main#mainContent .card[style*="overflow: hidden"] > div[style*="height: 240px"],
    main#mainContent [style*="border-radius"][style*="overflow: hidden"] {
        overflow: hidden !important;
    }
}

/* Homepage services stability: keep the card block in normal document flow */
#leistungen.services-section,
#leistungen .container,
#leistungen .services-grid,
#leistungen .service-card,
#leistungen .service-icon,
#leistungen .service-title,
#leistungen .service-description {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
}

#leistungen .services-grid {
    align-items: start !important;
}

#leistungen .service-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transform: none !important;
    isolation: auto !important;
}

#leistungen .service-icon {
    overflow: hidden !important;
}
