/**
 * Settings Controls - Professional Redesign
 * Clean, structured layout for all settings controls
 */

/* Main Container */
.settings-controls-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1000;
}

/* Top Left: Logo & Family Code */
.settings-top-left {
    position: fixed;
    top: 20px;
    left: 24px;
    right: 24px;
    z-index: 1001;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.settings-top-left > * {
    pointer-events: auto;
}

.settings-logo-group {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border-radius: 50px;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    flex: 0 0 auto;
    position: relative;
}

/* Login/Register: Logo-Gruppe wie linke Nav – nur Kreis, keine Pill/Insel (gleicher Look wie eingeloggt) */
body.page-login .settings-logo-group,
body.page-register .settings-logo-group,
body.page-persons:has(#createPersonForm) .settings-logo-group {
    background: transparent;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
}
body.page-login .settings-logo-group:hover,
body.page-register .settings-logo-group:hover,
body.page-persons:has(#createPersonForm) .settings-logo-group:hover {
    box-shadow: none;
}

/* Remove bottom-right border-radius when dropdown is active */
.settings-logo-group:has(.profile-selector-dropdown-new[style*="display: block"]) {
    border-bottom-right-radius: 0;
}

.profile-selector-container-new.search-active ~ .profile-selector-dropdown-new[style*="display: block"] ~ .settings-logo-group,
.settings-logo-group:has(+ .profile-selector-dropdown-new[style*="display: block"]) {
    border-bottom-right-radius: 0;
}

/* Mobile: nur KINMA-Kreis — volle Rundung (keine abgeflachte Seite durch Dropdown-Anbindung oder breite Pill) */
@media (max-width: 1024px) {
    body:not(.page-login):not(.page-register):not(.page-persons) .settings-top-left .settings-logo-group:not(:has(.profile-selector-bar-new)),
    body.page-persons:not(:has(#createPersonForm)) .settings-top-left .settings-logo-group:not(:has(.profile-selector-bar-new)) {
        width: 52px;
        height: 52px;
        min-width: 52px;
        min-height: 52px;
        max-width: 52px;
        max-height: 52px;
        padding: 0;
        box-sizing: border-box;
        justify-content: center;
        align-items: center;
        border-radius: 9999px;
        border-bottom-right-radius: 9999px !important;
    }

    body:not(.page-login):not(.page-register):not(.page-persons) .settings-top-left .settings-logo-group:not(:has(.profile-selector-bar-new)) .settings-logo-btn,
    body.page-persons:not(:has(#createPersonForm)) .settings-top-left .settings-logo-group:not(:has(.profile-selector-bar-new)) .settings-logo-btn {
        max-width: 52px;
        max-height: 52px;
        border-radius: 9999px;
    }
}

.settings-logo-group .profile-selector-bar-new {
    flex: 0 0 auto;
    margin-left: auto;
}

.language-control-inline {
    margin-left: 0;
    flex-shrink: 0;
}

.language-control-inline .settings-control-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
}

.language-control-inline .language-icon {
    width: 16px;
    height: 16px;
}

.language-control-inline .language-flag-bg {
    border-radius: 50%;
}

.settings-logo-group:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Kinma: nur Flaggenring (außen) + innerer Kreis + Logo – kein äußerer Button-Ring */
.settings-logo-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    aspect-ratio: 1;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 9999px;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    color: #1a1a1a;
    transition: all 0.2s ease;
    overflow: visible;
    -webkit-tap-highlight-color: transparent;
}
/* Nur Einstellungen-Top-Bar — nicht linke Nav (dort: navigation.css / style.css, inset-basiert) */
.settings-top-left .settings-logo-btn .kinma-lang-outline {
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-sizing: border-box;
}
.settings-top-left .settings-logo-btn .kinma-lang-inner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    z-index: 1;
    pointer-events: none;
}
.settings-top-left .settings-logo-btn .settings-logo-img,
.settings-top-left .settings-logo-btn .kinma-logo-img {
    position: relative;
    z-index: 2;
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
}

.settings-top-left .settings-logo-btn:hover {
    transform: scale(1.02);
}
.settings-top-left .settings-logo-btn:hover .kinma-lang-outline {
    border-color: rgba(255, 255, 255, 1);
    filter: brightness(1.03);
}

/* Linke Nav (Login/Register/Join + eingeloggt): kein Utility-Pill-Padding, Innenkreis nur per inset */
.left-nav-cluster .utility-island.kinma-logo-island.kinma-logo-btn {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}
/* Weißer Innenkreis — inset (nicht left/top %, sonst kollabiert der Kreis) */
.left-nav-cluster .kinma-logo-btn .kinma-lang-inner,
.left-nav-cluster .kinma-logo-island .kinma-lang-inner {
    position: absolute;
    inset: 12%;
    width: auto;
    height: auto;
    margin: 0;
    transform: none;
    border-radius: 50%;
    background: #ffffff;
    box-sizing: border-box;
    z-index: 1;
    pointer-events: none;
}

/* Login/Register: KINMA-Island wie in der Nav – gleiches Styling, kein Hover-Scale */
.settings-top-left .kinma-logo-island.kinma-logo-btn {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    min-width: 52px;
    max-width: 52px;
    padding: 0;
    border-radius: 50%;
    flex-direction: row;
    justify-content: center;
    align-items: center;
}
.settings-top-left .kinma-logo-island.kinma-logo-btn:hover {
    transform: none;
}
.settings-top-left .kinma-logo-island .kinma-lang-outline {
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-sizing: border-box;
}
.settings-top-left .kinma-logo-island .kinma-lang-inner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    z-index: 1;
    pointer-events: none;
}
.settings-top-left .kinma-logo-island .kinma-logo-img {
    position: relative;
    z-index: 2;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    object-fit: contain;
    display: block;
}
.settings-top-left .kinma-logo-island:hover .kinma-lang-outline {
    border-color: rgba(255, 255, 255, 1);
    filter: brightness(1.03);
}

/* Login / Register / Join: gleiche linke Nav-Säule wie eingeloggt (KINMA + HW-Hinweis) */
body.page-login .left-nav-cluster--auth,
body.page-register .left-nav-cluster--auth,
body.page-join .left-nav-cluster--auth {
    pointer-events: none;
}

@media (min-width: 1025px) {
    body.page-login .left-nav-cluster--auth,
    body.page-register .left-nav-cluster--auth,
    body.page-join .left-nav-cluster--auth {
        display: flex !important;
    }
}

@media (max-width: 1024px) {
    body.page-login .left-nav-cluster--auth,
    body.page-join .left-nav-cluster--auth {
        display: none !important;
    }
}

.settings-logo-btn.active {
    color: #667eea;
}

.settings-logo-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Main Controls: Horizontal Group – only in left-nav-cluster (desktop); hidden in top bar */
.settings-main-controls {
    display: none;
}

/* Login/Register: Oben rechts keine Buttons (Support/Feedback nicht; "Zurück zur Anmeldung" nur in der Wizard-Island unten) */
body.page-login .settings-main-controls,
body.page-register .settings-main-controls,
body.page-persons:has(#createPersonForm) .settings-main-controls {
    display: none !important;
}

.settings-control-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #ffffff;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Profile Button specific styles */
.profile-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0;
}

.settings-control-profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 9999px;
}

.settings-control-profile-initials {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.settings-control-btn:hover {
    background: #f9fafb;
    color: #1a1a1a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.settings-control-btn:active {
    transform: translateY(0);
}

.settings-control-btn svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Register page: "Zurück zur Anmeldung" button with visible label */
.settings-control-btn-label {
    display: none;
}
.auth-back-btn {
    width: auto;
    min-width: 48px;
    padding: 0 14px;
    gap: 8px;
    border-radius: 9999px;
}
.auth-back-btn .settings-control-btn-label {
    display: inline;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Language Button */
.language-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    position: relative;
    overflow: hidden;
    border-radius: 9999px;
}

.language-flag-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
    opacity: 0.9;
    z-index: 1;
}

.language-icon {
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.9)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
}

.language-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: none;
    box-shadow: none;
}

/* Language Dropdown */
.language-dropdown {
    position: absolute;
    left: calc(100% + 12px);
    top: 0;
    width: 200px;
    max-height: 300px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.2s ease;
    z-index: 1002;
}

.language-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.language-option {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
}

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

.language-option:hover {
    background: #f9fafb;
}

.language-option.selected {
    background: rgba(26, 26, 26, 0.05);
}

.language-flag-img {
    width: 28px;
    height: 21px;
    object-fit: cover;
    border-radius: 4px;
}

.language-name {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
}

.language-option.selected .language-name {
    font-weight: 700;
}

/* Support Button - Animated AI Gradient */
@keyframes aiGradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.support-btn {
    background: linear-gradient(
        135deg,
        #667eea 0%,
        #764ba2 12.5%,
        #8b5cf6 25%,
        #a855f7 37.5%,
        #ec4899 50%,
        #f093fb 62.5%,
        #06b6d4 75%,
        #3b82f6 87.5%,
        #6366f1 100%
    );
    background-size: 200% 200%;
    animation: aiGradientShift 8s ease infinite;
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

.support-btn svg,
.support-btn .language-icon {
    position: relative;
    z-index: 1;
}

.support-btn:hover {
    animation-duration: 4s;
}

/* Feedback Button */
.feedback-btn {
    color: #fbbf24;
}

.feedback-btn:hover {
    background: #fef3c7;
    color: #f59e0b;
}

/* Control Panel Button – gleicher Hintergrund wie andere Settings-Buttons, nur blaue Outline; Icon blau */
.settings-control-btn.control-panel-btn {
    background: #ffffff;
    color: #1e40af;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(30, 64, 175, 0.3);
}

.settings-control-btn.control-panel-btn:hover {
    background: #f9fafb;
    color: #1e40af;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 2px rgba(30, 64, 175, 0.4);
}

.settings-control-btn.control-panel-btn--disabled {
    opacity: 0.45;
    cursor: not-allowed;
    color: #94a3b8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    pointer-events: none;
}

/* Quick Access Bars (Desktop only) */
.quick-access-bar {
    position: absolute;
    left: calc(100% + 12px);
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.2s ease;
    z-index: 1002;
    pointer-events: none;
}

.settings-control-item.has-quick-access:hover .quick-access-bar {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

/* Hide quick access on mobile */
.quick-access-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: #ffffff;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 160px;
}

.quick-access-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.quick-access-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.quick-access-item-label {
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
}

/* Legal Info Popup - Backdrop fadet nur beim Schließen; Öffnen = sofort sichtbar, nur Sheet slide-up */
.legal-info-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s ease-out, visibility 0.35s ease-out;
}

.legal-info-backdrop.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 1000000;
}

/* Mobile Sheet: Beim Öffnen kein Backdrop-Fade – sofort sichtbar, nur Sheet gleitet von unten (wie Schließ-Animation umgekehrt) */
@media (max-width: 1024px) {
    .legal-info-backdrop.legal-info-mobile-sheet.open {
        transition: none;
    }
    .legal-info-backdrop.legal-info-mobile-sheet.open.backdrop-fade-out {
        transition: opacity 0.35s ease-out, visibility 0.35s ease-out;
    }
}

/* Schließen: Backdrop erst ausblenden (Fade), danach wird .open entfernt */
.legal-info-backdrop.backdrop-fade-out {
    opacity: 0;
    pointer-events: none;
}

/* When closed: collapse so it cannot block scroll or clicks anywhere */
.legal-info-backdrop:not(.open) {
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: auto !important;
    pointer-events: none !important;
    z-index: -1 !important;
}
.legal-info-backdrop:not(.open) * {
    pointer-events: none !important;
}

/* Override dropdown styles from style.css/misc.css so popup is centered in viewport (desktop: no transform; mobile: slide uses transform) */
.legal-info-backdrop .legal-info-menu,
.legal-info-backdrop .legal-info-menu-popup {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
}
.legal-info-backdrop:not(.legal-info-mobile-sheet) .legal-info-menu-popup {
    transform: none !important;
}

.legal-info-menu-popup {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 48px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.legal-info-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.legal-info-menu-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.legal-info-menu-header-text {
    min-width: 0;
    flex: 1;
}

.legal-info-menu-subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    letter-spacing: 0.01em;
}

.legal-info-tabstrip {
    display: flex;
    gap: 6px;
    padding: 10px 12px 0;
    margin: 0 12px;
    flex-shrink: 0;
    background: #f8fafc;
    border-radius: 14px 14px 0 0;
    border: 1px solid #e2e8f0;
    border-bottom: none;
}

.legal-info-tab {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 10px 10px 0 0;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.legal-info-tab:hover {
    color: #1a1a1a;
    background: rgba(255, 255, 255, 0.65);
}

.legal-info-tab--active {
    color: #312e81;
    background: #ffffff;
    box-shadow: 0 -2px 12px rgba(26, 26, 26, 0.06);
}

.legal-info-menu-content--tabs {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0 12px 12px;
    border-radius: 0 0 14px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: none;
    overflow: hidden;
}

.legal-info-tabpanel {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 18px 20px 22px;
    -webkit-overflow-scrolling: touch;
}

.legal-info-tabpanel[hidden] {
    display: none !important;
}

.legal-info-section--flush {
    margin-top: 0;
}

.legal-info-section--divider {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.legal-popup-theme-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #fbbf24 0%, #f59e0b 45%, #ea580c 100%);
    border: none;
    cursor: pointer;
    color: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
}

.legal-popup-theme-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 18px rgba(234, 88, 12, 0.4);
}

.legal-popup-theme-btn:active {
    transform: scale(0.98);
}

.legal-popup-theme-btn .theme-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.legal-popup-theme-btn .sun-icon {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    opacity: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.legal-popup-theme-btn .moon-icon {
    transform: translate(-50%, -50%) scale(0.6) rotate(-90deg);
    opacity: 0;
}

.legal-info-menu-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    padding: 0;
}

.legal-info-menu-close:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

/* Drag handle – nur auf Mobile sichtbar */
.legal-info-sheet-handle {
    display: none;
    flex-shrink: 0;
    height: 24px;
    align-items: center;
    justify-content: center;
    cursor: grab;
    touch-action: none;
}
.legal-info-sheet-handle:active {
    cursor: grabbing;
}
.legal-info-sheet-handle::before {
    content: '';
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: #d1d5db;
}

.legal-info-menu-content {
    overflow-y: auto;
    padding: 20px 24px 24px;
    -webkit-overflow-scrolling: touch;
}

/* Mobile: Bottom-Sheet – Öffnen = gleiche Animation wie Schließen, nur umgekehrt (Slide von unten nach oben) */
@media (max-width: 1024px) {
    .legal-info-backdrop.legal-info-mobile-sheet {
        align-items: flex-end;
        padding: 0;
    }
    .legal-info-backdrop.legal-info-mobile-sheet .legal-info-menu-popup {
        width: 100%;
        max-width: none;
        max-height: min(100dvh, 100%);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
        /* Geschlossen: unten (100%); Offen: oben (0) – dieselbe Transition in beide Richtungen */
        transform: translateY(100%);
        transition:
            transform 0.4s cubic-bezier(0.32, 0.72, 0, 1),
            height 0.38s cubic-bezier(0.32, 0.72, 0, 1);
    }
    /* Beim Ziehen am Griff: Höhe ohne Transition (wie Kapitel-Sheet) */
    .legal-info-backdrop.legal-info-mobile-sheet .legal-info-menu-popup.legal-sheet-height-dragging {
        transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    }
    .legal-info-backdrop.legal-info-mobile-sheet.sheet-up .legal-info-menu-popup {
        transform: translateY(0);
    }
    .legal-info-backdrop.legal-info-mobile-sheet .legal-info-sheet-handle {
        display: flex;
        padding-top: 12px;
        padding-bottom: 4px;
    }
    .legal-info-tabstrip,
    .legal-info-menu-content--tabs {
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

@media (max-width: 1024px) and (prefers-reduced-motion: reduce) {
    .legal-info-backdrop.legal-info-mobile-sheet .legal-info-menu-popup {
        transition: transform 0.01ms, height 0.01ms;
    }

    .legal-info-backdrop.legal-info-mobile-sheet .legal-info-menu-popup.legal-sheet-height-dragging {
        transition: transform 0.01ms;
    }
}

.legal-info-section {
    margin-bottom: 24px;
}

.legal-info-section:last-child {
    margin-bottom: 0;
}

.legal-info-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.legal-popup-appearance-section .legal-popup-theme-hint {
    margin: 0 0 12px 0;
    font-size: 13px;
    line-height: 1.45;
    color: #6b7280;
}

.legal-popup-theme-control {
    display: flex;
    align-items: center;
}

/* Einstellungen-Button im Rechtliches-Menü */
.legal-info-settings-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.legal-info-settings-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.legal-info-settings-btn:hover {
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
    color: #fff;
}

.legal-info-settings-btn:active {
    transform: translateY(0);
}

.legal-info-settings-btn svg {
    flex-shrink: 0;
}

/* ===== Language scroll picker with flags ===== */
.legal-popup-language-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.legal-popup-language-search {
    position: relative;
    display: flex;
    align-items: center;
}

.legal-popup-language-search-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: #94a3b8;
    pointer-events: none;
    opacity: 0.8;
}

.legal-popup-language-search input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
    font-size: 14px;
    color: #1a1a1a;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.legal-popup-language-search input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.legal-popup-language-search input::placeholder {
    color: #94a3b8;
}

.legal-popup-language-picker-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border: 1px solid rgba(148, 163, 184, 0.3);
    min-height: 96px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 2px 8px rgba(0,0,0,0.06);
}

.legal-popup-language-picker-center-line {
    display: none;
}

.legal-popup-language-picker-scroll {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.legal-popup-language-picker-scroll::-webkit-scrollbar {
    height: 6px;
}

.legal-popup-language-picker-scroll::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.15);
    border-radius: 3px;
}

.legal-popup-language-picker-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #94a3b8, #cbd5e1);
    border-radius: 3px;
}

.legal-popup-language-picker-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.legal-popup-language-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    height: 72px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.85;
    flex-shrink: 0;
    border-radius: 12px;
    border: 1px solid transparent;
    background: rgba(255,255,255,0.55);
}

.legal-popup-language-picker-item.centered {
    opacity: 1;
    background: rgba(255,255,255,0.95);
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.legal-popup-language-picker-item:hover {
    background: rgba(255,255,255,0.85);
    opacity: 0.9;
}

.legal-popup-language-picker-flag {
    width: 36px;
    height: 27px;
    min-width: 36px;
    min-height: 27px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.legal-popup-language-picker-name {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: 0.01em;
}

.legal-popup-language-picker-item.centered .legal-popup-language-picker-name {
    color: #1a1a1a;
}

.legal-popup-language-confirm-wrap {
    display: flex;
    justify-content: center;
    padding-top: 4px;
}

.legal-popup-language-confirm-btn {
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}

.legal-popup-language-confirm-btn:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    box-shadow: 0 4px 12px rgba(99,102,241,0.4);
    transform: translateY(-1px);
}

.legal-popup-language-confirm-btn:active {
    transform: translateY(0) scale(0.98);
}

.legal-info-text {
    padding: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #4b5563;
}

.legal-info-text p {
    margin: 0 0 10px 0;
}

.legal-info-text p:last-child {
    margin-bottom: 0;
}

/* Legacy: keep .legal-info-menu for any non-popup usage */
.legal-info-menu {
    pointer-events: auto;
}

.legal-info-accordion-item {
    margin-bottom: 4px;
}

.legal-info-accordion-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
}

.legal-info-accordion-header:hover {
    background: #f9fafb;
}

.legal-info-accordion-header.active {
    background: #f3f4f6;
}

.accordion-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.legal-info-accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.legal-info-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.legal-info-accordion-content.open {
    max-height: 500px;
}

.legal-info-text {
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.6;
    color: #4b5563;
}

.legal-info-text p {
    margin: 0 0 8px 0;
}

.legal-info-text p:last-child {
    margin-bottom: 0;
}

/* Dark Mode */
body.dark-mode .settings-logo-group {
    background: #1f2937;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
body.dark-mode .settings-logo-btn {
    background: transparent;
}
body.dark-mode .settings-top-left .settings-logo-btn .kinma-lang-outline {
    border-color: rgba(26, 26, 26, 0.95);
}
body.dark-mode .settings-top-left .settings-logo-btn .kinma-lang-inner {
    background: #1f2937;
}

body.dark-mode .profile-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body.dark-mode .settings-control-btn {
    background: #1f2937;
    color: #9ca3af;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .settings-control-btn:hover {
    background: #1a1a1a;
    color: #e5e7eb;
}

body.dark-mode .settings-control-btn.control-panel-btn {
    background: #1f2937;
    color: #60a5fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(96, 165, 250, 0.35);
}

body.dark-mode .settings-control-btn.control-panel-btn:hover {
    background: #1a1a1a;
    color: #60a5fa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(96, 165, 250, 0.45);
}

body.dark-mode .settings-control-btn.control-panel-btn--disabled {
    color: #6b7280;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

body.dark-mode .language-dropdown {
    background: #1f2937;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

body.dark-mode .language-option {
    border-bottom-color: #1a1a1a;
}

body.dark-mode .language-option:hover {
    background: #1a1a1a;
}

body.dark-mode .language-option.selected {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .language-name {
    color: #e5e7eb;
}

body.dark-mode .quick-access-item {
    background: #1f2937;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .legal-info-menu {
    background: #1f2937;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body.dark-mode .legal-info-menu-header {
    border-bottom-color: #1a1a1a;
}

body.dark-mode .legal-info-menu-header h3 {
    color: #e5e7eb;
}

body.dark-mode .legal-info-menu-popup {
    background: #1a1a1a;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

body.dark-mode .legal-info-menu-subtitle {
    color: #94a3b8;
}

body.dark-mode .legal-info-tabstrip {
    background: #1a1a1a;
    border-color: #1a1a1a;
}

body.dark-mode .legal-info-tab {
    color: #94a3b8;
}

body.dark-mode .legal-info-tab:hover {
    color: #e2e8f0;
    background: rgba(26, 26, 26, 0.55);
}

body.dark-mode .legal-info-tab--active {
    color: #e0e7ff;
    background: #1a1a1a;
    box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.35);
}

body.dark-mode .legal-info-menu-content--tabs {
    background: #1a1a1a;
    border-color: #1a1a1a;
}

body.dark-mode .legal-info-section--divider {
    border-top-color: #1a1a1a;
}

body.dark-mode .legal-info-menu-close {
    color: #9ca3af;
}

body.dark-mode .legal-info-menu-close:hover {
    background: #1a1a1a;
    color: #e5e7eb;
}

body.dark-mode .legal-info-section-title {
    color: #d1d5db;
}

body.dark-mode .legal-info-settings-section {
    border-bottom-color: #1a1a1a;
}

body.dark-mode .legal-info-settings-btn {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.4);
}

body.dark-mode .legal-info-settings-btn:hover {
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5);
    color: #fff;
}

body.dark-mode .legal-popup-language-search input {
    background: linear-gradient(to bottom, #1a1a1a, #1a1a1a);
    border-color: #1a1a1a;
    color: #e5e7eb;
}

body.dark-mode .legal-popup-language-search input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

body.dark-mode .legal-popup-language-search input::placeholder {
    color: #6b7280;
}

body.dark-mode .legal-popup-language-picker-wrap {
    background: linear-gradient(135deg, #1a1a1a 0%, #1a1a1a 100%);
    border-color: rgba(71, 85, 105, 0.5);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 2px 8px rgba(0,0,0,0.2);
}

body.dark-mode .legal-popup-language-picker-center-line {
    border-color: #818cf8;
    box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.2), 0 4px 12px rgba(99,102,241,0.25);
}

body.dark-mode .legal-popup-language-picker-item {
    color: #d1d5db;
    background: rgba(26, 26, 26, 0.55);
}

body.dark-mode .legal-popup-language-picker-item.centered {
    background: rgba(30, 27, 75, 0.95);
    border-color: #818cf8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark-mode .legal-popup-language-picker-item:hover {
    background: rgba(26, 26, 26, 0.9);
}

body.dark-mode .legal-popup-language-picker-name {
    color: #e2e8f0;
}

body.dark-mode .legal-popup-language-picker-item.centered .legal-popup-language-picker-name {
    color: #f1f5f9;
}

body.dark-mode .legal-popup-language-confirm-btn {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

body.dark-mode .legal-popup-language-confirm-btn:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

body.dark-mode .legal-info-accordion-header {
    color: #e5e7eb;
}

body.dark-mode .legal-info-accordion-header:hover {
    background: #1a1a1a;
}

body.dark-mode .legal-info-accordion-header.active {
    background: #4b5563;
}

body.dark-mode .legal-info-text {
    color: #9ca3af;
}

/* Responsive: Mobile - Additional adjustments */
