﻿.pcb {
    max-width: 1200px;
    margin: 0 auto;
}

/* Tiêu đề */
.pcb-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.pcb-title {
    margin: 0;
    font-size: 22px;
    color: #111;
    border-left: 4px solid #e30019;
    padding-left: 10px;
}

.pcb-sub {
    margin: 4px 0 0 14px;
    color: #666;
    font-size: 13px;
}

.pcb-head-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pcb-count {
    font-size: 13px;
    color: #444;
}

    .pcb-count b {
        color: #e30019;
    }

/* Nút */
.pcb-btn {
    background: #e30019;
    color: #fff;
    border: 1px solid #e30019;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
}

    .pcb-btn:hover {
        background: #b80014;
        border-color: #b80014;
    }

.pcb-btn-ghost {
    background: #fff;
    color: #333;
    border-color: #ccc;
}

    .pcb-btn-ghost:hover {
        background: #f3f4f6;
        border-color: #999;
    }

.pcb-btn-dark {
    background: #111;
    border-color: #111;
    padding: 12px 24px;
    font-size: 14px;
}

    .pcb-btn-dark:hover {
        background: #e30019;
        border-color: #e30019;
    }

.pcb-btn-sm {
    padding: 6px 14px;
}

.pcb-btn:focus-visible, .pcb-close:focus-visible, .pcb-pick:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}

/* Bảng */
.pcb-box {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.pcb-table {
    width: 100%;
    border-collapse: collapse;
}

    .pcb-table th {
        background: #111;
        color: #fff;
        text-align: left;
        padding: 12px 14px;
        font-size: 13px;
    }

    .pcb-table td {
        padding: 12px 14px;
        border-top: 1px solid #eee;
        vertical-align: middle;
    }

    .pcb-table tr.has-item td {
        background: #fffafa;
    }

.pcb-type {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    color: #111;
}

    .pcb-type i {
        width: 32px;
        height: 32px;
        display: grid;
        place-items: center;
        background: #fee2e2;
        color: #e30019;
        border-radius: 8px;
        font-size: 14px;
    }

.pcb-empty {
    color: #999;
    font-style: italic;
}

.pcb-name {
    font-weight: bold;
    color: #111;
    line-height: 1.4;
}

.pcb-spec {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.pcb-price {
    font-weight: bold;
    color: #c00;
    white-space: nowrap;
}

.pcb-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.pcb-remove {
    background: #fff;
    border: 1px solid #ccc;
    color: #666;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
}

    .pcb-remove:hover {
        border-color: #e30019;
        color: #e30019;
    }

/* Tổng tiền */
.pcb-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 14px;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    flex-wrap: wrap;
    position: sticky;
    bottom: 8px;
    box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}

.pcb-total-label {
    color: #444;
    margin-right: 10px;
}

.pcb-total-price {
    font-size: 26px;
    font-weight: bold;
    color: #e30019;
}

/* Modal */
.pcb-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0,0,0,.55);
}

    .pcb-modal.open {
        display: flex;
    }

.pcb-dialog {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pcb-dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #e30019;
    color: #fff;
}

    .pcb-dialog-head h3 {
        margin: 0;
        font-size: 16px;
    }

.pcb-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.pcb-dialog-search {
    padding: 12px 18px 0;
}

    .pcb-dialog-search input {
        width: 100%;
        box-sizing: border-box;
        padding: 10px 12px;
        border: 1px solid #ccc;
        border-radius: 6px;
        outline: none;
        font-size: 14px;
    }

        .pcb-dialog-search input:focus {
            border-color: #e30019;
        }

.pcb-dialog-body {
    padding: 12px 18px 18px;
    overflow-y: auto;
}

.pcb-dialog-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid #eee;
}

/* Dòng linh kiện trong modal */
.pcb-item {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-top: 10px;
}

    .pcb-item:hover {
        border-color: #e30019;
    }

    .pcb-item.picked {
        border-color: #e30019;
        background: #fffafa;
    }

.pcb-item-info {
    min-width: 0;
}

.pcb-item-end {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pcb-none {
    text-align: center;
    color: #888;
    padding: 24px 0;
}

/* Bảng tóm tắt khi xuất */
.pcb-sum {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .pcb-sum th, .pcb-sum td {
        padding: 8px 6px;
        border-bottom: 1px solid #eee;
        text-align: left;
    }

        .pcb-sum td:last-child, .pcb-sum th:last-child {
            text-align: right;
            white-space: nowrap;
        }

.pcb-sum-total {
    font-size: 18px;
    font-weight: bold;
    color: #e30019;
    text-align: right;
    margin-top: 12px;
}

/* Responsive */
@media (max-width: 700px) {
    .pcb-table thead {
        display: none;
    }

    .pcb-table, .pcb-table tbody, .pcb-table tr, .pcb-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

        .pcb-table tr {
            border-top: 1px solid #eee;
            padding: 8px 0;
        }

        .pcb-table td {
            border: none;
            padding: 4px 14px;
        }

    .pcb-actions {
        justify-content: flex-start;
    }

    .pcb-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .pcb-item-end {
        width: 100%;
        justify-content: space-between;
    }
}

/* In cấu hình: chỉ in phần tóm tắt */
@media print {
    body * {
        visibility: hidden;
    }

    #pcb-summary, #pcb-summary * {
        visibility: visible;
    }

    #pcb-summary {
        position: absolute;
        inset: 0;
        background: #fff;
        display: block;
        padding: 0;
    }

    .pcb-close, .pcb-dialog-foot {
        display: none;
    }
}
