/* Biến màu sắc và font chữ */
:root {
    --bg-main: #36325a;
    --bg-sidebar: #2a274a;
    --bg-editor: #302c52;
    --bg-input: #23203f;
    --text-primary: #ffffff;
    --text-secondary: #d1d0e0;
    --accent-primary: #4d79ff;
    --accent-secondary: #2fd67a;
    --border-color: #4a456a;
    --danger-color: #e95678;
    --font-family: 'Segoe UI', 'Roboto', sans-serif;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #2c2a4a 0%, #39345e 100%);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
}

/* ===== CSS CHO THANH ĐIỀU HƯỚNG MỚI ===== */
.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-editor);
    padding: 0 25px;
    border-bottom: 1px solid var(--border-color);
    height: 60px; /* Chiều cao cố định */
    flex-shrink: 0; /* Ngăn co lại */
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.navbar-title {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-primary);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 25px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    font-size: 0.95em;
}

.nav-link:hover {
    color: var(--accent-secondary);
}
/* ===== KẾT THÚC CSS MỚI ===== */


.app-container {
    display: flex;
    flex-grow: 1;
    /* Chiều cao được điều chỉnh để trừ đi thanh điều hướng và chân trang */
    height: calc(100% - 55px - 60px); 
}

/* --- Sidebar --- */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    padding: 15px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 5px;
    flex-shrink: 0;
}
.sidebar-header h2 {
    margin: 0;
    font-size: 1.2em;
}

.add-btn {
    background-color: var(--accent-secondary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#quest-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
    position: relative; 
}

#quest-list li {
    margin-bottom: 8px;
    background-color: var(--bg-editor);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: background-color 0.2s, border-color 0.2s, opacity 0.2s, box-shadow 0.2s;
    flex-wrap: wrap;
}

#quest-list li .quest-item-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer; 
    border-radius: 5px;
    transition: background-color 0.2s;
    gap: 8px; 
}

#quest-list li:hover {
    border-color: var(--accent-primary);
}
#quest-list li.active > .quest-item-header {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    font-weight: bold;
}
#quest-list li.active.quest-chain-starter > .quest-item-header {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

#quest-list li .quest-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    padding-right: 10px;
    pointer-events: none;
}

.quest-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto; 
}

.toggle-chain {
    transition: transform 0.2s ease-in-out;
    font-size: 0.8em;
    padding: 2px;
    cursor: pointer;
}

.quest-chain-starter.expanded > .quest-item-header > .toggle-chain {
    transform: rotate(90deg);
}

.quest-chain-nested {
    list-style: none;
    padding: 10px;
    margin-top: 0;
    width: 100%;
    display: none;
}

.quest-chain-starter.expanded .quest-chain-nested {
    display: block;
}

.quest-chain-nested li.sub-quest .quest-item-header {
    padding: 8px 10px;
    background-color: rgba(0,0,0,0.15);
}

.delete-quest-btn {
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

#quest-list li:hover .delete-quest-btn {
    opacity: 1;
}

/* --- Main Content --- */
.main-content {
    flex-grow: 1;
    padding: 25px;
    overflow-y: auto;
}

.welcome-message {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
}
.welcome-message h3 { font-size: 1.8em; margin-bottom: 10px; }
.welcome-message p { font-size: 1.1em; }


.quest-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.quest-title-input {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--text-primary);
    background: none;
    border: none;
    padding: 5px;
    border-radius: 4px;
    width: 50%;
}
.quest-title-input:focus {
    outline: none;
    background-color: var(--bg-input);
}

.action-btn {
    padding: 12.4px 20px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-weight: bold;
    margin-left: 10px;
    background-color: var(--bg-input);
    color: var(--text-secondary);
}

.wiki-btn:hover { background-color: var(--accent-primary); color: white; border-color: var(--accent-primary); }
.save-btn { background-color: var(--accent-secondary); color: white; border-color: var(--accent-secondary); }
.save-btn:hover { background-color: #55e99f; }

.section {
    background-color: var(--bg-editor);
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(0,0,0,0.1);
}

.section-header h4 {
    margin: 0;
    font-size: 1em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.add-item-btn {
    background-color: var(--accent-secondary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-content {
    padding: 20px;
}
.section-content > div:not(:last-child) {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}


.item-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.form-group { display: flex; flex-direction: column; }
.form-group.flex-grow { flex-grow: 1; }
.form-group label {
    font-size: 0.75em;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    font-weight: bold;
}

.form-group input, .form-group select, .form-group textarea, .pseudo-select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 4px;
    font-size: 0.95em;
    font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 80px; }

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.pseudo-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d1d0e0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 10px center; background-size: 1em;
    width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pseudo-select:hover { border-color: var(--accent-primary); }


.delete-item-btn {
    background-color: var(--danger-color);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: filter 0.2s ease-in-out, opacity 0.2s, background-color 0.2s;
}
.delete-item-btn:hover {
    filter: brightness(0.85);
}
.item-row .delete-item-btn {
    margin-bottom: 8px;
}
.reward-header .delete-item-btn {
    margin-left: auto;
}

.wiki-panel {
    width: 300px;
    background-color: var(--bg-sidebar);
    padding: 15px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
    transition: width 0.3s, padding 0.3s, opacity 0.3s;
}
.wiki-panel.hidden { width: 0; padding: 15px 0; overflow: hidden; opacity: 0; border-left: none;}

.wiki-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-shrink: 0; }
.wiki-header h3 { margin: 0; }
.close-wiki-btn { background: none; border: none; color: var(--text-secondary); font-size: 24px; cursor: pointer; }
#wiki-search {
    width: 100%; padding: 8px; background-color: var(--bg-input); border: 1px solid var(--border-color);
    color: var(--text-primary); border-radius: 4px; margin-bottom: 10px; flex-shrink: 0;
}
#wiki-search:focus { outline: none; border-color: var(--accent-primary); }
#wiki-item-list {
    list-style: none; padding: 0; margin: 0; overflow-y: auto; flex-grow: 1;
}
#wiki-item-list li { 
    padding: 10px; 
    cursor: pointer; 
    border-radius: 4px; 
    transition: background-color 0.2s;
    display: flex; 
    flex-direction: column; 
    align-items: flex-start;
    margin-bottom: 2px;
}
.wiki-item-name {
    font-weight: bold;
}
.wiki-item-desc {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 3px;
    font-style: italic;
}
#wiki-item-list li:hover { background-color: var(--bg-editor); }
#wiki-item-list li.highlighted {
    background-color: var(--accent-secondary);
}
#wiki-item-list li.highlighted .wiki-item-name,
#wiki-item-list li.highlighted .wiki-item-desc {
    color: var(--bg-main);
}

.footer {
    padding: 15px 20px;
    background-color: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    font-size: 0.9em;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.creator-name { font-weight: bold; color: var(--accent-primary); }
.language-switcher { display: flex; gap: 5px; }
.lang-btn { background: none; border: 1px solid var(--text-secondary); color: var(--text-secondary); padding: 5px 10px; border-radius: 4px; cursor: pointer; }
.lang-btn.active { background-color: var(--accent-primary); border-color: var(--accent-primary); color: white; font-weight: bold; }

.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); justify-content: center; align-items: center; }
.modal-content { background-color: var(--bg-editor); padding: 25px; border-radius: 8px; width: 90%; max-width: 600px; position: relative; border: 1px solid var(--border-color); }
.close-modal-btn { color: var(--text-secondary); position: absolute; top: 10px; right: 20px; font-size: 28px; font-weight: bold; cursor: pointer; }
.modal-content h3 { margin-top: 0; color: var(--accent-primary); }
.modal-content p { color: var(--text-secondary); }
.modal-content textarea { width: 100%; min-height: 120px; background-color: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border-color); margin: 10px 0; }
#copy-command-btn { background-color: var(--accent-secondary); color: white; font-weight: bold; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; font-size: 1em; width: 100%; }

/* DÒNG ĐÃ SỬA: Thêm #command-output vào danh sách */
#quest-list, #wiki-item-list, .main-content, #command-output { scrollbar-width: none; }
#quest-list::-webkit-scrollbar, #wiki-item-list::-webkit-scrollbar, .main-content::-webkit-scrollbar, #command-output::-webkit-scrollbar { display: none; }


/* --- 🎨 CẢI TIẾN GIAO DIỆN PHẦN THƯỞNG 🎨 --- */
.reward-entry .reward-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px 15px;
    background-color: #3a3a5c;
    border-radius: 4px;
    margin-bottom: 5px;
}

/* Chỉnh lại vị trí của chữ "Phần thưởng" */
.reward-header > div {
    padding-left: 25px; /* Tạo không gian cho hình tam giác */
}

.reward-entry .reward-header h6 { margin: 0; font-weight: normal; color: #e0e0e0; }
.reward-entry .reward-header .reward-summary { font-style: italic; color: #a0a0c0; margin-left: 10px; }

/* Icon hình tam giác mới, thay thế cho cái cũ */
.reward-entry .reward-header::after {
    content: '▶';
    font-size: 14px;
    color: var(--text-secondary);
    transition: transform 0.2s ease-in-out;
    position: absolute;
    left: 15px; /* Đặt ở bên trái */
    top: 50%;
    /* Căn giữa tam giác theo chiều dọc và reset xoay */
    transform: translateY(-50%) rotate(0deg);
}

.reward-entry.expanded .reward-header::after {
    transform: translateY(-50%) rotate(90deg); /* Xoay 90 độ khi mở */
}

/* Làm cho nút xóa (X) tinh tế hơn */
.reward-header .delete-item-btn {
    background: none; /* Bỏ nền đỏ */
    color: var(--danger-color);
    font-size: 24px;
    opacity: 0.5; /* Làm mờ đi */
}

.reward-header .delete-item-btn:hover {
    opacity: 1; /* Rõ lên khi di chuột */
    background-color: rgba(233, 86, 120, 0.2); /* Thêm hiệu ứng nền nhẹ */
}
/* ------------------------------------------- */

.reward-entry .reward-details-container { display: none; padding-left: 15px; border-left: 2px solid #3a3a5c; margin-top: 5px; }
.reward-entry.expanded .reward-details-container { display: block; }
/* --- CSS CHO SIDEBAR TỰ ĐỘNG ĐÓNG/MỞ --- */

.sidebar {
    /* Thêm 'width' và 'padding' vào transition để hiệu ứng mượt mà */
    transition: width 0.4s ease, padding 0.4s ease;
}

.sidebar.collapsed {
    width: 20px; /* Chiều rộng khi thu gọn, chỉ để lại một dải mỏng */
    padding-left: 0;
    padding-right: 0;
    overflow: hidden; /* Ẩn nội dung bị tràn */
    cursor: pointer; /* Biến con trỏ thành hình bàn tay để báo hiệu có thể tương tác */
}

/* Ẩn toàn bộ nội dung bên trong khi sidebar bị thu gọn */
.sidebar.collapsed > * {
    opacity: 0;
    pointer-events: none; /* Vô hiệu hóa tương tác với các phần tử bị ẩn */
}
/* --- CSS CHO CÁC MỤC CÓ THỂ THU GỌN --- */

.section-header {
    position: relative; /* Cần thiết để định vị icon */
    padding-left: 40px; /* Tạo không gian cho icon tam giác */
    user-select: none; /* Chặn việc bôi đen văn bản khi click */
    cursor: pointer;
}

/* Icon tam giác */
.section-header::before {
    content: '▶';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg); /* Mặc định xoay 90 độ (đang mở) */
    transition: transform 0.2s ease-in-out;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Nội dung của mục */
.section-content {
    /* Sử dụng max-height để có hiệu ứng chuyển động mượt mà */
    max-height: 3000px; /* Một giá trị đủ lớn để chứa mọi nội dung */
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, padding 0.4s ease-in-out, border 0.4s;
}

/* Khi mục bị thu gọn */
.section.collapsed .section-header::before {
    transform: translateY(-50%) rotate(0deg); /* Xoay về 0 độ */
}

.section.collapsed .section-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top: none;
}
/* Định dạng cho placeholder để căn chỉnh thẳng hàng */
.toggle-chain-placeholder {
    display: inline-block;
    width: 1em;
    font-size: 0.8em;
    flex-shrink: 0;
}

.toggle-chain {
    flex-shrink: 0; /* Ngăn icon bị co lại */
}
/* --- CSS CHO MỤC "ITEM DETAILS" CÓ THỂ THU GỌN --- */

.item-form-section .section-header {
    position: relative;
    padding-left: 30px; /* Tạo không gian cho icon */
    user-select: none;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

/* Icon tam giác cho "Item Details" */
.item-form-section .section-header::before {
    content: '▼';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg); /* Mặc định xoay 0 độ (đang mở) */
    transition: transform 0.2s ease-in-out;
    font-size: 10px;
    color: var(--text-secondary);
}

.item-form-section .section-content {
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
    max-height: 1000px; /* Chiều cao đủ lớn để chứa nội dung */
    overflow: hidden;
}

/* Khi mục "Item Details" bị thu gọn */
.item-form-section.collapsed .section-header::before {
    transform: translateY(-50%) rotate(-90deg); /* Xoay ngược 90 độ */
}

.item-form-section.collapsed .section-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}
/* --- TÙY CHỈNH KÍCH THƯỚC TIÊU ĐỀ "ITEM DETAILS" --- */

.item-form-section .section-header {
    /* Giảm padding dọc từ 12px xuống 8px */
    padding-top: 8px;
    padding-bottom: 8px;
    margin-bottom: 10px; /* Thêm một chút khoảng cách dưới header */
}

.item-form-section .section-header h6 {
    margin: 0; /* Bỏ margin mặc định của thẻ h6 */
    font-size: 0.9em; /* Làm cho chữ nhỏ hơn một chút */
    font-weight: 600; /* Giảm độ đậm của chữ */
    color: var(--text-secondary);
}
/* --- CSS ĐỂ CĂN CHỈNH CÁC TRƯỜNG TRÊN CÙNG MỘT HÀNG --- */

/* Đặt chiều rộng cố định cho ô nhập số lượng */
.form-group-small input[type="number"] {
    width: 90px;
}

/* Đảm bảo select box không bị quá rộng */
.reward-item-quest-item {
    min-width: 110px;
}
/* --- TRANG ĐIỂM MÀU SẮC CHO CÁC TIÊU ĐỀ --- */

/* 1. Tiêu đề các mục lớn (Kích Hoạt, Yêu Cầu, Mục Tiêu...) */
.section-header h4 {
    color: var(--accent-secondary); /* Màu xanh lá cây nổi bật */
}

/* 2. Tiêu đề mục "Phần thưởng" (khi thu gọn) */
.reward-header h6 {
    color: #e0e0e0; /* Giữ màu trắng sáng mặc định */
}

/* 3. Tiêu đề con "Item Details" bên trong phần thưởng */
.item-form-section .section-header h6 {
    color: var(--accent-primary); /* Màu xanh dương để phân biệt */
}

/* 4. Tiêu đề chính của Quest (ID nhiệm vụ) */
.quest-title-input {
    color: #f5a623; /* Màu vàng cam cho tiêu đề chính */
}
/* --- CẢI TIẾN GIAO DIỆN CHO CỬA SỔ TẠO NHIỆM VỤ BẰNG AI --- */

/* Áp dụng chung cho cả 2 cửa sổ modal */
.modal-content {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Tạo khoảng cách đều giữa các phần tử */
    border-top: 3px solid var(--accent-primary); /* Thêm một đường nhấn màu xanh ở trên cùng */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); /* Tạo hiệu ứng chiều sâu */
}

/* Cụ thể cho cửa sổ AI */
#ai-generate-modal .modal-content {
    max-width: 550px; /* Cố định chiều rộng tối đa */
    width: 90%; /* Đảm bảo hiển thị tốt trên màn hình nhỏ */
}

#ai-generate-modal h3 {
    font-size: 1.4em;
    color: var(--accent-primary); /* Sử dụng màu nhấn cho tiêu đề */
    margin: 0;
    text-align: center;
}

#ai-generate-modal p {
    color: var(--text-secondary); /* Dùng màu chữ phụ cho phần mô tả */
    line-height: 1.6; /* Tăng khoảng cách dòng cho dễ đọc */
    text-align: center;
    margin: 0 0 5px 0;
}

#ai-idea-input {
    min-height: 120px; /* Đặt chiều cao tối thiểu */
    resize: none; /* Vô hiệu hóa việc kéo để thay đổi kích thước */
    font-size: 1em;
    padding: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#ai-idea-input:focus {
    border-color: var(--accent-secondary); /* Đổi màu viền khi focus */
    box-shadow: 0 0 10px rgba(47, 214, 122, 0.2); /* Thêm hiệu ứng phát sáng nhẹ */
}

#ai-submit-idea-btn {
    padding: 12px 20px;
    font-size: 1.1em;
    border: none;
    transition: background-color 0.2s, transform 0.1s;
    background-color: var(--accent-secondary);
}

#ai-submit-idea-btn:hover {
    background-color: #28b86a; /* Làm màu đậm hơn một chút khi di chuột qua */
    transform: translateY(-1px); /* Tạo hiệu ứng nổi lên một chút */
}

#ai-submit-idea-btn:disabled {
    background-color: var(--border-color);
    cursor: wait;
}
/* --- CSS CHO CỬA SỔ THÔNG BÁO TÙY CHỈNH (VỊ TRÍ TRÊN CÙNG) --- */

/* Ghi đè lại thuộc tính của modal chung để đẩy nó lên trên */
#custom-alert-modal {
    align-items: flex-start; /* Thay vì 'center', đẩy lên trên cùng */
    padding-top: 5vh;      /* Thêm một chút khoảng cách từ mép trên */
}

#custom-alert-modal .modal-content {
    max-width: 450px; 
    text-align: center;
    /* Thêm hiệu ứng animation khi xuất hiện */
    animation: fadeInDown 0.3s ease-out;
}

#custom-alert-title {
    margin-top: 0;
    color: var(--accent-secondary); 
}

#custom-alert-message {
    font-size: 1.1em;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

#custom-alert-ok-btn {
    width: 100%;
    padding: 10px;
}

/* Hiệu ứng animation trượt xuống */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* --- ẨN THANH CUỘN CHO CÁC TEXTAREA --- */

/* Áp dụng cho trình duyệt Chrome, Safari, Edge */
#ai-idea-input::-webkit-scrollbar {
    display: none; /* Ẩn hoàn toàn thanh cuộn */
}

/* Tùy chọn: Áp dụng cho trình duyệt Firefox */
#ai-idea-input {
    scrollbar-width: none; /* Ẩn thanh cuộn trên Firefox */
}
/* ===== CSS ĐỂ TƯƠNG THÍCH VỚI ĐIỆN THOẠI ===== */

/* Áp dụng cho các màn hình có chiều rộng tối đa là 768px (máy tính bảng và điện thoại) */
@media (max-width: 768px) {

    /* Chuyển layout chính từ hàng ngang sang hàng dọc */
    .app-container {
        flex-direction: column;
        height: auto; /* Cho phép nội dung dài ra */
        overflow-y: auto; /* Cho phép cuộn */
    }

    /* Cho phép body cuộn trên điện thoại */
    body {
        overflow: auto;
    }

    /* Sidebar và Wiki sẽ chiếm toàn bộ chiều rộng */
    .sidebar,
    .wiki-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color); /* Thêm viền dưới để phân cách */
    }
    
    .wiki-panel {
        border-left: none;
    }

    /* Nội dung chính không cần padding lớn */
    .main-content {
        padding: 15px;
    }

    /* Điều chỉnh thanh điều hướng trên cùng */
    .top-navbar {
        height: auto; /* Chiều cao tự động */
        flex-direction: column; /* Xếp chồng các mục */
        padding: 10px;
        gap: 10px;
    }

    /* Các nút trong form sẽ chiếm 100% chiều rộng để dễ bấm hơn */
    .item-row {
        flex-direction: column;
        align-items: stretch; /* Căn chỉnh các mục con */
    }

    .item-row .delete-item-btn {
        margin: 10px auto 0;
        width: 100%;
        border-radius: 4px;
        height: 36px;
    }
}