/* --- Main Modal Overlay --- */
#upg-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    overflow: scroll;
    padding: 40px 20px;
    box-sizing: border-box;
}

/* --- The White Printable Area --- */
#upg-print-area {
    width: 800px;
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    /* This border matches your sample image */
    border: 8px solid #0163c5; 
    border-radius: 0;
    overflow: hidden; /* Helps contain child elements */
    /* MOVED PADDING HERE: This applies padding to the main container */
    padding: 30px;
    box-sizing: border-box;
}

/* This div no longer needs separate padding */
.upg-padded-content {
    padding: 0;
}

.upg-header img { 
    width: 100%; 
    height: auto;
    display: block;
}

/* UPDATED: Using your requested styles for the date line */
.upg-date-line { 
    text-align: center; 
    font-size: 14px;
    padding: 12px 15px;
    margin: 20px 0; /* Added margin to create space */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50px;
    box-sizing: border-box;
    background-color: #0163c5;
    color: #ffffff;
    border-top: 1px solid #f3f3f3;
    border-bottom: 1px solid #f3f3f3;
}
.upg-date-line .separator { margin: 0 15px; }
.upg-title { 
    text-align: center; 
    font-size: 36px; 
    font-weight: 700;
    margin-top: 25px; 
    margin-bottom: 30px; 
    color: #212529; 
    line-height: 1.2;
}
.upg-content.columns-2 { column-count: 2; column-gap: 30px; }
.upg-content.columns-1 { column-count: 1; }
.upg-feature-image { width: 100%; margin-bottom: 15px; break-inside: avoid; }
.upg-feature-image img { width: 100%; height: auto; }
.upg-text-content p { 
    color: #333; 
    line-height: 1.7; 
    font-size: 16px; 
    text-align: justify;
}
.upg-footer { 
    text-align: center; 
    margin-top: 20px; 
    margin-bottom: -15px;
    padding-top: 20px; 
    border-top: 1px solid #0163c5;
    font-size: 14px; 
}

/* --- Action Buttons at the Bottom --- */
.upg-action-buttons { 
    width: 800px;
    max-width: 800px;
    text-align: center; 
    margin: 0 auto 40px auto;
    padding: 20px; 
    background-color: transparent; 
    box-sizing: border-box;
}
.upg-action-buttons button { padding: 10px 25px; font-size: 16px; cursor: pointer; margin: 0 10px; border-radius: 4px; border: none; }
#upg-save-jpg { background-color: #2ea44f; color: white; }
#upg-print-pdf { background-color: #0e61d4; color: white; }

/* --- Loader Animation --- */
.upg-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    color: #ea580c;
}

/* --- CSS For the Actual Printing Process --- */
@media print {
    body > * { display: none !important; }
    #upg-modal-overlay, #upg-modal-overlay * { visibility: visible !important; display: block !important; }
    #upg-modal-overlay { position: static !important; background: transparent !important; overflow: visible !important; padding: 0 !important; margin: 0 !important; }
    #upg-print-area { width: 100% !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; border: none !important; box-shadow: none !important; border-radius: 0 !important; }
    .upg-action-buttons { display: none !important; }
}
/* --- Styles for Photocard Generator --- */

/* Modal overlay to center the content */
#upg-modal-overlay.photocard-mode {
    display: flex !important;
    flex-direction: column !important; 
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 20px !important;
    overflow-y: auto !important;
}

#upg-photocard-modal-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 20px !important;
    width: 100%; /* Ensure content wrapper takes full width */
}

/* --- Responsive Wrapper & Preview --- */

/* Mobile First: Base styles for small screens */
#upg-photocard-preview-wrapper {
    /* Height is calculated: original_height * scale */
    height: calc(1080px * 0.35); 
}
#upg-photocard-preview {
    transform: scale(0.35); 
    transform-origin: top center;
}

#upg-photocard-controls {
    width: 95%; /* Full width on small screens */
    max-width: 450px; /* But not too wide */
    background: #f0f0f1;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Tablet View: (e.g., screens wider than 540px) */
@media (min-width: 540px) {
    #upg-photocard-preview-wrapper {
        height: calc(1080px * 0.5); 
    }
    #upg-photocard-preview {
        transform: scale(0.5); 
    }
}

/* * ===============================================================
 * CHANGED >> Desktop View Scaled Up << CHANGED
 * ===============================================================
 */
@media (min-width: 768px) {
    #upg-photocard-preview-wrapper {
        /* Height now calculated with 0.8 scale */
        height: calc(1080px * 0.8); 
    }
    #upg-photocard-preview {
        /* Preview is now 80% of its original size */
        transform: scale(0.8); 
    }
}


/* --- Controls Styling --- */
#upg-photocard-controls h3 {
    margin-top: 0;
    font-size: 22px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

#upg-photocard-controls .control-group {
    margin-bottom: 20px;
}

#upg-photocard-controls label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    font-size: 15px;
}

#upg-photocard-controls input[type="range"] {
    width: 100%;
}

#upg-photocard-controls .control-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

#upg-photocard-controls button {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    width: 48%;
}

#upg-photocard-back {
    background-color: #6c757d;
    color: white;
}

#upg-photocard-download {
    background-color: #198754;
    color: white;
}

.developer-credit {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: #555;
}

/* --- Frame Selector Styling --- */
#upg-frame-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}
.frame-thumb {
    width: 60px;
    height: 60px;
    border: 2px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s;
    object-fit: cover;
}
.frame-thumb:hover {
    border-color: #0073aa;
}
.frame-thumb.active {
    border-color: #00a0d2;
    box-shadow: 0 0 5px rgba(0, 160, 210, 0.7);
}

/*
 * ===============================================================
 * NEW >> Mobile Controls Adjustments << NEW
 * ===============================================================
 */
@media (max-width: 540px) {
    #upg-photocard-controls h3 {
        font-size: 20px; /* Make title smaller */
    }
    #upg-photocard-controls label {
        font-size: 14px; /* Make labels smaller */
    }
    #upg-photocard-controls button {
        font-size: 14px; /* Make button text smaller */
        padding: 10px 15px; /* Reduce button padding */
    }
}
#photocard-headline-text {
    text-align: center !important;
}