/* General Styles */
@import url('https://fonts.googleapis.com/css2?family=Mrs+Saint+Delafield&display=swap');
@import 'variables.css';

.main-content {
    flex: 20;
    padding: 20px;
    overflow-y: auto;
    background: linear-gradient(90deg, black, #2A003D);
    background-image: linear-gradient(90deg, black, #2A003D),
                        repeating-linear-gradient(
                        to bottom,
                        transparent,
                        transparent 8px,
                        rgba(255,255,255,0.03) 8px,
                        rgba(255,255,255,0.03) 10px
                        );
    background-blend-mode: overlay;
    background-size: cover;
}

.container {
    background-color: transparent;    
    display: flex;
    gap: 20px;
    width: 100%;    
    justify-content: center;
    padding: 20px;
    margin-bottom: 20px;
    margin-top: 80px;      
    align-items: stretch; 
}

/* Form Styles*/
.form-container,
.print-container {
    flex: 1;
    background-color: var(--background-glass);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid var(--primary-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    max-height: 160em;
    overflow-y: auto;
}

.form-container:hover,
.print-container:hover {
    box-shadow: 0 0 30px var(--primary-color);
    border: 2px solid var(--primary-color);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.form-grid {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.left-column, .right-column {
    flex: 1;
}

.form-group {
    margin-bottom: 5px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 1.4rem;
}

input[type="text"] {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
}

.form-group textarea {
    width: 100%;
    padding: 8px;
    height: 150px;
    color: var(--text-color);
    border: 1px solid var(--primary-color);  
    border-radius: 4px;
    box-sizing: border-box;            
    background-color: var(--container-color);
}

textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    background-color: var(--container-color);
    color: var(--text-color);
    resize: vertical;
}


#remarks, 
textarea[name="remarks"], 
.remarks-textarea, 
.form-group textarea { 
    width: 100%;
    padding: 8px;
    height: 150px;
    color: var(--text-color);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    box-sizing: border-box;            
    background-color: var(--container-color);
}

.split-row {
    display: flex;
    gap: 5px;
}

.half-width {
    flex: 1;
}

.full-width {
    width: 100%;
}

.declaration-text {
    background-color: var(--container-color);
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    font-size: 1.5rem;
}

.left-side, .right-side {
    flex: 1;
}

/* Table Styles */
.shipping-table {
    margin: 10px 0;    
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    border: 1px solid var(--primary-color);
    padding: 0px; /* Adjust vertical padding to 0 */
}

th {
    background-color: var(--container-color);
    text-align: center;
    font-size: 1.25rem;
    height: 24px; /* Set a fixed height for the header */
}

/* Container Info Styles */
.container-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.container-info .form-group {
    flex: 1 0 calc(20% - 10px);
    min-width: 150px;
}

/* Certification Section */
.certification-section {
    display: grid;
    grid-template-columns: 1fr 2fr; 
    gap: 15px;
    margin-bottom: 15px;
}

.packing-cert, .receiving-receipt {
    border: 1px solid var(--primary-color);
    padding: 10px;
    background-color: var(--background-glass);
}

.packing-cert h4, .receiving-receipt h4 {
    color: var(--text-color);
    margin-bottom: 10px;
}

.packing-cert p, .receiving-receipt p {
    font-size: 1.25em;
    margin-bottom: 10px;
}

/* Responsive adjustment */
@media (max-width: 768px) {
    .certification-section {
        grid-template-columns: 1fr;
    }
}

h4 {
    margin-bottom: 10px;            
}

/* Signature Section */
.signature-section {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.signature-block {
    flex: 1;
    border: 1px solid var(--primary-color);
    padding: 10px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Print Preview Styles */


.print-container h1 {
    margin-bottom: 20px;
    text-align: center;
}

#previewArea {
    width: 8.5in;
    height: 11in;
    margin: 0 auto;
    padding: 0.3in; /* Reduced from 0.5in */
    border: 1px solid #ccc;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    background-color: white;
    color: black;
    font-size: 9pt; /* Slightly reduced font size */
    position: relative;
    overflow: hidden;
}

/* Add the dashed lines using pseudo-elements */
#previewArea::before,
#previewArea::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 10px; /* Thickness of the dashed line */
    background-image: repeating-linear-gradient(
        45deg,
        blue 0,
        blue 10px,
        white 10px,
        white 20px
    );
}

#previewArea::before {
    left: 10px; /* Distance from the left edge */
}

#previewArea::after {
    right: 10px; /* Distance from the right edge */
}



/* Customize scrollbar for form container */
.form-container::-webkit-scrollbar {
    width: 2px;
}

.form-container::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 5px;
}

.form-container::-webkit-scrollbar-thumb {
    background: indigo;
    border-radius: 5px;
}

.form-container::-webkit-scrollbar-thumb:hover {
    background: #111;
}

/* Customize scrollbar for print container */
.print-container::-webkit-scrollbar {
    width: 10px;
}

.print-container::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 5px;
}

.print-container::-webkit-scrollbar-thumb {
    background: indigo;
    border-radius: 5px;
}

.print-container::-webkit-scrollbar-thumb:hover {
    background: #111;
}

.shipping-table table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* This ensures the column widths are respected */
}

.shipping-table th:nth-child(1) { /* Shipping Marks */
    width: 20%;
}

.shipping-table th:nth-child(2) { /* Number and kind of Packages, Description of Goods */
    width: 50%; /* Increased width */
}

.shipping-table th:nth-child(3) { /* GW (lbs./kg) */
    width: 15%; /* Reduced width */
}

.shipping-table th:nth-child(4) { /* CUBE (m³) */
    width: 15%; /* Reduced width */
}

/* Apply the same widths to the preview table */
#previewArea table th:nth-child(1),
#previewArea table td:nth-child(1) {
    width: 20%;
}

#previewArea table th:nth-child(2),
#previewArea table td:nth-child(2) {
    width: 50%;
}

#previewArea table th:nth-child(3),
#previewArea table td:nth-child(3) {
    width: 15%;
}

#previewArea table th:nth-child(4),
#previewArea table td:nth-child(4) {
    width: 15%;
}

/* Ensure input fields respect the column widths */
.shipping-table input[type="text"] {
    width: 100%;
    /* box-sizing: border-box; */
}

/* Ensure the lines print correctly */
@media print {
    #previewArea::before,
    #previewArea::after {
        visibility: visible !important;
    }
}

/* Responsive Layout */
@media (max-width: 1200px) {
    .container {
        flex-direction: column;
    }
    
    .form-container, .print-container {
        max-height: none;
    }
    
    #previewArea {
        width: 100%;
        height: auto;
        min-height: 11in;
        aspect-ratio: 8.5/11;
    }
}

/* Print Styles */
@media print {
    @page {
        margin: 0;
        size: letter;
    }

    /* Reset all visibility */
    body * {
        visibility: hidden;
    }

    /* Show preview area and its contents */
    #previewArea {
        visibility: visible !important;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        width: 8.5in !important;
        height: 11in !important;
        margin: 0 !important;
        padding: 0.5in !important;
        background-color: white !important;
    }

    #previewArea * {
        visibility: visible !important;
    }

    /* Ensure dashed lines are visible and correctly positioned */
    #previewArea::before,
    #previewArea::after {
        content: '' !important;
        display: block !important;
        visibility: visible !important;
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 10px !important;
        height: 11in !important;
        background-image: repeating-linear-gradient(
            45deg,
            blue 0,
            blue 10px,
            white 10px,
            white 20px
        ) !important;
        background-repeat: repeat !important;
        z-index: 9999 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    #previewArea::before {
        left: 10px !important;
    }

    #previewArea::after {
        right: 10px !important;
    }

    /* Hide non-essential elements */
    .header,
    .footer,
    .form-container,
    .btn,
    .print-container > h1 {
        display: none !important;
    }

    /* Force background colors and images to print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

.shipping-table td input {
    width: 100%;
    box-sizing: border-box;
    padding: 0px 4px; /* Adjust vertical padding to 0 */
    margin: 0; /* Ensure no margins */
    height: 30px; /* Match the cell height */
    line-height: 30px; /* Match the height */
    border: none;
    background: var(--container-color);
    color: var(--text-color);
    font-size: 1.5em;
    display: block; /* Prevent any unwanted spacing */
    
}

.shipping-table td {
    padding: 0px 0px; /* Adjust cell padding */
    height: 30px; /* Fixed height for cells */
    vertical-align: middle; /* Center content vertically */
}
