/* =========================================
   LELH TOOLBAR: SINGLE ROW LAYOUT (STRICT)
   ========================================= */

.lelh-learning-helper-panel {
    display: none; 
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 6px 22px;
    gap: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Căn giữa trang */
    margin: 25px auto !important; 
    width: fit-content;
    max-width: 98%; /* Cho phép rộng gần hết màn hình */
    
    /* [QUAN TRỌNG] Khóa cứng hàng ngang */
    flex-wrap: nowrap !important;
    white-space: nowrap;
    user-select: none;
}

.lelh-learning-helper-panel.has-content {
    display: flex; /* Kích hoạt Flexbox */
}

/* Container trung gian bao quanh các Tabs */
#lelh-panel-options-container {
    display: flex; /* Bắt buộc phải là flex để con của nó không bị block */
    align-items: center;
    min-width: 0; /* Tránh lỗi overflow trong flex item */
}

/* Nội dung từng Tab (chứa các settings con) */
.lelh-tab-content {
    display: flex; /* Xếp các settings thành hàng ngang */
    align-items: center;
    gap: 16px; /* Khoảng cách giữa các setting */
    flex-wrap: nowrap !important; /* Không xuống dòng */
}

/* Từng nhóm Setting (Toggle/Select) */
.lelh-toolbar__group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0; /* Không cho phép bị co nhỏ làm vỡ layout */
    height: 32px; 
}

/* Đường kẻ dọc */
.lelh-toolbar__divider {
    width: 1px;
    height: 18px;
    background-color: #e5e7eb;
    flex-shrink: 0;
    margin: 0;
    display: block; /* Đảm bảo hiển thị */
}

.lelh-toolbar__label {
    font-size: 14px;
    color: var(--tv-neutral-fg, #1f2937);
    font-weight: 500;
    line-height: 1;
}

/* --- CUSTOM SELECT & INPUTS --- */
/* Giữ nguyên style đẹp cũ */
.lelh-custom-select {
    position: relative; height: 32px; font-size: 13px; font-weight: 500; color: #111827; cursor: pointer;
}
.lelh-select-trigger {
    height: 100%; display: flex; align-items: center; justify-content: space-between;
    background-color: #fff; border: 1px solid #d1d5db; border-radius: 16px; padding: 0 30px 0 12px;
    position: relative; transition: all 0.2s ease;
}
.lelh-select-trigger::after {
    content: ''; position: absolute; right: 10px; top: 50%; width: 10px; height: 6px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' fill='none' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center; transform: translateY(-50%); transition: transform 0.2s;
}
.lelh-custom-select:hover .lelh-select-trigger::after, .lelh-custom-select.is-open .lelh-select-trigger::after { transform: translateY(-50%) rotate(180deg); }
.lelh-custom-select:hover .lelh-select-trigger, .lelh-custom-select.is-open .lelh-select-trigger { border-color: var(--tv-accent, #4A5D23); box-shadow: 0 0 0 2px rgba(74, 93, 35, 0.1); }

.lelh-select-options {
    position: absolute; top: calc(100% + 6px); left: 0; min-width: 100%; width: max-content; max-width: 250px;
    background: #ffffff; border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    padding: 6px; z-index: 10001; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.2s;
}
.lelh-select-options::before { content: ''; position: absolute; top: -10px; left: 0; width: 100%; height: 10px; background: transparent; z-index: 1; }
.lelh-custom-select:hover .lelh-select-options, .lelh-custom-select.is-open .lelh-select-options { opacity: 1; visibility: visible; transform: translateY(0); }
.lelh-option { padding: 8px 12px; border-radius: 8px; color: #374151; cursor: pointer; font-size: 13px; line-height: 1.4; position: relative; z-index: 2; }
.lelh-option:hover { background-color: #f3f4f6; color: var(--tv-accent, #4A5D23); }
.lelh-option.selected { background-color: rgba(74, 93, 35, 0.08); color: var(--tv-accent, #4A5D23); font-weight: 600; }

/* Mode Selector Style */
.lelh-mode-selector .lelh-custom-select { margin-right: 0; }
.lelh-mode-selector .lelh-select-trigger {
    background-color: rgba(74, 93, 35, 0.08); border: 1px solid rgba(74, 93, 35, 0.15);
    color: var(--tv-accent, #4A5D23); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; padding: 0 26px 0 14px;
}
.lelh-mode-selector .lelh-select-trigger::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234A5D23' fill='none' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    width: 9px; right: 10px;
}
.lelh-mode-selector .lelh-option { font-size: 12px; text-transform: uppercase; font-weight: 600; }

/* Checkbox */
.lelh-toolbar__checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; line-height: 1; }
.lelh-toolbar__checkbox-label input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--tv-accent, #4A5D23); cursor: pointer; }

/* Mobile: Cho phép cuộn ngang nếu quá dài thay vì rớt dòng */
@media (max-width: 600px) {
    .lelh-learning-helper-panel {
        max-width: 100%;
        border-radius: 0; /* Vuông góc để tràn màn hình */
        border-left: none; border-right: none;
        overflow-x: auto; /* Cho phép cuộn ngang */
        justify-content: flex-start; /* Căn trái để cuộn được */
        padding: 10px 15px;
    }
    .lelh-learning-helper-panel::-webkit-scrollbar { display: none; } /* Ẩn thanh cuộn */
}