/* ========================================================== */
/* ============== FILE: danduoc.css ========================= */
/* ========================================================== */

/* --- KHUNG CHÍNH TOÀN MÀN HÌNH --- */
.ld-fullscreen-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #121212;
    background-image: url('/assets/chua.jpg'); /* Giữ nền game */
    background-size: cover;
    background-position: center;
    z-index: 140; /* Đảm bảo nằm trên game chính */
    display: flex;
    flex-direction: column;
    color: #e0e0e0;
}

/* --- HEADER --- */
.ld-header {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background: rgba(15, 15, 15, 0.8);
    border-bottom: 1px solid #4d3c2a;
    flex-shrink: 0;
}

.ld-main-title {
    margin: 0;
    flex-grow: 1;
    text-align: center;
    color: #E48F45;
    font-size: 1.6em;
}

/* Nút quay lại (sử dụng lại từ style.css) */
.ld-header .back-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 1.8em;
    cursor: pointer;
    padding: 0 15px 0 0;
    transition: color 0.3s;
}
.ld-header .back-btn:hover {
    color: white;
}


/* --- THANH TABS CON --- */
.ld-tabs-nav {
    display: flex;
    justify-content: center;
    background: rgba(10, 10, 10, 0.7);
    padding: 5px;
    gap: 5px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.ld-tab-link {
    background: transparent;
    border: 1px solid #555;
    color: #aaa;
    padding: 8px 18px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    border-radius: 4px;
}

.ld-tab-link:hover {
    background: #444;
    color: #fff;
}

.ld-tab-link.active {
    background: #995A3A;
    color: white;
    border-color: #E48F45;
}

/* --- KHUNG NỘI DUNG CHÍNH --- */
.ld-content-wrapper {
    flex-grow: 1;
    overflow: hidden; /* Để scroll bên trong grid */
    padding: 10px;
}

.ld-tab-content {
    display: none;
    height: 100%;
}

.ld-tab-content.active {
    display: block;
}

/* --- LƯỚI HIỂN THỊ VẬT PHẨM --- */
.ld-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
    gap: 10px;
    padding: 10px;
    overflow-y: auto;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

/* --- ITEM STYLE --- */
.ld-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(25, 25, 25, 0.75);
    border: 1px solid #444;
    padding: 10px;
    border-radius: 4px;
    transition: all 0.2s;
    cursor: pointer;
}

.ld-item:hover {
    background: rgba(45, 45, 45, 0.85);
    border-color: #666;
    transform: translateY(-2px);
}

.ld-item-icon {
    width: 45px;
    height: 45px;
    object-fit: contain;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    flex-shrink: 0;
}

.ld-item-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-grow: 1;
    overflow: hidden;
}

.ld-item-name {
    font-weight: bold;
    font-size: 0.95em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.ld-item-desc {
    font-size: 0.8em;
    color: #aaa;
    margin-top: 3px;
}

/* --- HIỂN THỊ SỐ LƯỢNG CHO VẬT PHẨM STACK --- */
.ld-item-quantity {
    position: absolute;
    bottom: 5px;
    right: 8px;
    font-size: 0.9em;
    font-weight: bold;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid #555;
}

/* --- HIỂN THỊ GIÁ TIỀN CHO DƯỢC BẢO --- */
.ld-item-price {
    margin-top: 4px;
    font-size: 0.85em;
    color: #ffde7a; /* Màu vàng của linh thạch */
    font-weight: bold;
}

.placeholder-text {
    text-align: center;
    font-size: 1.2em;
    color: #777;
    margin-top: 40px;
}


/* Thêm vào cuối file danduoc.css */

/* --- STYLE CHO POPUP CHI TIẾT ĐAN DƯỢC --- */

/* Tái sử dụng style từ modal chung */
#dan-duoc-details-modal .modal-attributes-list {
    margin: 20px auto 25px;
    text-align: left;
    width: 100%;
    max-width: 320px;
    display: inline-block;
    list-style: none;
    padding: 0;
}

#dan-duoc-details-modal .modal-attributes-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: rgba(0, 0, 0, 0.25);
    border-left: 3px solid #E48F45;
    border-radius: 0 4px 4px 0;
    font-size: 1em;
}

#dan-duoc-details-modal .modal-attributes-list li .attr-name {
    color: #ccc;
}

#dan-duoc-details-modal .modal-attributes-list li .attr-value {
    color: #63ff8c;
    font-weight: bold;
}


/* --- STYLE CHO Ô HIỂN THỊ SỐ LƯỢNG TRÊN ITEM --- */
.ld-item-quantity {
    position: absolute;
    bottom: 5px;
    right: 8px;
    font-size: 0.9em;
    font-weight: bold;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid #555;
    line-height: 1.5;
}

/* --- STYLE CHO KHUNG CHỌN SỐ LƯỢNG KHI MUA --- */
.modal-quantity-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.modal-quantity-selector label {
    font-size: 1em;
    color: #ccc;
}

.modal-quantity-selector input {
    width: 80px;
    padding: 8px;
    background: #1e1e1e;
    border: 1px solid #555;
    border-radius: 4px;
    color: #fff;
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
}



/* --- STYLE CHO DÒNG HIỂN THỊ GIỚI HẠN MUA --- */
.ld-item-limit {
    font-size: 0.8em;
    color: #ffd700; /* Màu vàng kim */
    margin-top: 4px;
    font-style: italic;
}

/* Style khi đã hết giới hạn mua */
.ld-item-limit.limit-reached {
    color: #ff6b6b; /* Màu đỏ */
    font-weight: bold;
    font-style: normal;
} 


/* --- BỐ CỤC CHO TAB THẢO DƯỢC --- */
.ld-herb-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 15px; /* Khoảng cách giữa 2 lưới */
}

.ld-section {
    display: flex;
    flex-direction: column;
    flex: 1; /* Chia đều không gian cho 2 lưới */
    min-height: 0; /* Quan trọng để flexbox hoạt động đúng với overflow */
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 10px;
}

.ld-section-title {
    margin: 0 0 10px 5px;
    color: #E48F45;
    font-size: 1.1em;
    flex-shrink: 0;
}

/* Tối ưu lại ld-grid để cuộn bên trong section */
.ld-section .ld-grid {
    height: 100%;
    padding: 0;
    overflow-y: auto;
}

/* Làm cho các item nhỏ gọn hơn */
.ld-section .ld-item {
    padding: 8px;
    gap: 10px;
}

.ld-section .ld-item-icon {
    width: 40px;
    height: 40px;
}

.ld-section .ld-item-name {
    font-size: 0.9em;
}

.ld-section .ld-item-desc {
    font-size: 0.75em;
}



/* --- BỐ CỤC CHO TAB THẢO DƯỢC & ĐAN PHƯƠNG --- */
.ld-herb-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 15px; /* Khoảng cách giữa 2 lưới */
}

.ld-section {
    display: flex;
    flex-direction: column;
    flex: 1; /* Chia đều không gian cho 2 lưới */
    min-height: 0; /* Quan trọng để flexbox hoạt động đúng với overflow */
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 10px;
}

.ld-section-title {
    margin: 0 0 10px 5px;
    color: #E48F45;
    font-size: 1.1em;
    flex-shrink: 0;
}

/* Tối ưu lại ld-grid để cuộn bên trong section */
.ld-section .ld-grid {
    height: 100%;
    padding: 0;
    overflow-y: auto;
}

/* Làm cho các item nhỏ gọn hơn */
.ld-section .ld-item {
    padding: 8px;
    gap: 10px;
}

.ld-section .ld-item-icon {
    width: 40px;
    height: 40px;
}

.ld-section .ld-item-name {
    font-size: 0.9em;
}

.ld-section .ld-item-desc {
    font-size: 0.75em;
}

/* ========================================================== */
/* ============= CSS CHO POPUP THÔNG BÁO CHUNG =============== */
/* ========================================================== */

/* Lớp phủ nền mờ toàn màn hình */
#custom-modal-overlay {
    background-color: rgba(0, 0, 0, 0.8); /* Tăng độ tối của nền mờ */
    z-index: 9999; /* Đảm bảo luôn nằm trên cùng */
    backdrop-filter: blur(3px); /* Hiệu ứng làm mờ nền phía sau (trên trình duyệt hỗ trợ) */
}

/* Khung nội dung chính của Popup */
#custom-modal {
    background: #1a1a2e; /* Nền tối màu, hợp với game */
    padding: 25px 30px;
    border-radius: 10px;
    border: 2px solid #a89a6f; /* Viền màu vàng kim loại */
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.6); /* Đổ bóng mạnh hơn tạo độ sâu */
    color: #e0e0e0; /* Màu chữ sáng, dễ đọc */
    min-width: 340px;
    max-width: 480px;
    text-align: center;
    /* Hiệu ứng khi popup xuất hiện */
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#custom-modal-overlay.hidden #custom-modal {
    transform: scale(0.8);
}

/* Tiêu đề của Popup */
#modal-title {
    font-size: 1.7em;
    font-weight: bold;
    color: #ffd700; /* Màu vàng gold cho tiêu đề */
    margin-top: 0;
    margin-bottom: 15px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

/* Nội dung thông báo chi tiết */
#modal-message {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 25px;
    color: #f0f0f0; /* Màu chữ sáng hơn một chút */
}

/* Nút OK/Đóng */
#modal-ok-btn {
    display: inline-block;
    padding: 12px 40px;
    border: none;
    border-radius: 5px;
    background-color: #995A3A; /* Sử dụng màu active của tab */
    border: 1px solid #E48F45;
    color: white;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

#modal-ok-btn:hover {
    background-color: #E48F45;
    transform: translateY(-2px); /* Hiệu ứng nhấc lên khi hover */
    box-shadow: 0 4px 10px rgba(228, 143, 69, 0.3);
}

#modal-ok-btn:active {
    transform: translateY(0);
}


.ld-item-limit {
    font-size: 0.8em;
    color: #ffd700; /* Màu vàng kim */
    margin-top: 4px;
    font-style: italic;
}

.ld-item-limit.limit-reached {
    color: #ff6b6b; /* Màu đỏ */
    font-weight: bold;
    font-style: normal;
}

/* Style cho vật phẩm bị vô hiệu hóa */
.ld-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #333;
}

.ld-item.disabled:hover {
    transform: none;
    border-color: #444;
}



/* ========================================================== */
/* ========= FIX: Z-INDEX CHO CÁC POPUP CHỒNG NHAU ========= */
/* ========================================================== */

/* Đặt z-index cho các popup chi tiết vật phẩm ở mức 9990.
  Bao gồm Đan dược, Thú cưỡi, và Trang bị để tránh lỗi tương tự ở các khu vực khác.
*/
#dan-duoc-details-modal-overlay,
#mount-details-modal-overlay,
#equipment-details-modal-overlay {
    z-index: 9990;
}

/* Đặt z-index cho popup xác nhận ở mức 9995, cao hơn popup chi tiết.
  Điều này đảm bảo nó LUÔN LUÔN hiển thị ở trên cùng.
*/
#confirmation-modal-overlay {
    z-index: 9995;
}



