/**
 * Khung rút gọn cho các khối nội dung dài (bảng lịch sử cập nhật plugin).
 *
 * Chiều cao tối đa do PHP truyền vào qua biến --devvn-collapse-max nên chỉ khai báo ở
 * một chỗ duy nhất. Mặc định khung đã ở trạng thái rút gọn để không bị chớp nội dung
 * lúc tải trang; thẻ noscript trong PHP sẽ mở lại khi trình duyệt tắt JavaScript.
 */
.devvn-collapse {
    position: relative;
    margin-bottom: 20px;
}

.devvn-collapse-inner {
    position: relative;
    max-height: var(--devvn-collapse-max, 1000px);
    overflow: hidden;
}

.devvn-collapse.is-open .devvn-collapse-inner {
    max-height: none;
}

/* Chỉ phủ lớp mờ khi nội dung thật sự bị cắt, nếu không bảng ngắn sẽ bị làm nhạt oan.
   max-height ghim chiều cao hộp lại nên bottom:0 nằm đúng mép vùng đang nhìn thấy. */
.devvn-collapse.is-clipped .devvn-collapse-inner:after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 110px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 92%);
}

.devvn-collapse.is-clipped.is-open .devvn-collapse-inner:after {
    display: none;
}

.devvn-collapse-btn {
    display: block;
    margin: 14px auto 0;
    padding: 9px 26px;
    background: #fff;
    border: 1px solid #cfdae4;
    border-radius: 6px;
    color: #145688;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color .18s linear, border-color .18s linear, color .18s linear;
}

.devvn-collapse-btn:hover,
.devvn-collapse-btn:focus {
    background: #145688;
    border-color: #145688;
    color: #fff;
}

.devvn-collapse-btn:focus-visible {
    outline: 3px solid #007bb6;
    outline-offset: 2px;
}

.devvn-collapse-btn:after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin: -3px 0 0 9px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    vertical-align: middle;
}

.devvn-collapse.is-open .devvn-collapse-btn:after {
    margin-top: 2px;
    transform: rotate(-135deg);
}

/* [hidden] nằm ở UA stylesheet nên luôn thua author style, phải khoá lại */
.devvn-collapse-btn[hidden] {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .devvn-collapse-btn {
        transition: none;
    }
}
