/* Clean Print Page CSS - Essential Only */

/* Basic Layout */
.print-container {
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    width: 100%;
}

/* Header */
.print-header {
    text-align: center;
    margin-bottom: 30px;
}

.print-title {
    font-size: 2rem;
    font-weight: bold;
    color: #1976d2;
    margin-bottom: 10px;
}

.print-subtitle {
    font-size: 1rem;
    color: #666;
}

/* Green Containers */
.canvas-section, .qr-section, .cards-section,
.print-instructions, .backup-template-section,
.print-ready-section, .status-section,
.warning-highlight {
    background: rgba(248, 249, 250, 0.8);
    border: 2px solid #4CAF50;
    border-radius: 15px;
    padding: 20px;
    margin: 8px 0;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1976d2;
    text-align: center;
    margin-bottom: 15px;
}

/* Canvas */
.canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 10px;
}

#canvasWindow {
    width: 280px;
    height: 280px;
    border: 1px solid black;
    background: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Cards */
#cardCanvases {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
}

.card-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.card-label {
    text-align: center;
    font-weight: 600;
    color: #1976d2;
    margin-bottom: 8px;
}

.card-canvas {
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
}

#horizontalCardCanvas {
    width: 254px;
    height: 160px;
}

#verticalCardCanvas {
    width: 160px;
    height: 280px;
}

/* Buttons */
#printBackup, .download-button {
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    margin: 10px auto;
    min-width: 200px;
    display: block;
    text-align: center;
}

#printBackup {
    background: linear-gradient(135deg, #9c1d00 0%, #C70039 100%);
    color: white;
}

.download-button {
    background: linear-gradient(135deg, #2196F3 0%, #1976d2 100%);
    color: white;
}

.action-buttons-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Card Buttons */
.card-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.card-button {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    min-width: 60px;
}

.card-button-png {
    background: #4CAF50;
    color: white;
}

.card-button-pdf {
    background: #dc3545;
    color: white;
}

/* Status Sections */
.status-section, .info-badge, .success-badge {
    background: rgba(248, 249, 250, 0.9);
    padding: 10px;
    border-radius: 10px;
    margin: 10px 0;
}

.info-badge {
    background: rgba(25, 118, 210, 0.1);
    color: #1976d2;
    display: inline-flex;
    align-items: center;
    border-radius: 20px;
    font-size: 14px;
}

.success-badge {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    text-align: center;
}

/* Modal */
.download-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
}

.download-modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Print Styles */
@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }
    
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        transform: scale(0.95);
        transform-origin: top left;
        width: 105.3%;
        height: 105.3%;
        aspect-ratio: 210/297;
    }
    
    .print-container {
        width: 88%;
        min-width: 675px;
        min-height: 98vh;
        height: 98vh;
        margin: 0 auto;
        padding: 9px;
        box-shadow: none;
        border-radius: 0;
        background: white;
        overflow: hidden !important;
        page-break-inside: avoid !important;
        page-break-after: avoid !important;
    }
    
    /* Force single page and eliminate second page */
    @page {
        size: A4 portrait;
        margin: 0 !important;
    }
    
    * {
        page-break-before: auto !important;
        page-break-after: auto !important;
        page-break-inside: auto !important;
    }
    
    body * {
        max-height: 98vh !important;
    }
    
    /* Additional scrollbar removal */
    * {
        overflow: hidden !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }
    
    *::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
    
    .container {
        gap: 8px;
        width: 100%;
        max-width: none;
    }
    
    .print-header, .print-title, .print-subtitle {
        display: none;
    }
    
    /* Hide Universal Passcode Generator blue container */
    .print-container > .container > div:first-child {
        display: none;
    }
    
    /* Hide all navigation and UI elements */
    nav, header, footer, .navbar, .nav, .navigation,
    .home-button, .back-button, .menu-button,
    .btn-home, .btn-back, .btn-menu,
    #home, #back, #menu, #nav, #navigation,
    .floating-header, .floating-footer, 
    .top-floating, .bottom-floating,
    .fixed-header, .fixed-footer,
    .sticky-header, .sticky-footer,
    .topbar, .sidebar, .toolbar {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Remove any fixed/sticky positioning that hides content */
    * {
        position: relative !important;
        z-index: auto !important;
    }
    
    /* Force main content to be visible and properly positioned */
    .print-container, .container, 
    .canvas-section, .qr-section, .cards-section,
    .print-instructions, .backup-template-section {
        position: relative !important;
        z-index: 1 !important;
        display: block !important;
        visibility: visible !important;
    }
    
    /* Override any iframe or frame restrictions */
    html, body {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .canvas-section, .qr-section, .cards-section,
    .print-instructions, .backup-template-section,
    .print-ready-section, .status-section,
    .warning-highlight {
        width: 100%;
        margin: 3px 0;
        padding: 8px;
        box-sizing: border-box;
    }
    
    .cards-section {
        text-align: center;
        margin: 3px 0;
        width: 100%;
        max-width: none;
        padding: 5px;
        overflow: visible;
    }
    
    .print-instructions, .backup-template-section {
        margin-top: 5px;
    }
    
    #canvasWindow {
        width: 140px;
        height: 140px;
    }
    
    #horizontalCardCanvas {
        width: 200px;
        height: 120px;
    }
    
    #verticalCardCanvas {
        width: 120px;
        height: 200px;
    }
    
    #cardCanvases {
        position: relative;
        height: 200px;
        width: 100%;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-around !important;
        align-items: flex-start !important;
        flex-wrap: nowrap !important;
        page-break-inside: avoid !important;
        page-break-after: avoid !important;
    }
    
    .card-container {
        position: relative !important;
        flex: 0 0 auto !important;
        margin: 0 20px !important;
    }
    
    .card-container:first-child {
        margin-left: 0 !important;
    }
    
    .card-container:last-child {
        margin-right: 0 !important;
    }
    
    #printBackup, .download-button, .card-buttons, 
    .action-buttons-container, button {
        display: none;
    }
    
    .section-title {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .print-container {
        padding: 8px;
        border-radius: 0;
    }
    
    .container {
        gap: 10px;
    }
    
    .canvas-section, .qr-section, .cards-section,
    .print-instructions, .backup-template-section,
    .print-ready-section, .status-section,
    .warning-highlight {
        padding: 12px;
        margin: 8px 0;
    }
    
    #cardCanvases {
        flex-direction: column;
        gap: 15px;
    }
    
    #canvasWindow {
        width: 200px;
        height: 200px;
        max-width: 90vw;
        max-height: 90vw;
    }
    
    .action-buttons-container {
        flex-direction: column;
        align-items: center;
    }
    
    #printBackup, .download-button {
        min-width: 180px;
        max-width: 90%;
        padding: 12px 24px;
    }
}

/* Print Template Field Alignment Styles */
.field-label-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 14px 0;
    flex-wrap: wrap;
}

.field-label {
    color: #1753b6;
    font-weight: 700;
    font-size: 1.4em;
    letter-spacing: .3px;
    white-space: nowrap;
}

.passphrase-template-row {
    display: flex;
    justify-content: center;
    gap: 3px;
    flex-wrap: wrap;
}

.timestamp-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 1.1em;
}

.passphrase-letter-box {
    display: inline-block;
    width: 28px;
    height: 32px;
    border: 3px solid #1976d2;
    border-radius: 5px;
    background: #fff;
    margin: 0 1px;
    vertical-align: middle;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    line-height: 26px;
    color: #000;
    box-shadow: 0 1px 3px rgba(25, 118, 210, 0.3);
}

.timestamp-box {
    display: inline-flex;
    width: 1.25em;
    height: 1.25em;
    font-size: 1.1em;
    background: #f0f7ff;
    color: #0b378c;
    font-family: "Roboto Mono", "Consolas", monospace;
    border: 2px solid #0b378c;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin: 0 1px;
    box-shadow: 0 1px 5px rgba(10,50,150,0.07);
    user-select: text;
}
