.lelib-global-interaction-panel {
    display: flex;
    gap: 15px;
    margin: 15px 0 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    justify-content: center;
}

.lelib-global-interaction-panel .lelib-admin-edit-btn {
    display: inline-flex;
    align-items: center;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: #7c3aed;
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 10px;
    font-weight: 600;
}

.lelib-global-interaction-panel .lelib-admin-edit-btn:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
    color: #6d28d9;
}

.lelib-global-interaction-panel .lelib-admin-edit-btn .icon {
    display: flex;
    align-items: center;
    color: #8b5cf6;
}

.lelib-global-interaction-panel button {
    display: inline-flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    transition: all 0.2s ease;
    gap: 10px;
}

.le-interaction-chip {
    background: #e2e8f0;
    color: #475569;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-family: inherit;
    font-size: 0.85em;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
}

.lelib-global-interaction-panel button:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    color: #212529;
}

.lelib-global-interaction-panel button .icon {
    display: flex;
    align-items: center;
    color: #6c757d;
}

.lelib-global-interaction-panel button.savelike-is-active {
    background: #fff0f0;
    border-color: #ffd8d8;
    color: #dc3545;
}

.lelib-global-interaction-panel button.savelike-is-active .icon {
    color: #dc3545;
}

.lelib-global-interaction-panel button.savelike-is-active svg {
    fill: #dc3545;
}

.lelib-global-interaction-panel button.savelike-is-active .le-interaction-chip {
    background: #dc3545;
    color: #fff;
}

.lelib-global-interaction-panel button.is-loading {
    opacity: 0.7;
    cursor: wait;
}

/* Specific styling for page labels in THX_EC Panel if needed */
.thx-ec-btn-action .page-label {
    font-weight: 600;
    color: #2c3e50;
}

/* Liked Pages Hover Menu */
.le-liked-pages-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.le-liked-pages-menu {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    margin-bottom: 10px;
    /* Space between button and popup */
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 16px;
    min-width: 220px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

/* Invisible bridge to prevent menu from closing when cursor is in the gap */
.le-liked-pages-menu::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 15px;
    /* Slightly larger than margin-bottom */
    background: transparent;
}

.le-liked-pages-wrapper:hover .le-liked-pages-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-10px);
    pointer-events: auto;
}

.le-liked-pages-title {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 12px;
    display: block;
    white-space: nowrap;
    text-align: left;
}

.le-liked-pages-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.le-liked-page-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.2s;
}

.le-liked-page-item:hover {
    background: #8b5cf6;
    color: #fff !important;
    
}

.le-liked-page-item.is-current {
    background: #e2e8f0;
    color: #94a3b8 !important;
    cursor: default;
    pointer-events: none;
    opacity: 0.7;
}

.le-liked-pages-empty {
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
    text-align: center;
    width: 100%;
}

/* --- DIFFICULTY DISPLAY (THX_EC GLOBAL) --- */
.thx-ec-diff-bars {
    display: inline-flex;
    align-items: flex-end;
    justify-content: flex-end;
    /* Căn lề phải cho các vạch */
    gap: 2px;
    height: 14px;
    width: 18px;
    min-width: 18px;
    vertical-align: -1px;
}

.thx-ec-diff-bars .bar {
    width: 3px;
    border-radius: 1px;
    display: none;
    transition: all 0.3s ease;
}

/* Level Icons & Bars Alignment fix */
.thx-ec-diff-bars .dashicons {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
    display: flex;
    align-items: center;
    justify-content: flex-end !important;
    /* Căn lề phải cho icon */
}

/* --- Level 1: Luyện tập (Icon Rotation) --- */
.diff-level-1 .dashicons-update {
    color: #2271b1 !important;
}

/* --- Level 2: Bình thường (1 vạch xanh lá - vạch thứ 3 bên phải) --- */
.diff-level-2 .bar-3 {
    display: block;
    height: 12px;
    background: #16a34a;
}

/* --- Level 3: Khó (2 vạch vàng - vạch 2 và 3 bên phải) --- */
.diff-level-3 .bar-2 {
    display: block;
    height: 9px;
    background: #eab308;
}

.diff-level-3 .bar-3 {
    display: block;
    height: 12px;
    background: #eab308;
}

/* --- Level 4: Rất khó (3 vạch đỏ) --- */
.diff-level-4 .bar-1 {
    display: block;
    height: 6px;
    background: #ef4444;
}

.diff-level-4 .bar-2 {
    display: block;
    height: 10px;
    background: #ef4444;
}

.diff-level-4 .bar-3 {
    display: block;
    height: 14px;
    background: #ef4444;
}

/* --- DIFFICULTY DROPDOWN (Specific to Practice Panel) --- */
.thx-ec-practice-diff-wrapper {
    position: relative;
    display: inline-block;
}

body.thx-focus-active .thx-ec-practice-diff-wrapper {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(100%);
    transition: all 0.3s ease;
}

.thx-ec-diff-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #d0d5dd;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #344054;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
    outline: none !important;
}

.thx-ec-diff-trigger:hover {
    border-color: #98a2b3;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.thx-ec-diff-prefix {
    color: #667085;
    font-weight: 400;
}

.thx-ec-diff-current-label {
    font-weight: 600;
}

.thx-ec-diff-arrow {
    font-size: 14px !important;
    width: 14px !important;
    height: 14px !important;
    color: #98a2b3;
    transition: transform 0.2s ease;
    margin-left: 2px;
}

.thx-ec-practice-diff-wrapper.is-open .thx-ec-diff-arrow,
.thx-ec-practice-diff-wrapper:hover .thx-ec-diff-arrow {
    transform: rotate(180deg);
}

.thx-ec-diff-dropdown {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 4px;
    z-index: 999;
    min-width: 160px;
    display: none;
    animation: thx-ec-diff-dropdown-in 0.15s ease-out;
}

@keyframes thx-ec-diff-dropdown-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.thx-ec-practice-diff-wrapper.is-open .thx-ec-diff-dropdown,
.thx-ec-practice-diff-wrapper:hover .thx-ec-diff-dropdown {
    display: block;
}

/* Cầu nối vô hình giúp không bị mất hover khi rê chuột qua khoảng hở 6px */
.thx-ec-diff-dropdown::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 10px;
    background: transparent;
}

.thx-ec-diff-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    transition: background 0.15s ease;
}

.thx-ec-diff-option:hover {
    background: #f1f5f9;
}

.thx-ec-diff-option.is-selected {
    background: #eff6ff;
    font-weight: 600;
    color: #2271b1;
}

.thx-ec-practice-diff-wrapper[data-current="1"] .thx-ec-diff-current-label {
    color: #2271b1 !important;
}

.thx-ec-practice-diff-wrapper[data-current="2"] .thx-ec-diff-current-label {
    color: #16a34a !important;
}

.thx-ec-practice-diff-wrapper[data-current="3"] .thx-ec-diff-current-label {
    color: #ca8a04 !important;
}

.thx-ec-practice-diff-wrapper[data-current="4"] .thx-ec-diff-current-label {
    color: #dc2626 !important;
}

/* --- MOBILE FIX FOR DROPDOWN (Chống tràn do overflow-x: auto của thẻ cha) --- */
@media (max-width: 600px) {
    .thx-ec-diff-dropdown {
        position: fixed !important;
        bottom: 70px !important; /* Hiển thị ngay trên Bottom Panel */
        right: 15px !important;
        min-width: 170px !important;
        z-index: 999999 !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.2) !important;
    }
}