/* ===== Mehrsprachige Unterstützung ===== */

/* Aktiver Sprach-Button in der Leiste */
.toolbar-action-btn.language-active,
.task-options-item.language-active {
    background-color: #dbeafe;
    border-color: #60a5fa;
    color: #1e3a8a;
}

/* Wrapper um den Leisten-Button: Anker für das Popover (CSS-positioniert,
   damit es im iOS-WebView nicht verrutscht) */
.language-button-wrap {
    position: relative;
    display: inline-flex;
}

/* Dropdown direkt über dem Button */
.language-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);   /* direkt über dem Button */
    right: 0;                   /* rechtsbündig zum Button, öffnet nach links ins Bild */
    width: min(320px, calc(100vw - 24px));
    background: #ffffff;
    border-radius: 20px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.06),
        0 2px 8px rgba(15, 23, 42, 0.08),
        0 18px 42px rgba(15, 23, 42, 0.22);
    padding: 8px;
    max-height: min(560px, calc(100vh - 32px));
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 2000;
}

.language-dropdown.opens-down {
    top: calc(100% + 8px);
    bottom: auto;
}

.language-dropdown-header {
    padding: 10px 12px 12px;
}

.language-dropdown-title {
    font-weight: 800;
    font-size: 17px;
    line-height: 1.25;
    color: #172033;
    text-wrap: balance;
}

.language-dropdown-subtitle {
    margin-top: 3px;
    color: #667085;
    font-size: 13px;
    line-height: 1.4;
    text-wrap: pretty;
}

.language-thinking-card,
.language-sharing-card {
    border-radius: 12px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.05),
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 3px 8px rgba(15, 23, 42, 0.04);
}

.language-thinking-card {
    padding: 12px;
    background: #effcf6;
}

.language-card-heading,
.language-sharing-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.language-card-icon {
    display: grid;
    place-items: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
    font-size: 17px;
    line-height: 1;
}

.language-card-eyebrow {
    margin: 1px 0 3px;
    color: #047857;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.045em;
    line-height: 1.3;
    text-transform: uppercase;
    text-wrap: balance;
}

.language-card-heading p,
.language-sharing-card p {
    margin: 0;
    color: #526075;
    font-size: 13px;
    line-height: 1.42;
    text-wrap: pretty;
}

.language-choice-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
}

.language-dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 46px;
    padding: 7px 10px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
    color: #1f2937;
    font: inherit;
    font-size: 15px;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.045);
    transition-property: transform, background-color, box-shadow, color;
    transition-duration: 150ms;
    transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.language-dropdown-item:hover,
.language-dropdown-item:focus-visible {
    background: #ffffff;
    box-shadow:
        0 0 0 2px rgba(5, 150, 105, 0.22),
        0 3px 8px rgba(15, 23, 42, 0.08);
    outline: none;
}

.language-dropdown-item:active {
    transform: scale(0.96);
}

.language-dropdown-item.selected {
    background: #ffffff;
    color: #065f46;
    box-shadow:
        0 0 0 2px rgba(5, 150, 105, 0.3),
        0 3px 9px rgba(5, 150, 105, 0.1);
}

.language-symbol,
.language-flag {
    display: grid;
    place-items: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: #f1f5f9;
    font-size: 16px;
    line-height: 1;
}

.language-flag {
    font-size: 20px;
}

.language-dropdown-item .language-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.language-dropdown-item .language-check {
    flex: 0 0 20px;
    color: #059669;
    font-weight: 700;
    opacity: 0;
    text-align: center;
}

.language-dropdown-item.selected .language-check {
    opacity: 1;
}

.language-dropdown-item.language-always-active {
    cursor: default;
}

.language-dropdown-item.language-always-active:active {
    transform: none;
}

.language-always-label {
    flex: 0 0 auto;
    padding: 3px 7px;
    border-radius: 999px;
    background: #d1fae5;
    color: #047857;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.035em;
}

.language-dropdown-item.language-more {
    margin-top: 2px;
    background: transparent;
    color: #3952a0;
    box-shadow: 0 0 0 1px rgba(57, 82, 160, 0.18);
}

.language-add-symbol {
    background: #eef2ff;
    color: #3952a0;
    font-size: 20px;
}

.language-sharing-card {
    margin-top: 8px;
    padding: 12px;
    background: #f1f7ff;
}

.language-sharing-card .language-card-eyebrow {
    color: #31569a;
}

/* Sprachliste in den Einstellungen */
.language-settings-list {
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.language-settings-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 6px 8px;
    background: #f9fafb;
    border-radius: 8px;
}

.language-settings-row .language-flag {
    font-size: 20px;
}

.language-settings-row .language-name {
    flex: 1 1 auto;
}

.language-settings-row .language-remove {
    min-width: 40px;
    min-height: 40px;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
}

.language-settings-row .language-remove:hover {
    color: #dc2626;
    background: #fee2e2;
}

.language-empty {
    color: #9ca3af;
    padding: 4px 8px;
    font-style: italic;
}

.language-add-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.language-add-row input {
    flex: 1 1 auto;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    min-width: 0;
}

.language-add-row input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.3);
}

@media (max-width: 520px) {
    .language-add-row {
        flex-direction: column;
    }

    .language-add-row button {
        min-height: 44px;
    }
}
