/* Moodozvon — страница /rooms (Мои комнаты).
   Использует токены и базовые компоненты из style.css + структуру profile.css. */

.profile-header {
    /* Кнопка «+ Создать» вместо профильного spacer'а справа. */
}

.rooms-create-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rooms-root {
    background: transparent;
    border: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.rooms-root[aria-busy="true"] .profile-card__loader {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 32px;
}

.rooms-empty {
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-xl);
    padding: 40px 24px;
    text-align: center;
    color: var(--text-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.rooms-empty h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text);
    font-weight: 700;
}

/* --- Карточка комнаты в списке --- */

.room-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, transform 0.1s;
}
.room-card:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}
.room-card:active { transform: scale(0.99); }

.room-card__visibility {
    width: 40px;
    height: 40px;
    border-radius: var(--r-md);
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    flex-shrink: 0;
}
.room-card__visibility svg { width: 18px; height: 18px; }
.room-card.is-private .room-card__visibility {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: color-mix(in oklab, var(--accent) 30%, transparent);
}

.room-card__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.room-card__name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.room-card__slug {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-dim);
}
.room-card__slug::before { content: "/r/"; }

.room-card__meta {
    font-size: 12px;
    color: var(--text-dim);
    flex-shrink: 0;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-end;
}
.room-card__meta a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
}
.room-card__meta a:hover { text-decoration: underline; }

/* --- Модалки (используют общий .modal-overlay/.modal-content из style.css) --- */

.rooms-modal { max-width: 460px; }
.rooms-modal--wide { max-width: 560px; }

.rooms-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px 0 8px;
}

.rooms-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.rooms-field__label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    font-weight: 600;
}
.rooms-field__hint {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.4;
}
.rooms-field__preview {
    font-family: var(--mono);
    color: var(--text-2);
}

.rooms-toggle-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    cursor: pointer;
}
.rooms-toggle-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    margin-top: 1px;
    flex-shrink: 0;
}
.rooms-toggle-row__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}
.rooms-toggle-row__info strong { color: var(--text); font-weight: 600; }
.rooms-toggle-row__info span { color: var(--text-dim); font-size: 12px; }

/* --- Detail-модалка: переименование, мемберы, удаление --- */

.rooms-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rooms-detail__section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.rooms-detail__section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    font-weight: 600;
}

.rooms-detail__row {
    display: flex;
    gap: 10px;
    align-items: center;
}
.rooms-detail__row .profile-input { flex: 1; min-width: 0; }
.rooms-detail__row .mz-btn { flex-shrink: 0; }

.rooms-detail__link {
    font-family: var(--mono);
    font-size: 13px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 8px 12px;
    color: var(--text-2);
    word-break: break-all;
}

/* Members */
.rooms-members {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
}
.rooms-members::-webkit-scrollbar { width: 6px; }
.rooms-members::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }

.member-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.member-row__av-wrap {
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
    width: 32px;
    height: 32px;
}
.member-row__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background:
        linear-gradient(135deg,
            color-mix(in oklab, var(--accent) 50%, var(--surface-3)),
            color-mix(in oklab, var(--accent) 15%, var(--surface-3)));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}
.member-row__avatar img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.member-row__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.member-row__name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.member-row__role {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.member-row__remove {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    flex-shrink: 0;
}
.member-row__remove:hover { background: var(--danger-soft); color: var(--danger); }
.member-row__remove svg { width: 16px; height: 16px; }

.rooms-detail__danger {
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 640px) {
    .profile-header { gap: 10px; }
    .rooms-create-btn { padding: 0 12px; }
    .room-card { padding: 14px; gap: 12px; }
    .room-card__visibility { width: 36px; height: 36px; }
    .rooms-modal { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}
