/* Print page setup */
@page {
    size: 8.5in 11in;
    margin: 0;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: white;
}

/* Page container */
.page {
    width: 8.5in;
    height: 11in;
    page-break-after: always;
    position: relative;
    background: white;
}

.page:last-child {
    page-break-after: auto;
}

/* Postcard dimensions and positioning */
.postcard {
    width: 5in;
    height: 3in;
    position: absolute;
    border: 1px dashed #ccc;
    overflow: hidden;
}

.postcard img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Page 1 - Front images (normal orientation) */
.page-1 .postcard-1 {
    top: 1.5in;
    left: 1.75in;
}

.page-1 .postcard-2 {
    top: 6.5in;
    left: 1.75in;
}

/* Page 2 - Back images (flipped for duplex alignment) */
.page-2 .postcard-1 {
    top: 1.5in;
    left: 1.75in;
    transform: scaleX(-1);
}

.page-2 .postcard-2 {
    top: 6.5in;
    left: 1.75in;
    transform: scaleX(-1);
}

/* Fix for mirrored content inside flipped postcards */
.page-2 .postcard .back-content {
    transform: scaleX(-1);
    display: inline-block;
    width: 100%;
    height: 100%;
}

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

/* Instructions box */
.instructions {
    position: fixed;
    top: 10px;
    left: 10px;
    background: white;
    padding: 15px;
    border: 2px solid #333;
    max-width: 400px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.instructions h3 {
    margin-bottom: 10px;
    color: #333;
}

.instructions ol {
    margin-left: 20px;
    line-height: 1.6;
    color: #333;
}

.instructions button {
    margin-top: 10px;
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.instructions button:hover {
    background: #0056b3;
}

.close-btn {
    float: right;
    background: #dc3545 !important;
    padding: 4px 8px !important;
    margin-top: 0 !important;
}

.close-btn:hover {
    background: #c82333 !important;
}

/* Print-specific styles */
@media print {
    .instructions {
        display: none;
    }
    
    .postcard {
        border: none;
    }
    
    body {
        margin: 0;
        padding: 0;
    }
}