/* Modal Popup Styles */
.js-modal-popup {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}
input.count-p {
    width: 60px !important;
    margin-bottom: 0;
}
.mask-popup {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.popup-select {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 1100px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    overflow: auto;
    pointer-events: auto;
    height: 85vh;
}

.popup-select .header {
    background: #f15b2e;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 10001;
}

.popup-select .header h4 {
    color: #fff;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.popup-select .header form {
    display: flex;
    flex: 1;
    margin: 0 20px;
    position: relative;
    flex: none;
}

.popup-select .header .input-search {
    width: 100%;
    padding: 8px 35px 8px 15px;
    border-radius: 4px;
    border: none;
    font-size: 14px;
    margin-bottom: 0;
}

.popup-select .header .btn-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #666;
}

.popup-select .header .close-popup {
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

.popup-main {
    display: flex;
    height: 72vh;
    overflow: hidden;
    position: relative;
    z-index: 10000;
}

.popup-main_filter {
    width: 30%;
    padding: 15px;
    background: #f5f5f5;
    overflow-y: auto;
    border-right: 1px solid #ddd;
    height: auto;
    position: relative;
    z-index: 10000;
}

.popup-main_filter h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.gr-filter {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.title-filter {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.ul-filter {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ul-filter li {
    margin-bottom: 8px;
    position: relative;
    z-index: 10001;
}

.ul-filter li label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.ul-filter.attribute-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.ul-filter li input[type="checkbox"] {
    margin-right: 8px;
    margin-bottom: 0;
    margin-top: 0;
    position: relative;
    z-index: 10002;
}

.value-filter {
    font-size: 13px;
    color: #555;
}

.popup-main_content {
    width: 70%;
    overflow-y: auto;
    padding: 15px;
    height: 100%;
    position: relative;
    z-index: 10000;
}

.clear::after {
    content: "";
    display: table;
    clear: both;
}

.sort-paging {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sort-block {
    display: flex;
    align-items: center;
}

.sort-block span {
    margin-right: 10px;
    font-size: 14px;
    white-space: nowrap;
}

.sort-block select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 0;
}

.paging-block {
    display: flex;
    align-items: center;
}

.paging-block a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin: 0 2px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
}

.paging-block a.active {
    background: #f15b2e;
    color: #fff;
    border-color: #f15b2e;
}

.list-product-select {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.p-item {
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    padding: 15px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: calc( 50% - 10px);
}

/* .p-item:hover {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
} */
.info table {
    margin-bottom: 0;
}
.p-img {
    display: block;
    width: 80px;
    margin-right: 15px;
    flex: none;
}

.p-img img {
    max-width: 100%;
    height: auto;
    display: block;
}

.p-item .info {
    flex: 1;
    overflow: hidden;
}

.p-name {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
    text-decoration: none;
}

.p-item table {
    width: 100%;
    margin-bottom: 10px;
    font-size: 13px;
}

.p-item table td {
    padding: 3px 0;
}

.p-price {
    color: #c00;
    font-weight: 600;
    font-size: 16px;
    display: block;
}

.product-martket-main {
    display: flex;
    align-items: center;
    margin-top: 5px;
}

.product-market-price {
    color: #575757;
    text-decoration: line-through;
    font-size: 13px;
    margin: 0;
}

.product-percent-price {
    background: #BE1F2D;
    color: #fff;
    font-size: 12px;
    padding: 1px 8px;
    border-radius: 3px;
    margin-left: 6px;
}

.btn-buy {
    display: block;
    background: #f15b2e;
    color: #fff;
    padding: 8px 15px;
    border-radius: 4px;
    text-align: center;
    margin-top: 15px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    white-space: nowrap;
    margin-left: 10px;

}

.btn-buy:hover {
    background: #ed4f1f;
}
.p-item1 {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}
.info {
    flex: 1;
}
/* Responsive */
@media (max-width: 768px) {
    .header-flex {
        display: flex;
        align-items: center;
        width: 84%;
        flex: none;
        justify-content: flex-end;
        gap: 10px;
        justify-content: flex-start;
    }
    .p-item {
        width: 100%;
    }

    .popup-main {
        flex-direction: column;
        height: 80vh;
    }
    
    .popup-main_filter,
    .popup-main_content {
        width: 100%;
        height: auto;
    }
    
    .popup-main_filter {
        max-height: 200px;
    }
    
    .popup-select .header {
        flex-direction: column;
        padding: 10px;
    }
    
    .popup-select .header form {
        margin: 10px 0;
        width: auto;
    }
	.header-flex {
		width: 100% !important;
	}
	.page-buildpc .btn-action li {
		width: calc(100% / 2);
	}
	.page-buildpc .btn-action span {
		font-size : 11px;
	}
	.p-item1 {
		flex-direction: column;
	}
	.btn-buy {
		align-self: flex-end;
	}
    .list-product-select {
        grid-template-columns: 1fr;
    }
    
    .sort-paging {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .sort-block,
    .paging-block {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Fix cho iOS và mobile */
.ios-modal {
    overflow: hidden !important;
}

.ios-popup {
    transform: translate(-50%, -50%) !important;
    position: fixed !important;
    z-index: 100001 !important;
}

/* Ngăn chặn scroll trên body khi modal mở */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Đảm bảo các phần tử trong modal được nhấp chính xác */
.popup-select * {
    pointer-events: auto;
}

/* Đảm bảo background overlay không nhận sự kiện */
.js-modal-popup > :not(.popup-select) {
    pointer-events: none;
}

/* Tăng vùng click cho label */
.ul-filter li label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px 2px;
    margin: 0;
    position: relative;
    z-index: 10004;
}

/* Fix cho mobile */
@media (max-width: 768px) {
    .popup-select {
        width: 95%;
        height: 95%;
        max-height: 95vh;
        overflow: hidden;
    }
    
    .popup-main {
        max-height: calc(95vh - 60px);
        flex-direction: column;
    }
    
    .popup-main_filter {
        width: 100%;
        max-height: 30vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .popup-main_content {
        width: 100%;
        max-height: 65vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Styles for selected products */
.drive-checked__item {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 4px;
    padding: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.img-checked {
    width: 60px;
    height: 60px;
    overflow: hidden;
    margin-right: 10px;
    flex-shrink: 0;
}

.img-checked img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.info-checked {
    flex: 1;
    overflow: hidden;
}

.title-checked {
    font-size: 13px;
    line-height: 1.3;
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.price-checked {
    color: #d00;
    font-weight: 600;
    margin: 0;
    font-size: 14px;
}

.remove-checked {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f1f1f1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 10px;
    flex-shrink: 0;
}

.remove-checked:hover {
    background: #e0e0e0;
}

.remove-checked i {
    font-size: 12px;
    color: #666;
}

/* Tổng tiền */
.total-price-config {
    font-weight: 700;
    color: #d00;
    font-size: 20px;
}

/* Styles for new selected product template */
.contain-item-drive {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 4px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.d-img {
    width: 60px;
    height: 60px;
    display: block;
    margin-right: 15px;
}

.d-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.d-name {
    flex: 1;
    min-width: 250px;
    font-size: 13px;
    line-height: 1.5;
    margin-right: 15px;
}

.d-name a {
    font-weight: 600;
    color: #333;
    text-decoration: none;
}

.d-price {
    font-weight: 600;
    color: #d00;
    margin: 0 5px;
    min-width: 100px;
    text-align: right;
}
.price-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}
.contain-item-drive i {
    display: inline-block;
    margin: 0 5px;
    color: #666;
}

.count-p {
    width: 60px;
    padding: 5px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.sum_price {
    font-weight: 700;
    color: #d00;
    margin: 0 5px;
    min-width: 100px;
    text-align: right;
}

.btn-action_seclect {
    margin-left: 10px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 4px;
    cursor: pointer;
}

.btn-action_seclect:hover {
    background: #e0e0e0;
}

.edit-item, .remove-item {
    color: #666;
}

.remove-item:hover {
    color: #d00;
}

@media (max-width: 768px) {
    input.count-p {
        margin-top: 0;
    }
    .price-info {
        font-size: 14px;
    }
    .contain-item-drive {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .d-img {
        margin-bottom: 10px;
    }
    
    .d-name {
        margin-bottom: 10px;
        width: 100%;
    }
    
    .d-price, .sum_price {
        text-align: left;
        min-width: auto;
    }
    
    .count-p {
        margin: 10px 0;
    }
    
    .btn-action_seclect {
        margin-top: 10px;
        flex: 1;
    }
    .js-config-summary {
        display: block;
    }

    .total p {
        width: fit-content;
        font-size: 10px !important;
    }
    .box-select__config {
        align-items: center;
    }
	.contact-info {
    display: none;
}
    .total-bottom {
        margin-left: 0 !important;
        text-align: right;
        width: 100% !important;
        justify-content: flex-end;
    }
    .btn-action li {
        width: calc(100% / 2);
    }
    .btn-action span {
        font-size: 11px;
    }
    .item-drive {
        flex-direction: column;
    }
}
.header-flex {
    display: flex;
    align-items: center;
    width: 35%;
    flex: none;
    justify-content: flex-end;
}