/**
 * Intelligent Layout System CSS
 * Required for pages using intelligent-layout.js
 * Handles responsive layout for landscape/portrait/square orientations
 */

/* Container for the intelligent layout */
.products-grid {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    display: block; /* Changed from flex to block to ensure vertical stacking */
}

/* Row-based layout container */
.layout-row {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: stretch;
    width: 100%;
    clear: both;
}

/* Base product card styling */
.product-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    background: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

/* Dynamic sizing based on breakpoint and orientation */
@media (min-width: 1200px) {
    /* Above 1200px: Smart paired layout */
    .layout-row.paired {
        display: flex;
        gap: 2rem;
    }

    .product-card.in-pair.landscape {
        flex: 2; /* Takes 2/3 of the row */
    }

    .product-card.in-pair.portrait {
        flex: 1; /* Takes 1/3 of the row */
    }

    .product-card.in-pair.square {
        flex: 1.2; /* Slightly larger than portrait */
    }
}

@media (max-width: 1199px) {
    /* Below 1200px: Stack vertically or 2-column */
    .layout-row {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
}

@media (max-width: 768px) {
    /* Mobile: Single column */
    .layout-row {
        display: flex;
        flex-direction: column;
    }

    .products-grid {
        padding: 1rem;
    }

    .layout-row {
        gap: 1.5rem;
        margin-bottom: 1.5rem;
    }
}

/* Image containers with intelligent sizing */
.product-image-container {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
    flex: 0 0 auto;
}

/* Landscape images: wider aspect ratio - increased height for better visibility */
.product-card.landscape .product-image-container {
    height: 450px;
}

/* Portrait images: taller aspect ratio */
.product-card.portrait .product-image-container {
    height: 450px;
}

/* Square images: balanced */
.product-card.square .product-image-container {
    height: 380px;
}

/* Image styling */
.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* Product info styling */
.product-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-category {
    color: #8B5A3C;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.product-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.product-formats {
    color: #666;
    font-size: 0.9rem;
    margin-top: auto;
}

.product-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(139, 90, 60, 0.9);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
}

/* Loading state */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: #8B5A3C;
    font-size: 1.2rem;
}

/* Portrait Layout Responsive Containers */
.portrait-large-screen {
    display: block;
}

.portrait-medium-screen {
    display: none;
}

/* Switch containers based on screen size */
@media (max-width: 1199px) {
    .portrait-large-screen {
        display: none;
    }

    .portrait-medium-screen {
        display: block;
    }
}

@media (max-width: 768px) {
    .portrait-large-screen {
        display: none;
    }

    .portrait-medium-screen {
        display: block;
    }
}

/* DEBUG MODE - Orientation indicators for testing */
.orientation-indicator {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 3;
}

/* DEBUG MODE - Row pattern indicators for testing */
.row-indicator {
    position: absolute;
    top: 0.5rem;
    left: 1rem;
    background: rgba(139, 90, 60, 0.9);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    z-index: 4;
}
