/* Контейнер серверов */
.rules-servers {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px;
    background: #101737;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
    border: none;
}

/* Кнопки навигации */
.rules-server-nav {
    width: 34px;
    height: 34px;
    border: none;
    background: #283465;
    color: #cfdbff;
    font-size: 12px;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.rules-server-nav:hover {
    background: #2f3d75;
    color: #fff;
}

/* Трек серверов */
.rules-servers-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding-bottom: 4px;
    flex: 1;
}

.rules-servers-track::-webkit-scrollbar {
    height: 5px;
}

.rules-servers-track::-webkit-scrollbar-thumb {
    background: rgba(141, 164, 255, 0.35);
    border-radius: 14px;
}

/* Карточка сервера */
.rules-server-card {
    position: relative;
    display: block;
    min-width: 250px;
    padding: 11px 12px 11px 10px;
    background: #283465;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
    text-decoration: none;
    color: #dce6ff;
    transition: background 0.15s;
    overflow: hidden;
    border: none;
}

.rules-server-card:hover {
    background: #2f3d75;
}

.rules-server-card.active {
    background: #18204d;
}

.rules-server-card.active .rules-server-card__address {
    color: #fff;
}

/* Иконка внутри карточки */
.rules-server-card__icon {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.rules-server-card__icon i {
    position: absolute;
    font-size: 50px;
    transform: rotate(336deg);
    right: -14px;
    bottom: -10px;
    color: rgba(255, 255, 255, 0.08);
}

/* Имя сервера */
.rules-server-card__name {
    display: block;
    font-family: 'Furore', sans-serif;
    font-size: 13px;
    letter-spacing: 1px;
    font-weight: 100;
    color: #fff;
    margin-bottom: 5px;
    text-transform: uppercase;
}

/* Адрес сервера */
.rules-server-card__address {
    display: block;
    font-size: 12px;
    color: #8c96c9;
    letter-spacing: 0.5px;
}

/* Сайдбар с категориями */
.rules-categories {
    margin-bottom: 14px;
}

.rules-categories__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: #101737;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
    border: none;
}

.rules-category-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px;
    text-decoration: none;
    color: #8c96c9;
    background: #202853;
    clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 13px 100%, 0 calc(100% - 13px));
    transition: background 0.2s, color 0.2s;
    border: none;
    margin-bottom: 10px;
}

.rules-category-item:hover {
    background: #273163;
    color: #fff;
}

.rules-category-item.active {
    background: #2b3467;
    color: #fff;
}

.rules-category-item__thumb {
    width: 35px;
    min-width: 35px;
    height: 35px;
    min-height: 35px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
    background-color: #38447f;
    flex-shrink: 0;
    border: none;
}

.rules-category-item__thumb i {
    font-size: 18px;
    color: #d8e3ff;
}

.rules-category-item.active .rules-category-item__thumb {
    box-shadow: inset 0 0 0 1px rgba(127, 166, 255, 0.45);
}

.rules-category-item.active .rules-category-item__thumb i {
    color: #ffffff;
}

.rules-category-item__body {
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rules-category-item__name {
    display: block;
    color: inherit;
    font-family: 'Furore', sans-serif;
    font-size: 10.5px;
    font-weight: 100;
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
}

.rules-category-item__desc {
    display: block;
    color: #8fa4ed;
    font-family: inherit;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    line-height: 1.35;
    white-space: normal;
    word-break: break-word;
}

.rules-category-item.active .rules-category-item__desc,
.rules-category-item:hover .rules-category-item__desc {
    color: #b8c8ff;
}

/* Контент правил */
.rules-content {
    min-width: 0;
    padding: 0;
    margin-bottom: 14px;
    border: none;
}

.rules-search {
    margin-bottom: 12px;
    padding: 10px;
    background: #101737;
    clip-path: none;
    border-radius: 8px;
    overflow: visible;
}

.rules-search__line {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rules-search__field {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 240px;
    margin: 0;
    min-height: 42px;
    background: #121a3d;
    border: none;
    border-radius: 8px;
    clip-path: none;
    padding: 8px 12px;
    cursor: text;
    overflow: visible;
}

#rules_search_meta .rules-search__line > .rules-search__field,
#rules_search_meta .rules-search__line > .rules-search__checkbox {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
}

#rules_search_meta .rules-search__checkbox {
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
}

#rules_search_meta #rules_search_all_categories {
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.rules-search__prompt {
    color: #9cb0f6;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.rules-search__field input {
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff !important;
    -webkit-text-fill-color: #fff;
    opacity: 1 !important;
    font-size: 14px;
    line-height: 1.2;
}

.rules-search__field input::placeholder {
    color: #8fa4ed !important;
    opacity: 1;
}

.rules-search__field input::-webkit-input-placeholder {
    color: #8fa4ed !important;
    opacity: 1;
}

.rules-search__field:focus-within {
    box-shadow: 0 0 0 2px rgba(110, 143, 255, 0.2);
}

.rules-search__clear {
    border: 0;
    width: 26px;
    height: 26px;
    cursor: pointer;
    color: #ff9ca3;
    background: #3a1e2a;
    border-radius: 6px;
    clip-path: none;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.rules-search__clear.is-visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.rules-search__checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #d3dcff;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    min-height: 38px;
    padding: 0 10px;
    background: #121a3d;
    border: none;
    border-radius: 8px;
}

.rules-search__checkbox input {
    appearance: none;
    -webkit-appearance: none;
    width: 36px;
    height: 20px;
    margin: 0;
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, #0e1430 0%, #141c43 100%);
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.rules-search__checkbox input::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #d6e2ff 100%);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease;
}

.rules-search__checkbox input:checked {
    background: linear-gradient(180deg, #276dff 0%, #1d58dc 100%);
    box-shadow: 0 0 0 2px rgba(74, 121, 255, 0.22);
}

.rules-search__checkbox input:checked::after {
    transform: translateX(16px);
}

.rules-search__counter {
    margin-left: auto;
    color: #a9bdfd;
    background: #1a2248;
    border: none;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    padding: 8px 12px;
    font-size: 12px;
    display: none;
}

.rules-search__counter strong {
    color: #d7e4ff;
    font-weight: 700;
}

.rules-search__counter.is-visible {
    display: block;
    animation: rulesCounterShow 0.25s ease;
}

.rules-search-category {
    font-size: 11px;
    color: #b8c7ff;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rules-search-category__tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 6px;
    background: rgba(95, 101, 220, 0.14);
    color: #7f9bff;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 10px;
}

.rules-search-category__title {
    color: #d7e4ff;
    font-weight: 600;
}

/* Шапка категории */
.rules-content__header {
    height: 190px;
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
    overflow: hidden;
    position: relative;
    margin-bottom: 14px;
    background-size: cover;
    background-position: center;
    border: none;
}

.rules-content__header-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 18, 47, 0.15) 0%, rgba(10, 15, 43, 0.9) 100%);
}

.rules-content__header-title {
    position: absolute;
    left: 20px;
    bottom: 18px;
    color: #fff;
    font-size: 36px;
    line-height: 1;
    font-family: 'Furore', sans-serif;
    letter-spacing: 1px;
    font-weight: 100;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}

/* Список правил */
.rules-list {
    background: #283465;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    padding: 12px;
    border: none;
}

.rules-list__item {
    border-bottom: 1px solid rgba(132, 153, 238, 0.2);
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.rules-list__item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

.rules-list__item-content {
    font-size: 14px;
    line-height: 1.6;
    white-space: normal;
    color: #fff;
}

/* Блок правила */
.rules-block {
    margin-bottom: 10px;
    background: #1d2651;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    padding: 12px 14px;
    border: none;
}

.rules-block:last-child {
    margin-bottom: 0;
}

.rules-block__title {
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    margin-bottom: 8px;
}

.rules-block__points {
    margin: 0;
    padding-left: 0;
    color: #8c96c9;
    list-style: none;
}

.rules-block__points li {
    margin-bottom: 8px;
    display: block;
}

.rules-block__points li:last-child {
    margin-bottom: 0;
}

.rules-point-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(95, 101, 220, 0.2);
    color: #cad8ff;
    border: none;
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
    min-width: 44px;
    text-align: center;
    margin-bottom: 6px;
}

.rules-point-text {
    color: #dde7ff;
    display: block;
    line-height: 1.45;
}

.highlighted {
    background: rgba(246, 185, 73, 0.28);
    color: #f6b949;
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 700;
}

@keyframes rulesCounterShow {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Нет данных */
.rules-list__no-data {
    text-align: center;
    color: #fff;
    font-size: 11px;
    letter-spacing: 0.5px;
    padding: 16px 14px;
    background: #283465;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    border: none;
}

/* Адаптив */
@media only screen and (max-width: 991.99px) {
    .rules-categories__list {
        margin-bottom: 14px;
    }
}

@media only screen and (max-width: 768px) {
    .rules-servers {
        padding: 6px;
    }

    .rules-server-nav {
        display: none;
    }

    .rules-server-card {
        min-width: 220px;
    }

    .rules-server-card__name {
        font-size: 12px;
    }

    .rules-server-card__address {
        font-size: 15px;
    }

    .rules-content {
        padding: 0;
    }

    .rules-search {
        padding: 8px;
    }

    .rules-search__field {
        min-width: 100%;
    }

    .rules-search__counter {
        margin-left: 0;
    }

    .rules-content__header {
        height: 150px;
    }

    .rules-content__header-title {
        left: 14px;
        bottom: 14px;
        font-size: 26px;
    }

    .rules-list {
        padding: 10px;
    }
}

.rules-punishment {
    margin-top: 10px;
    background: rgba(246, 185, 73, 0.12);
    border-left: 3px solid #f6b949;
    padding: 10px 12px;
    border-radius: 6px;
    color: #f6b949;
    font-size: 13px;
    font-weight: 600;
}

.rules-punishment::before {
    content: '⚠ Наказание: ';
}

.rules-search__field--category-link {
    min-width: 280px;
    flex: 1.2;
}

.rules-search__copy {
    border: 0;
    width: 30px;
    height: 30px;
    cursor: pointer;
    color: #9cb8ff;
    background: #24306a;
    border-radius: 6px;
    flex-shrink: 0;
}

.rules-search__copy:hover {
    background: #2f3d75;
    color: #fff;
}

.rules-categories-list .rules-category-manage {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    margin-bottom: 10px;
    background: #202853;
    clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 13px 100%, 0 calc(100% - 13px));
    border-radius: 0;
}

.rules-category-manage.active {
    background: #2b3467;
}

.rules-category-manage__icon {
    width: 35px;
    height: 35px;
    min-width: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #38447f;
    clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
    border-radius: 0;
    color: #d8e3ff;
    flex-shrink: 0;
    font-size: 18px;
}

.rules-category-manage.active .rules-category-manage__icon {
    box-shadow: inset 0 0 0 1px rgba(127, 166, 255, 0.45);
}

.rules-category-manage__body {
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    padding: 0;
    margin: 0;
    text-decoration: none;
    color: inherit;
    background: transparent;
    clip-path: none;
    letter-spacing: normal;
    font-size: inherit;
    font-weight: inherit;
    font-family: inherit;
    text-transform: none;
}

.rules-category-manage__name {
    display: block;
    width: 100%;
    max-width: 100%;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.25;
    white-space: normal;
    overflow: visible;
    word-break: break-word;
}

.rules-category-manage__desc {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    color: #8fa4ed;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.35;
    white-space: normal;
    overflow: visible;
    word-break: break-word;
}

.rules-category-manage__actions,
.rules-item-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 0;
    padding-top: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.rules-category-manage:hover .rules-category-manage__actions,
.rules-category-manage:focus-within .rules-category-manage__actions,
.rules-item:hover .rules-item-actions,
.rules-item:focus-within .rules-item-actions {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

@media (hover: none) {
    .rules-category-manage__actions,
    .rules-item-actions {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}

.rules-category-manage__btn {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    color: #fff;
    background: #3d4f9f;
}

.rules-category-manage__btn--danger {
    background: #c94b4b;
}

.rules-category-add-btn {
    width: 100%;
    margin-top: 6px;
    padding: 12px;
    border: 0;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
	background: radial-gradient(100% 100% at 50% 0, #1f76f7 0, #9647ff 130%);
    clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 13px 100%, 0 calc(100% - 13px));
}

.rules-category-add-btn:hover {
    opacity: 0.7;
}

.rules-drag-handle {
    color: #7f93c8;
    cursor: grab;
    font-size: 18px;
    flex-shrink: 0;
}

.rules-dragging {
    opacity: 0.55;
}

.rules-add-rule-btn {
    position: absolute;
    right: 16px;
    bottom: 16px;
    border: 0;
    padding: 10px 14px;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
		background: radial-gradient(100% 100% at 50% 0, #1f76f7 0, #9647ff 130%);
    clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 13px 100%, 0 calc(100% - 13px));
}

.rules-add-rule-btn:hover {
    opacity: 0.7;
}

.rules-add-rule-modal-btn {
    position: absolute;
    right: 16px;
    bottom: 16px;
    border: 0;
    padding: 10px 14px;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
	background: radial-gradient(100% 100% at 50% 0, #1f76f7 0, #9647ff 130%);
    clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 13px 100%, 0 calc(100% - 13px));
}

.rules-add-rule-modal-btn:hover {
    opacity: 0.7;
}

.rules-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 0;
    background: #1d2651;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    border-radius: 0;
}

.rules-item:last-child {
    margin-bottom: 0;
}

.rules-item__inner {
    flex: 1;
    min-width: 0;
}

.rules-item__top {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.rules-item__badge {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(95, 101, 220, 0.2);
    border: none;
    color: #cad8ff;
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
    flex-shrink: 0;
}

.rules-item__body {
    min-width: 0;
}

.rules-item__text {
    display: block;
    color: #dde7ff;
    font-size: 14px;
    line-height: 1.45;
}

.rules-item__body .rules-punishment {
    margin-top: 10px;
}

.rules-item-actions__btn {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    color: #fff;
    background: #3d4f9f;
}

.rules-item-actions__btn--link {
    background: #276dff;
}

.rules-item-actions__btn--danger {
    background: #c94b4b;
}

.rules-item--highlight {
    box-shadow: 0 0 0 2px rgba(246, 185, 73, 0.65);
}

.rules-modal .modal-content {
    background: #121a3d;
    color: #fff;
    border: none;
}

.rules-modal__field {
    margin-bottom: 12px;
}

.rules-modal__field label {
    color: #9cb0f6;
    font-size: 13px;
}

.rules-modal .form-control {
    background: #0e1430;
    color: #fff;
}

.rules-modal__field .custom-file {
    margin-top: 6px;
}

.rules-modal__image-preview {
    display: block;
    width: 100%;
    max-height: 140px;
    margin-top: 20px;
    object-fit: cover;
    border-radius: 8px;
}

.rules-modal__image-preview[hidden] {
    display: none;
}