/**
 * VTS Báo Giá - Print Styles
 * Styles for print/export functionality
 */

/* Print Container - Semantic HTML */
.print-container,
main.print-container {
    max-width: 1200px;
    margin: 20px auto;
    font-size: 14px;
    background: #fff;
    width: 100%;
    overflow: auto;
    font-family: Arial, sans-serif;
    position: relative;
}

#imgfile,
article#imgfile,
section#imgfile {
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    padding: 30px 40px !important;
    border-radius: 8px;
        padding-top: 0 !important;
}

/* Table Styles */
.print-container table {
    border-collapse: collapse !important;
    width: 100%;
    overflow: auto;
    min-width: 940px;
}

.print-container table thead tr:first-child td:last-child {
    text-align: right;
}

.print-container table thead tr:first-child b {
    color: #121212;
    font-size: 22px;
}

.print-container table thead th {
    padding: 0.5rem 0.75rem;
    vertical-align: bottom;
    border: 1px solid #424242;
    background: #da9625;
    color: #121212;
}

.print-container table thead h1 {
    margin: 1.5rem 0;
    font-size: 2rem;
    text-transform: uppercase;
    text-align: center;
    color: #121212;
}

.print-container table thead th:first-child {
    text-align: center;
    width: 50px;
}

table thead th:not(:first-child) {
    text-align: left;
}

.print-container table thead th:nth-child(4) {
    text-align: center;
}

.print-container table thead th:nth-child(5) {
    text-align: right;
}

.print-container table thead th:last-child {
    text-align: right;
    width: 160px;
}

.print-container table thead th:nth-child(2) {
    width: 160px;
}

.print-container table thead th:nth-child(4) {
    width: 50px;
}

.print-container table thead th:nth-child(5) {
    width: 93px;
}

.print-container td:first-child {
    text-align: center;
    max-width: 50px;
}

/* Removed old rules - using new nth-child rules with !important below */

.print-container table tbody tr:last-child td {
    border: none;
}

.print-container table tbody td {
    padding: 8px;
    vertical-align: middle;
    border: solid 1px #424242 !important;
    word-break: break-word;
}

/* Căn chỉnh các cột trong tbody */
#sheetjs tbody tr td:nth-child(1),
.print-container table tbody tr td:nth-child(1) {
    text-align: center !important; /* STT */
}

#sheetjs tbody tr td:nth-child(2),
.print-container table tbody tr td:nth-child(2) {
    text-align: center !important; /* SKU */
}

#sheetjs tbody tr td:nth-child(3),
.print-container table tbody tr td:nth-child(3) {
    text-align: left !important; /* Sản phẩm */
}

#sheetjs tbody tr td:nth-child(4),
.print-container table tbody tr td:nth-child(4) {
    text-align: center !important; /* VAT */
}

#sheetjs tbody tr td:nth-child(5),
.print-container table tbody tr td:nth-child(5) {
    text-align: center !important; /* Số lượng */
}

#sheetjs tbody tr td:nth-child(6),
.print-container table tbody tr td:nth-child(6) {
    text-align: right !important; /* Giá */
}

.print-container table tfoot {
    border-bottom: 4px solid #a60000;
}

.print-container table tfoot td {
    padding: 6px 8px;
    vertical-align: middle;
}

/* Total row */
.vts-total-row {
    background-color: #f5f5f5;
    font-weight: bold;
}

.vts-total-row td {
    border: 1px solid #424242 !important;
    padding: 6px 8px !important;
}

/* Note cells */
.vts-note-cell,
.vts-footer-note-cell {
    text-align: left !important;
    padding: 6px 8px !important;
    line-height: 1.4;
    font-size: 14px
}

/* SheetJS Table Styles */
#sheetjs {
    width: 100%;
    border-collapse: collapse;
    border: none;
}

#sheetjs th,
#sheetjs td {
    border: none;
    padding: 4px 8px;
    color: #222;
    vertical-align: middle;
    font-size: 16px;
}

#sheetjs thead tr {
    max-height: 26px;
}

#sheetjs thead td {
    text-align: left;
    padding: 2px 0;
    line-height: 1.2;
    vertical-align: middle;
    max-height: 26px;
}

#sheetjs thead td a {
    text-decoration: none;
    color: inherit;
}

#sheetjs thead tr:last-child th {
    text-transform: unset;
    font-size: 15px;
    padding: 8px;
    vertical-align: middle;
    border: 1px solid #424242;
    background: #a60000;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}

/* Căn chỉnh header columns */
#sheetjs thead tr:last-child th:nth-child(1) {
    text-align: center !important; /* STT */
}

#sheetjs thead tr:last-child th:nth-child(2) {
    text-align: center !important; /* SKU */
}

#sheetjs thead tr:last-child th:nth-child(3) {
    text-align: left !important; /* Sản phẩm */
}

#sheetjs thead tr:last-child th:nth-child(4) {
    text-align: center !important; /* VAT */
}

#sheetjs thead tr:last-child th:nth-child(5) {
    text-align: center !important; /* Số lượng */
}

#sheetjs thead tr:last-child th:nth-child(6) {
    text-align: right !important; /* Giá */
}

/* Spacer rows */
.vts-spacer-row {
    height: 3px;
    padding: 0 !important;
}

/* Title cell */
.vts-title-cell {
    padding: 8px 0 !important;
}

#sheetjs h1 {
    text-align: center;
    font-size: 20px;
    margin: 5px 0;
}

#sheetjs b {
    font-weight: 700 !important;
}

#sheetjs table,
#sheetjs th,
#sheetjs td {
    border: none !important;
}

#sheetjs td[rowspan="3"] {
    text-align: right !important;
}

/* Logo and QR Code combined cell */
.vts-logo-qr-cell {
    text-align: center !important;
    vertical-align: middle !important;
    padding: 4px 8px !important;
}

.vts-images-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 5px;
    height: 100%;
}

.vts-logo-wrapper,
.vts-qrcode-wrapper {
    text-align: center;
}

.vts-logo-img {
    max-width: 180px;
    max-height: 70px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: inline-block;
}

.vts-qrcode-img {
    max-width: 110px;
    max-height: 110px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: inline-block;
}

/* Print Action Buttons - Semantic HTML */
.print-action, nav.print-action {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin: 1rem 0;
    margin-bottom: 30px;
    gap: 10px;
}

.print-action .btn-premium,
.print-container .btn-premium {
    padding: 16px 20px;
    border-radius: 5px;
    color: #fff;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    background: #a60000;
    border: none;
    cursor: pointer;
    font-weight: bold;
}

.print-container .btn-premium {
    background-color: #4caf50;
    color: white;
    padding: 15px 20px;
    border-radius: 4px;
    display: inline-block;
}

#btn-send-zalo,
#btn-save-to-img {
    background-color: #2196f3;
    padding: 15px 20px;
    border-radius: 5px;
    color: #000;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 0.03em;
    line-height: 2.4em;
    margin-right: 1em;
    max-width: 100%;
    min-height: 2.5em;
    margin-top: 0px;
}

#btn-send-zalo {
    text-align: center;
    background: #000000;
    color: white;
    padding: 15px 20px;
    border-radius: 4px;
    text-decoration: none;
}

#btn-send-zalo small {
    font-size: 80%;
    color: #fff;
}

#btn-send-zalo b {
    color: #fff;
}

/* Image Export Mode */
#temp-container {
    width: 1000px !important;
    background-color: white !important;
    padding: 55px !important;
    padding-top: 25px!important;    
    padding-bottom: 20px!important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
    display: block !important;
}
#temp-container .vts-note-cell {
    font-size: 14px
}

#temp-container .vts-note-cell{
    padding-left: 0
}

#temp-container #sheetjs {
    width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    margin: 0 auto !important;
}

#temp-container #sheetjs td {
    word-wrap: break-word !important;
    max-width: 100% !important;
}

#temp-container .vts-logo-img {
    max-width: 180px !important;
    max-height: 70px !important;
    width: auto !important;
    height: auto !important;
}

#temp-container .vts-qrcode-img {
    max-width: 110px !important;
    max-height: 110px !important;
    width: auto !important;
    height: auto !important;
}

.image-export-mode .print-container {
    max-width: 100% !important;
    overflow: visible !important;
}

.image-export-mode #imgfile {
    width: 1040px !important;
    padding: 30px 30px !important;
    margin: 0 auto !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

#temp-container #imgfile {
    padding: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

#temp-container #sheetjs {
    margin: 0 !important;
}

#temp-container .vts-print-content {
    padding: 30px !important;
    margin: 0 auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.image-export-mode #sheetjs {
    width: 100% !important;
    table-layout: fixed !important;
}

#grand-total{
        text-align: right;
}
.vts-total-label{
    text-align: left;
}


/* Print Media Query */
@media print {
    .none-print {
        display: none !important;
    }

    body {
        background-color: #ffffff;
    }

    .print-container {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }

    #imgfile {
        padding: 0 !important;
        border: none;
        box-shadow: none;
    }
    .vts-note-cell,
    .vts-footer-note-cell {
        font-size: 14px
    }


}



/* Responsive Styles */

/* Mobile - Extra Small (< 576px) */
@media (max-width: 575px) {
    .print-container {
        max-width: 100%;
        margin: 10px auto;
        padding: 0 5px;
        font-size: 12px;
    }

    #imgfile {
        padding: 10px !important;
        overflow-x: auto;
        border-radius: 4px;
    }

    .print-container table {
        min-width: 600px;
        font-size: 11px;
    }

    .print-container table thead h1 {
        font-size: 1.3rem;
        margin: 1rem 0;
    }

    .print-container table thead tr:first-child b {
        font-size: 16px;
    }

    .print-container table thead th,
    .print-container table tbody td {
        padding: 0.3rem 0.4rem;
        font-size: 11px;
    }

    .print-action {
        flex-direction: column;
        gap: 10px;
        margin: 0.5rem 0;
    }

    .print-action .btn-premium,
    #btn-send-zalo,
    #btn-save-to-img {
        width: 100%;
        margin: 0 !important;
        padding: 12px 15px;
        font-size: 13px;
    }

    #sheetjs {
        width: 100% !important;
        table-layout: auto !important;
    }

    #sheetjs th,
    #sheetjs td {
        padding: 6px;
        font-size: 13px;
    }

    #sheetjs h1 {
        font-size: 18px;
        margin: 10px 0;
    }

    #sheetjs thead tr:last-child th {
        font-size: 12px;
        padding: 0.3rem 0.4rem;
    }

    .pc_logo {
        max-width: 80px !important;
        max-height: 40px !important;
    }

    img[alt="QR Code"] {
        max-width: 70px !important;
        max-height: 70px !important;
    }
}

/* Tablet - Small to Medium (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .print-container {
        max-width: 100%;
        margin: 15px auto;
        padding: 0 10px;
        font-size: 13px;
    }

    #imgfile {
        padding: 15px !important;
        overflow-x: auto;
    }

    .print-container table {
        min-width: 700px;
        font-size: 12px;
    }

    .print-container table thead h1 {
        font-size: 1.6rem;
    }

    .print-container table thead tr:first-child b {
        font-size: 18px;
    }

    .print-action {
        flex-wrap: wrap;
        gap: 10px;
    }

    .print-action .btn-premium,
    #btn-send-zalo,
    #btn-save-to-img {
        flex: 1 1 auto;
        min-width: 150px;
        margin: 0 5px !important;
    }

    #sheetjs th,
    #sheetjs td {
        padding: 7px;
        font-size: 14px;
    }

    #sheetjs h1 {
        font-size: 20px;
    }

    .pc_logo {
        max-width: 100px !important;
        max-height: 50px !important;
    }

    img[alt="QR Code"] {
        max-width: 80px !important;
        max-height: 80px !important;
    }
}

/* Tablet - Medium (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .print-container {
        max-width: 100%;
        margin: 20px auto;
        padding: 0 15px;
    }

    #imgfile {
        padding: 20px !important;
        overflow-x: auto;
    }

    .print-container table {
        min-width: 800px;
    }

    .print-action {
        gap: 15px;
    }

    #sheetjs {
        width: 100% !important;
        table-layout: fixed !important;
    }

    #sheetjs td {
        word-wrap: break-word !important;
    }

    .pc_logo {
        max-width: 110px !important;
        max-height: 55px !important;
    }

    img[alt="QR Code"] {
        max-width: 90px !important;
        max-height: 90px !important;
    }
}

/* Desktop - Large (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .print-container {
        max-width: 960px;
    }

    .print-container table {
        min-width: 900px;
    }
}

/* Desktop - Extra Large (> 1200px) */
@media (min-width: 1200px) {
    .print-container {
        max-width: 1200px;
    }

    .print-action .btn-premium:hover,
    #btn-send-zalo:hover,
    #btn-save-to-img:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        transition: all 0.3s ease;
    }
}
