/* Cấu hình thanh chia sẻ */
.vca-share {
    --vca-primary: #00ADEF;
    --vca-active: #007BAA;
    --vca-hover: #005C85;
    --vca-border: #E8E8E8;
    --vca-text: #333333;
    position: relative;
    width: 100%;
    max-width: 120px;
    min-width: 0;
    margin: 0 auto;
    padding: 0;
    border: 1px solid var(--vca-border);
    border-top: 3px solid var(--vca-active);
    border-radius: 0 0 30px 0;
    background-color: #FFFFFF;
    box-sizing: border-box;
}

/* Nhóm chức năng */
.vca-share .vca-share-group {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 22px 5px;
    box-sizing: border-box;
}
.vca-share .vca-share-group + .vca-share-group {
    border-top: 1px solid var(--vca-border);
}
.vca-share .vca-share-title {
    width: 100%;
    margin: 0 0 17px !important;
    padding: 0;
    color: var(--vca-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0;
    text-align: center;
    text-transform: uppercase;
}
.vca-share .vca-share-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Nút và icon chia sẻ */
.vca-share .vca-share-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    min-width: 0;
    min-height: 0;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 5px;
    background-color: transparent !important;
    box-shadow: none !important;
    color: var(--vca-active);
    line-height: 1;
    text-decoration: none;
    text-transform: none;
    cursor: pointer;
    transition: color 0.25s ease, transform 0.25s ease;
}
.vca-share .vca-share-link svg {
    display: block;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    margin: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.vca-share .vca-share-facebook { color: #1877F2; }
.vca-share .vca-share-linkedin { color: #0A66C2; }
.vca-share .vca-share-x { color: #111111; }
.vca-share .vca-share-email,
.vca-share .vca-share-copy,
.vca-share .vca-share-book { color: var(--vca-active); }
.vca-share .vca-share-bell { color: #F07800; }
.vca-share .vca-share-link:hover {
    color: var(--vca-hover);
    background-color: transparent !important;
    box-shadow: none !important;
}
.vca-share .vca-share-link:hover svg { transform: scale(1.12); }
.vca-share .vca-share-link:active svg { transform: scale(0.94); }
.vca-share .vca-share-facebook:hover { color: #105CC6; }
.vca-share .vca-share-linkedin:hover { color: #004B83; }
.vca-share .vca-share-x:hover { color: #555555; }
.vca-share .vca-share-bell:hover { color: #C96100; }
.vca-share .vca-share-link:focus-visible {
    outline: 2px solid var(--vca-primary);
    outline-offset: 2px;
}
.vca-share .vca-share-follow,
.vca-share .vca-share-publication { padding: 22px 5px 25px; }
.vca-share .vca-share-follow .vca-share-title,
.vca-share .vca-share-publication .vca-share-title {
    margin-bottom: 10px !important;
}

/* Thông báo sao chép liên kết */
.vca-share .vca-share-status {
    position: absolute;
    right: calc(100% + 10px);
    bottom: 20px;
    z-index: 20;
    width: max-content;
    max-width: 220px;
    padding: 9px 13px;
    border-radius: 4px;
    background-color: var(--vca-active);
    color: #FFFFFF;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(5px);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
}
.vca-share .vca-share-status.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Sticky thanh chia sẻ từ 901px */
@media only screen and (width > 900px) {
    .vca-news-layout > .vca-sticky-share { align-self: stretch; }
    .vca-sticky-share > .col-inner {
        position: sticky;
        top: 80px;
        height: auto;
        z-index: 10;
        overflow: visible;
    }
    body.admin-bar .vca-sticky-share > .col-inner { top: 112px; }
}

/* Máy tính màn hình lớn */
@media only screen and (min-width: 1200px) {
    .vca-share .vca-share-title { font-size: 14px; }
    .vca-share .vca-share-link { width: 44px; height: 44px; }
}

/* Tablet và máy tính nhỏ */
@media only screen and (min-width: 850px) and (width < 1200px) {
    .vca-share .vca-share-title { font-size: 11px; }
    .vca-share .vca-share-group { padding: 18px 3px; }
    .vca-share .vca-share-link svg { width: 23px; height: 23px; }
}

/* Responsive gốc cho các module Share khác */
@media only screen and (max-width: 849px) {
    .vca-share {
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
        max-width: none;
        width: 100%;
        margin: 10px 0 0;
        border-radius: 0 0 15px 0;
    }
    .vca-share .vca-share-group { flex: 1 1 auto; width: auto; padding: 15px 10px; }
    .vca-share .vca-share-title { margin-bottom: 10px !important; font-size: 12px; }
    .vca-share .vca-share-links { flex-direction: row; flex-wrap: wrap; gap: 4px; }
    .vca-share .vca-share-group + .vca-share-group {
        border-top: 0;
        border-left: 1px solid var(--vca-border);
    }
    .vca-share .vca-share-link svg { width: 24px; height: 24px; }
    .vca-share .vca-share-status {
        right: auto;
        left: 50%;
        bottom: calc(100% + 8px);
        max-width: 95%;
        transform: translate(-50%, 5px);
    }
    .vca-share .vca-share-status.is-visible { transform: translate(-50%, 0); }
}
@media only screen and (max-width: 549px) {
    .vca-share { flex-direction: column; }
    .vca-share .vca-share-group { width: 100%; }
    .vca-share .vca-share-group + .vca-share-group {
        border-left: 0;
        border-top: 1px solid var(--vca-border);
    }
    .vca-share .vca-share-follow,
    .vca-share .vca-share-publication {
        flex-direction: row;
        justify-content: space-between;
        padding: 10px 20px;
    }
    .vca-share .vca-share-follow .vca-share-title,
    .vca-share .vca-share-publication .vca-share-title {
        width: auto;
        margin: 0 !important;
    }
}

/* Trả chiều rộng cột Share cho nội dung tại 850–900px */
@media only screen and (min-width: 850px) and (max-width: 900px) {
    #main .vca-news-layout:has(> .vca-sticky-share) > .col:not(.vca-sticky-sidebar):not(.vca-sticky-share) {
        flex: 1 1 0% !important;
        max-width: none !important;
        min-width: 0;
    }
}

/* Share dùng chung cho các trang có cột vca-sticky-share */
@media only screen and (max-width: 900px) {
    #main .row > .vca-sticky-share.col {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
        padding-bottom: 16px;
        order: 99;
    }
    #main .vca-sticky-share > .col-inner,
    body.admin-bar #main .vca-sticky-share > .col-inner {
        position: static !important;
        top: auto !important;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        height: auto;
        overflow: visible;
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share {
        --vca-primary: #00AEF0;
        --vca-active: #00AEF0;
        --vca-hover: #008FC7;
        --vca-border: #DCE5EA;
        --vca-text: #102B40;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: stretch;
        width: 100%;
        max-width: none;
        min-width: 0;
        margin: 0 auto;
        border-radius: 0;
        border-top-color: var(--vca-primary);
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-group {
        flex: 1 1 320px;
        width: auto;
        min-width: 0;
        padding: 14px 12px;
        justify-content: center;
        gap: 8px;
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-group + .vca-share-group {
        flex: 1 1 120px;
        border: 0;
        border-left: 1px solid var(--vca-border);
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-title {
        width: 100%;
        font-size: 15px;
        line-height: 1.4;
        margin: 0 !important;
        text-align: center;
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-links {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: center;
        justify-items: center;
        width: 100%;
        max-width: 420px;
        gap: 4px;
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-link {
        width: 100%;
        max-width: 52px;
        height: 52px;
        min-height: 48px;
        border-radius: 4px;
        background-color: #F0F5F8 !important;
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-link svg {
        width: 32px;
        height: 32px;
        max-width: 90%;
        max-height: 90%;
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-link:hover,
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-link:focus-visible {
        background-color: #E3F4FC !important;
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-follow,
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-publication {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 12px;
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-status {
        left: 50%;
        right: auto;
        bottom: calc(100% + 8px);
        max-width: 95%;
        background-color: #008FC7;
        transform: translate(-50%, 5px);
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-status.is-visible {
        transform: translate(-50%, 0);
    }
    /* Khi có thêm nhóm theo dõi, tránh ép nhóm chức năng */
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share:has(.vca-share-follow) .vca-share-group:first-child {
        flex-basis: 100%;
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share:has(.vca-share-follow) .vca-share-group + .vca-share-group {
        border-top: 1px solid var(--vca-border);
    }
}

/* Điện thoại: hai hàng gọn, icon lớn */
@media only screen and (max-width: 599px) {
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share { flex-direction: column; }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-group,
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-group + .vca-share-group {
        flex: 0 0 auto;
        width: 100%;
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-group + .vca-share-group {
        border-left: 0;
        border-top: 1px solid var(--vca-border);
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-follow,
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-publication {
        flex-direction: row-reverse;
        justify-content: center;
        gap: 10px;
        padding: 6px 12px;
    }
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-follow .vca-share-title,
    #main :is(.vca-sticky-share, .vca-aw-share-section, .vca-mem-share-section) .vca-share .vca-share-publication .vca-share-title {
        width: auto;
        margin: 0 !important;
    }
}

/* Vị trí Share chung cho Sự kiện và Hội viên */
@media (width > 900px) {
    #main :is(.vca-aw-share-section, .vca-mem-share-section) {
        --vca-share-rail: 96px;
        position: relative !important;
        display: block !important;
        top: auto !important;
        width: 100% !important;
        height: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        overflow-anchor: none;
        pointer-events: none;
        z-index: 90;
    }
    #main :is(.vca-aw-share-section, .vca-mem-share-section) > .section-content {
        position: absolute !important;
        top: 0 !important;
        right: 15px !important;
        left: auto !important;
        width: var(--vca-share-rail) !important;
        max-width: none !important;
        height: var(--vca-share-track-height, 0px) !important;
        padding: 24px 0 !important;
        box-sizing: border-box;
        overflow: visible !important;
        pointer-events: none;
    }
    #main :is(.vca-aw-share-section, .vca-mem-share-section) :is(.vca-aw-share-row, .vca-mem-share-row) {
        position: sticky !important;
        top: 104px !important;
        right: auto !important;
        left: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
        transition: none !important;
        pointer-events: auto;
        visibility: visible !important;
        opacity: 1 !important;
    }
    #main :is(.vca-aw-share-section, .vca-mem-share-section) :is(.vca-aw-share-col, .vca-mem-share-col) {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
        padding: 0 !important;
        margin: 0 !important;
    }
    #main :is(.vca-aw-share-section, .vca-mem-share-section) .vca-share {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        max-height: calc(100vh - 150px);
        overflow-y: auto;
    }
    body.admin-bar #main :is(.vca-aw-share-section, .vca-mem-share-section) :is(.vca-aw-share-row, .vca-mem-share-row) {
        top: 136px !important;
    }
    body.admin-bar #main :is(.vca-aw-share-section, .vca-mem-share-section) .vca-share {
        max-height: calc(100vh - 182px);
    }
}

/* Chừa không gian riêng cho Share trên laptop và tablet ngang */
@media (900px < width < 1200px) {
    #main :is(.vca-aw-share-section, .vca-mem-share-section) {
        --vca-share-rail: 80px;
    }
    #main .vca-awards-page:not(.vca-aw-banner) > .section-content > .vca-aw-row,
    #main :is(.vca-mem-section, .vca-mem-nav) > .section-content > .vca-mem-row {
        width: calc(100% - 160px) !important;
        max-width: none !important;
        margin-left: 24px !important;
        margin-right: auto !important;
    }
    #main .vca-mem-faces .flickity-prev-next-button.previous {
        left: -16px !important;
    }
    #main .vca-mem-faces .flickity-prev-next-button.next {
        right: -20px !important;
    }
}

/* Tablet và mobile: Share toàn chiều ngang, sau nội dung */
@media (max-width: 900px) {
    #main :is(.vca-aw-share-section, .vca-mem-share-section) {
        position: relative !important;
        top: auto !important;
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 16px 15px 24px !important;
        margin: 0 !important;
        overflow: visible !important;
        pointer-events: auto !important;
        z-index: auto;
    }
    #main :is(.vca-aw-share-section, .vca-mem-share-section) > .section-content {
        position: relative !important;
        inset: auto !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        padding: 0 !important;
        pointer-events: auto !important;
    }
    #main :is(.vca-aw-share-section, .vca-mem-share-section) :is(.vca-aw-share-row, .vca-mem-share-row) {
        position: static !important;
        inset: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
        transition: none !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    #main :is(.vca-aw-share-section, .vca-mem-share-section) :is(.vca-aw-share-col, .vca-mem-share-col),
    #main :is(.vca-aw-share-section, .vca-mem-share-section) :is(.vca-aw-share-col, .vca-mem-share-col) > .col-inner {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    #main :is(.vca-aw-share-section, .vca-mem-share-section) .vca-share {
        position: relative !important;
        width: 100% !important;
        max-width: none !important;
        max-height: none !important;
        overflow: visible !important;
        margin: 0 !important;
    }
}

/* Hạn chế chuyển động */
@media (prefers-reduced-motion: reduce) {
    .vca-share *,
    .vca-share *::before,
    .vca-share *::after { transition: none !important; }
    .vca-share .vca-share-link:hover svg,
    .vca-share .vca-share-link:active svg { transform: none; }
}
