/**
 * POS Page Styles
 * Styles specific to the Points of Sale page template
 *
 * Note: This file only contains styles for the feature sections and POS-specific overrides.
 * Section header styles are in style.css
 * Card grid styles are in map.css
 */

/* ==========================================================================
   Page Layout
   ========================================================================== */

.pos-page {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
}

.pos-page .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* ==========================================================================
   POS-Specific Header Overrides
   ========================================================================== */

/* The .pos-header class adds POS-specific adjustments to section-header */
.pos-header {
    /* Additional POS-specific styles if needed */
}

/* ==========================================================================
   Feature Sections (Retailers & Farmers' Markets)
   ========================================================================== */

.pos-features {
    padding: var(--spacing-xxl) 0;
    background: var(--color-background);
}

.pos-feature {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    align-items: center;
    margin-bottom: var(--spacing-xxl);
}

.pos-feature:last-child {
    margin-bottom: 0;
}

/* Reversed layout for alternating pattern */
.pos-feature--reversed {
    direction: rtl;
}

.pos-feature--reversed > * {
    direction: ltr;
}

/* Visual Side */
.pos-feature__visual {
    position: relative;
}

.pos-feature__image {
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-warm-md, 0 8px 24px rgba(0, 0, 0, 0.08));
    padding-bottom: 75%;
    height: 0;
    aspect-ratio: 4 / 3;
    background: var(--color-surface);
}

@supports (aspect-ratio: 1) {
    .pos-feature__image {
        padding-bottom: 0;
        height: auto;
    }
}

.pos-feature__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Placeholder styles (when no image) */
.pos-feature__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-alt) 100%);
}

.pos-feature__placeholder svg {
    width: 80px;
    height: 80px;
    opacity: 0.4;
}

.pos-feature__placeholder--retailer {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    color: #6C757D;
}

.pos-feature__placeholder--market {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #28A745;
}

/* Badge on image */
.pos-feature__badge {
    position: absolute;
    bottom: var(--spacing-md);
    inset-inline-start: var(--spacing-md);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.pos-feature__badge--retailer {
    background-color: #6C757D;
}

.pos-feature__badge--market {
    background-color: #28A745;
}

/* Content Side */
.pos-feature__content h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 var(--spacing-md);
}

.pos-feature__content p {
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--color-text-secondary);
    margin: 0 0 var(--spacing-md);
}

.pos-feature__content p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   POS Grid Section
   ========================================================================== */

.pos-grid-section {
    padding: var(--spacing-xxl) 0;
    background: var(--color-cream);
    flex: 1 0 auto;
}

.pos-grid-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    display: grid;
    grid-template-rows: 1fr;
    overflow: hidden;
    transition: grid-template-rows 0.4s ease, margin-bottom 0.4s ease;
}

/* When parent has collapsed state, hide the grid header */
.section-header-group--collapsed .pos-grid-header {
    grid-template-rows: 0fr;
    margin-bottom: 0;
}

.pos-grid-header h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
    min-height: 0;
    overflow: hidden;
}

/* Card enhancements for POS grid */
.pos-grid-section .items-list-card {
    border-radius: var(--border-radius-md);
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 768px) {
    .pos-features {
        padding: var(--spacing-xl) 0;
    }

    .pos-feature {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
        margin-bottom: var(--spacing-xl);
    }

    /* Reset reversed layout on mobile - image always first */
    .pos-feature--reversed {
        direction: ltr;
    }

    .pos-feature__visual {
        order: -1;
    }

    .pos-feature__image {
        padding-bottom: 56.25%;
        height: 0;
        aspect-ratio: 16 / 9;
    }

    @supports (aspect-ratio: 1) {
        .pos-feature__image {
            padding-bottom: 0;
            height: auto;
        }
    }

    .pos-grid-section {
        padding: var(--spacing-xl) 0;
    }
}

@media (max-width: 480px) {
    .pos-page .container {
        padding: 0 var(--spacing-sm);
    }

    .pos-feature__content h2 {
        font-size: 1.5rem;
    }

    .pos-feature__content p {
        font-size: 1rem;
    }

    .pos-feature__placeholder svg {
        width: 60px;
        height: 60px;
    }
}

/* ==========================================================================
   RTL Support
   ========================================================================== */

[dir="rtl"] .pos-feature--reversed {
    direction: ltr;
}

[dir="rtl"] .pos-feature--reversed > * {
    direction: rtl;
}
