/* Виджет «кто онлайн» в шапке сайта. Только для операторов чата поддержки.
   Собственные стили, чтобы не зависеть от site.min.css. */

.op-online {
    position: fixed;
    top: 75px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10050;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0;
    padding: 1px;
    max-width: 860px;

    border: 1.5px solid rgba(16, 185, 129, 0.55);
    border-radius: 0;
    background: rgba(236, 253, 245, 0.1);
    box-shadow:
        0 2px 14px rgba(6, 95, 70, 0.18);
    backdrop-filter: blur(6px);
    font-family: Arial, Helvetica, sans-serif;

    pointer-events: none;
}

.op-online > * { pointer-events: auto; }

/* Подпись «online» перед кнопками: яркий зелёный кружок с подсветкой. */
.op-online__title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 10px 3px 6px;
    color: #475569;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: lowercase;
    white-space: nowrap;
    user-select: none;
}

.op-online__live {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #22c55e;
    box-shadow:
        0 0 0 2px rgba(34, 197, 94, 0.2),
        0 0 6px 1px rgba(34, 197, 94, 0.95),
        0 0 16px 4px rgba(34, 197, 94, 0.5);
    animation: op-live-pulse 2s ease-in-out infinite;
}

@keyframes op-live-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(34,197,94,.2), 0 0 6px 1px rgba(34,197,94,.95), 0 0 16px 4px rgba(34,197,94,.5); }
    50%      { box-shadow: 0 0 0 3px rgba(34,197,94,.28), 0 0 8px 2px rgba(34,197,94,1), 0 0 22px 6px rgba(34,197,94,.62); }
}

.op-online__card {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px;
    /* Прозрачность задаётся цветом фона, а не opacity: иначе вместе с
       кнопкой стали бы прозрачными иконка, цифра и подпись. */
    border: 1px solid rgba(255, 255, 255, 1);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    font-family: Arial, Helvetica, sans-serif;
    cursor: default;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.op-online__card i:first-child { font-size: 17px; }

.op-online__value {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.op-online__label {
    font-size: 15px;
    font-weight: 500;
    color: #6b7280;
}

.op-online__caret {
    margin-left: 2px;
    font-size: 11px !important;
    color: #9aa1b5;
    transition: transform 0.15s ease;
}

/* По роли — свой цвет оттенка, сама кнопка полупрозрачная (видна рамка блока). */
.op-online__card--students {
    border-color: rgba(99, 102, 241, 0.75);
    background: rgba(238, 242, 255, 0.5);
    box-shadow:
        0 0 0 1px rgba(99, 102, 241, 0.45),
        0 0 14px rgba(99, 102, 241, 0.35);
}
.op-online__card--students .op-online__value { color: #4338ca; }
.op-online__card--students i:first-child { color: #6366f1; }

.op-online__card--guests {
    border-color: rgba(203, 213, 225, 1);
    background: rgba(248, 250, 252, 0.1);
}
.op-online__card--guests .op-online__value { color: #475569; }
.op-online__card--guests i:first-child { color: #64748b; }

.op-online__card--instructors {
    border-color: rgba(16, 185, 129, 0.8);
    background: rgba(236, 253, 245, 0.5);
    box-shadow:
        0 0 0 1px rgba(16, 185, 129, 0.5),
        0 0 14px rgba(16, 185, 129, 0.4);
    cursor: pointer;
}
.op-online__card--instructors .op-online__value { color: #047857; }
.op-online__card--instructors i:first-child { color: #10b981; }

.op-online__card--instructors:hover,
.op-online__card--instructors:focus-visible {
    transform: translateY(-2px);
}

.op-online__card--instructors.is-open {
    border-color: #10b981;
    background: rgba(255, 255, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}

.op-online__card--instructors.is-open .op-online__caret {
    transform: rotate(180deg);
}

/* ---- Наведение: тёмная подсветка на всех кнопках ----
   Раньше hover был только у карточки инструкторов и делал её светлее,
   а у «Учеников» и «Гостей» его не было вовсе. Правила стоят после
   ролевых, и по специфичности перебивают цвета ролей. */

.op-online__card:hover,
.op-online__card:focus-visible {
    background: rgba(15, 23, 42, 0.88);
    border-color: rgba(255, 255, 255, 0.45);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.35);
}

.op-online__card:hover .op-online__value,
.op-online__card:focus-visible .op-online__value,
.op-online__card:hover .op-online__label,
.op-online__card:focus-visible .op-online__label,
.op-online__card:hover i:first-child,
.op-online__card:focus-visible i:first-child {
    color: #fff;
}

/* Карточка с ненулевым счётчиком подсвечивается рамкой. */
.op-online__card.has-value { border-width: 1px; }

.op-online__card--students.has-value { border-color: #6366f1; }
.op-online__card--guests.has-value { border-color: #94a3b8; }
.op-online__card--instructors.has-value { border-color: #10b981; }

/* ---- Выпадающий список инструкторов ---- */

.op-online__drop {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: min(400px, calc(100vw - 24px));
    max-height: 340px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0;
    box-shadow: 0 18px 44px rgba(16, 24, 40, 0.18);
    overflow: hidden;
    animation: op-online-drop-in 0.16s ease-out;
}

.op-online__drop[hidden] { display: none; }

@keyframes op-online-drop-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.op-online__drop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #eef0f4;
    color: #111827;
    font-size: 15px;
    font-weight: 700;
}

.op-online__drop-head button {
    border: 0;
    background: transparent;
    color: #9aa1b5;
    font-size: 15px;
    cursor: pointer;
    padding: 4px;
    border-radius: 0;
}

.op-online__drop-head button:hover { background: #eef0f4; color: #4f46e5; }

.op-online__drop-list {
    overflow-y: auto;
    padding: 6px;
}

.op-online__drop-empty {
    padding: 22px 14px;
    text-align: center;
    color: #9aa1b5;
    font-size: 14px;
}

.op-online__person {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 0;
    color: #1f2937;
    font-size: 15px;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.op-online__person:hover {
    background: #ecfdf5;
    color: #047857;
    text-decoration: none;
}

.op-online__person i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    /* Аватар остаётся круглым — радиусы убирались с панели и кнопок. */
    border-radius: 50%;
    background: #d1fae5;
    color: #047857;
    font-size: 12px;
    font-weight: 700;
}

.op-online__person-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.op-online__person-id {
    flex-shrink: 0;
    color: #9aa1b5;
    font-size: 12.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.op-online__person:hover .op-online__person-id { color: #059669; }

/* Без профиля инструктора: строка не ссылка, приглушаем её. */
.op-online__person--plain {
    cursor: default;
    background: rgba(148, 163, 184, 0.12);
}

.op-online__person--plain:hover { background: rgba(148, 163, 184, 0.12); }

.op-online__person--plain i {
    background: #e2e8f0;
    color: #64748b;
}

@media (max-width: 640px) {
    .op-online { gap: 6px; padding: 0 8px; }
    .op-online__card { padding: 7px 10px; gap: 6px; }
    .op-online__label { display: none; }
    .op-online__drop { left: 0; transform: none; width: calc(100vw - 16px); }
    @keyframes op-online-drop-in {
        from { opacity: 0; transform: translateY(-6px); }
        to { opacity: 1; transform: none; }
    }
}