/* ============================================
   DROPDOWN JĘZYKÓW
   ============================================ */

.filter-dropdown--language {
    position: fixed;
    /* filters.js ustawia inline width: auto; !important trzyma stałą szerokość */
    width: 460px !important;
    max-width: calc(100vw - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--color-light-gray) #f5f5f5;
}

.filter-dropdown--language[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.filter-dropdown--language::-webkit-scrollbar { width: 6px; }
.filter-dropdown--language::-webkit-scrollbar-track { background: #f5f5f5; }
.filter-dropdown--language::-webkit-scrollbar-thumb { background: var(--color-light-gray); border-radius: 3px; }
.filter-dropdown--language::-webkit-scrollbar-thumb:hover { background: var(--color-primary); }

/* ============================================
   WIERSZE: "wszystkie", "bez języka", język
   ============================================ */

.language-option,
.language-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: white;
    font-family: var(--font-condensed);
    color: var(--color-secondary);
    box-sizing: border-box;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

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

.language-option {
    justify-content: space-between;
    padding: 12px 16px;
    text-decoration: none;
    cursor: pointer;
}

/* Klik w nazwę języka: dowolny poziom */
.language-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.language-option-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.language-option-count {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 500;
    color: #999;
    background: #f0f0f0;
    border-radius: 10px;
    padding: 2px 6px;
    line-height: 1.4;
}

.language-hint {
    padding: 8px 16px;
    font-family: var(--font-condensed);
    font-size: 12px;
    line-height: 1.35;
    color: #999;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}

/* ============================================
   KULKI POZIOMÓW
   ============================================ */

.language-levels {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
}

.language-level {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    box-sizing: border-box;
    border: 2px solid #d5d5d5;
    background: white;
    color: var(--color-secondary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.language-level.is-disabled,
.language-row.is-disabled .language-level {
    background: #f0f0f0;
    border-color: #f0f0f0;
    color: #c4c4c4;
    pointer-events: none;
    cursor: not-allowed;
}

/* ============================================
   STAN: AKTYWNY
   ============================================ */

.language-option.is-current,
.language-row.is-current {
    background: var(--color-primary);
    color: white;
}

.language-option.is-current .language-option-name,
.language-row.is-current .language-option-name {
    font-weight: 700;
}

.language-option.is-current .language-option-count,
.language-row.is-current .language-option-count {
    color: white;
    background: var(--color-primary-dark);
}

.language-row.is-current .language-level {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.6);
    color: white;
}

/* Skala "mój poziom": kulki do wybranej włącznie */
.language-row.is-current .language-level.is-filled {
    background: white;
    border-color: white;
    color: var(--color-primary);
}

.language-row.is-current .language-level.is-selected {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.language-row.is-current .language-level.is-disabled {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.45);
}

/* ============================================
   STAN: BEZ OFERT
   ============================================ */

.language-option.is-disabled,
.language-row.is-disabled {
    pointer-events: none;
    cursor: not-allowed;
}

.language-option.is-disabled .language-option-name,
.language-row.is-disabled .language-option-name {
    color: #cccccc;
}

/* ============================================
   HOVER: tylko urządzenia ze wskaźnikiem
   ============================================ */

@media (hover: hover) {
    .language-option:hover:not(.is-disabled):not(.is-current),
    .language-row:hover:not(.is-disabled):not(.is-current) {
        background: #f8f8f8;
    }

    .language-row:not(.is-current) .language-level:hover {
        border-color: var(--color-primary);
        color: var(--color-primary);
    }

    .language-row.is-current .language-level:not(.is-filled):hover {
        background: rgba(255, 255, 255, 0.2);
        border-color: white;
    }
}

/* ============================================
   RWD: < 560px pełna szerokość, kulki pod nazwą
   ============================================ */

@media (max-width: 559px) {
    .filter-dropdown--language {
        width: calc(100vw - 40px) !important;
        max-width: 100%;
    }

    .language-row {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .language-row-main {
        flex: 0 0 auto;
    }

    .language-levels {
        justify-content: space-between;
    }

    .language-option,
    .language-row {
        padding: 8px 12px;
    }

    .language-level {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }
}

/* ============================================
   RWD: 380-559px kulki do prawej, licznik przy nazwie
   ============================================ */

@media (min-width: 380px) and (max-width: 559px) {
    .language-levels {
        justify-content: flex-end;
    }

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

/* ============================================
   DYMEK KULKI: liczba ofert do tego poziomu (styl dymka z menu nagłówka)
   ============================================ */

.language-level-hint {
    position: fixed;
    z-index: 10001;
    max-width: calc(100vw - 16px);
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--color-secondary);
    color: var(--color-white);
    font-family: var(--font-condensed);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.language-level-hint.is-visible {
    opacity: 1;
    visibility: visible;
}

.language-level-hint__arrow {
    position: absolute;
    bottom: -6px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--color-secondary);
}

/* Dymek pod kulką, gdy nad nią brakuje miejsca: strzałka na górze */
.language-level-hint.is-below .language-level-hint__arrow {
    top: -6px;
    bottom: auto;
    border-top: 0;
    border-bottom: 6px solid var(--color-secondary);
}