/* grid.css - Grid layout and template styles */

/* Grid container */
.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    width: 100%;
    max-width: 450px;
    max-height: 820px; /* Show ~3 rows (9 images) then scroll */
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    padding: 0 10px;
    scroll-behavior: smooth;
}

/* Custom scrollbar styling for grid */
.grid::-webkit-scrollbar {
    width: 8px;
}

.grid::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.grid::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.grid::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Grid item */
.grid-item {
    max-width: 144px; /* 432px HD preview width ÷ 3 = 144px per grid item */
    width: 100%;
    margin: 0 auto;
    padding-top: 10px;
}

/* Grid item template */
.kilo-flyers-template {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding-bottom: 177.78%; /* Portrait aspect ratio to match HD preview (1080x1920) */
    border-radius: 8px;
    background: #000000;
    cursor: pointer;
}

/* Remove aspect ratio variations - use single portrait ratio */
.kilo-flyers-template.square,
.kilo-flyers-template.portrait,
.kilo-flyers-template.standard {
    padding-bottom: 177.78%; /* All use portrait aspect ratio */
}

/* Selected state only - removed hover effects */
.kilo-flyers-template.selected {
    border: 2px solid #4a9eff;
}

/* Template images */
.kilo-flyers-template img.background,
.kilo-flyers-template img.foreground {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kilo-flyers-template img.background {
    z-index: 1;
}

.kilo-flyers-template img.foreground {
    z-index: 3;
}

/* Portrait styles moved to portraitDefaults.css */

/* Grid loading state */
.grid-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Grid empty state */
.grid-empty {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* Status section */
.status-section {
    margin: 10px 0;
    text-align: left;
    padding-left: 10px;
    min-height: 24px; /* Prevent layout shifts when empty */
}

.search-status {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
    min-height: 14px; /* Maintain height even when empty */
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background-color: #4CAF50;
    width: 0;
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: #000;
    font-size: 12px;
    font-weight: bold;
}


