/* previewSizes.css - Preview dimensions for different types */

:root {
    --preview-scale: 2.5;  /* Adjusted scale for mobile-friendly size */
    --preview-base-width: 1080px;
}

/* HD Preview - 438px width, calculated height based on 1080x1920 aspect ratio */
.kilo-flyers-template-preview.hd-preview {
    width: 438px;
    height: 778px; /* 438 / 0.5625 = 778px (1080/1920 aspect ratio) */
    display: inline-block;
}

/* Post Preview - 438px width, calculated height based on 1080x1350 aspect ratio */
.kilo-flyers-template-preview.post-preview {
    width: 438px;
    height: 547px; /* 438 / 0.8 = 547px (1080/1350 aspect ratio) */
    display: inline-block;
}

/* Square Preview - 438x438 */
.kilo-flyers-template-preview.square-preview {
    width: 438px;
    height: 438px;
    display: inline-block;
}

/* Banner Preview - Exactly 1314x438 with horizontal scroll */
.kilo-flyers-template-preview.banner-preview {
    width: 1314px;
    height: 438px;
    display: inline-block;
}

/* Preview container styles */
.kilo-flyers-template-preview {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Clip portraits to preview window */
    border: 3px solid transparent; /* Hidden by default */
    box-shadow: none;
    isolation: isolate; /* Create isolated stacking context for blend modes */
    border-radius: 0; /* No rounded corners */
}

/* Show border on hover */
.kilo-flyers-template-preview:hover {
    border: 3px solid #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Preview image sizes - using the same dimensions as their containers */
.kilo-flyers-template-preview img.background,
.kilo-flyers-template-preview img.foreground {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Z-index for layers */
.kilo-flyers-template-preview img.background {
    z-index: 1;
}

.kilo-flyers-template-preview img.foreground {
    z-index: 3;
    pointer-events: none; /* Allow clicking through foreground to text layers */
}

/* Preview interaction styles */
.kilo-flyers-template-preview {
    position: relative;  /* Create stacking context for absolute children */
    overflow: hidden;    /* Clip portraits to preview window */
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    border-radius: 0; /* No rounded corners */
}

.kilo-flyers-template-preview.selected {
    border: 3px solid white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Client version - Show all preview types */

/* Preview order: HD (1920) → Reels (1440) → Post (1350) → Square (1080) → Banner */

.hd-preview {
    display: inline-block !important;
    margin: 10px;
    vertical-align: bottom;
    order: 1; /* HD first - 1920 */
}

.reels-preview {
    width: 438px;
    height: 582px;
    display: inline-block !important; /* Always visible - show all 5 previews */
    margin: 10px;
    vertical-align: bottom;
    order: 2; /* Reels second - 1440 */
}

.post-preview {
    display: inline-block !important;
    margin: 10px;
    vertical-align: bottom;
    order: 3; /* Post third - 1350 */
}

.square-preview {
    display: inline-block !important;
    margin: 10px;
    vertical-align: bottom;
    order: 4; /* Square fourth - 1080 */
}

.banner-preview {
    display: inline-block !important;
    margin: 10px;
    vertical-align: bottom;
    order: 5; /* Banner fifth */
}

/* REMOVED: Auto-hide logic - users want both 1350 and 1440 previews visible
   Users can load different PSDs into each preview independently */

/* Hide editing tools popup - causes conflicts */
.editing-tools-popup {
    display: none !important;
}

/* Adjust preview container for multiple previews */
.preview-container {
    display: flex;
    justify-content: flex-start; /* Start from left to enable scroll */
    align-items: flex-end; /* Align from bottom */
    padding: 20px 10px;
    overflow-x: auto; /* Enable horizontal scrolling */
    overflow-y: hidden; /* Prevent vertical scroll */
    width: 100%;
}

.preview {
    display: flex;
    justify-content: flex-start; /* Start from left */
    align-items: flex-end; /* Align from bottom */
    gap: 15px;
    min-width: max-content; /* Allow content to extend beyond container */
    flex-wrap: nowrap; /* Force single row */
}

/* Enable preview interactions for portrait and text layers */
.kilo-flyers-template-preview {
    pointer-events: auto; /* Enable interactions */
}

.kilo-flyers-template-preview img.preview-portrait {
    pointer-events: auto; /* Ensure portrait is interactive */
    z-index: 2; /* Between background and foreground */
}


