/**
 * Imagelet Product Types - Frame Picker Styles
 *
 * Styles for the shared imagelet_frame picker component:
 * - Trigger button row (No Frame / Wall / Tabletop)
 * - Modal-body grid of in-stock frame variations
 *
 * Depends on `ipt-modal.css` for the modal chrome (overlay, window, header).
 *
 * @package Imagelet_Product_Types
 */

/* ====================
   Frame Picker Triggers
   ==================== */

.ipt-frame-picker-triggers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: stretch;
}

/*
 * Mirror the variation-swatch styling defined in `frontend.css` (the
 * `.single-product .ct-variation-swatches .ct-swatch-container` block) so
 * the picker visually slots in alongside the Size / Content swatches in
 * the same form. Also defeats the theme's default <button> appearance
 * (background fill, taller padding, etc.) by being explicit on every
 * relevant property.
 */
.ipt-frame-picker-triggers .ipt-frame-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    color: #333;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none;
    margin: 0;
    transition: border-color 0.15s ease;
}

.ipt-frame-picker-triggers .ipt-frame-trigger:hover {
    border-color: #999;
    background: transparent;
    color: #333;
}

.ipt-frame-picker-triggers .ipt-frame-trigger:focus,
.ipt-frame-picker-triggers .ipt-frame-trigger:focus-visible {
    outline: none;
    border-color: #555;
    background: transparent;
    color: #333;
}

.ipt-frame-picker-triggers .ipt-frame-trigger.has-selection {
    border-color: #555;
    background: transparent;
    color: #333;
    font-weight: 500;
}

.ipt-frame-trigger-label {
    flex: 1;
    text-align: left;
    line-height: 1.4;
}

/* ====================
   Selected-Frame Display
   ==================== */

.ipt-frame-picker-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: baseline;
    margin-top: 8px;
    font-size: 13px;
    color: #555;
    line-height: 1.4;
}

.ipt-frame-picker-selection[hidden] {
    display: none !important;
}

.ipt-frame-picker-selection-label {
    color: #888;
    font-weight: 400;
}

.ipt-frame-picker-selection-name {
    color: #222;
    font-weight: 500;
}

.ipt-frame-picker-selection-size,
.ipt-frame-picker-selection-color,
.ipt-frame-picker-selection-price {
    color: #555;
    font-weight: 400;
}

.ipt-frame-picker-selection-price .amount,
.ipt-frame-picker-selection-price .woocommerce-Price-amount {
    color: #555;
    font-weight: 400;
}

/* ====================
   Frame Picker Modal Body
   ==================== */

.ipt-frame-picker-loading,
.ipt-frame-picker-empty,
.ipt-frame-picker-error {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
}

.ipt-frame-picker-error {
    color: #b32d2e;
}

.ipt-frame-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.ipt-frame-picker-tile {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 0;
    background: #fafafa;
    border: 2px solid transparent;
    border-radius: 0;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    overflow: hidden;
}

.ipt-frame-picker-tile:hover {
    background: #f0f0f0;
    border-color: #d4d4d4;
}

.ipt-frame-picker-tile.selected {
    border-color: #888;
    background: #fff;
}

.ipt-frame-picker-tile-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #fff;
    border: 0;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.ipt-frame-picker-tile-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.ipt-frame-picker-tile-thumb.is-empty {
    color: #999;
    font-size: 12px;
    background: repeating-linear-gradient(
        45deg,
        #f5f5f5,
        #f5f5f5 6px,
        #fff 6px,
        #fff 12px
    );
}

.ipt-frame-picker-tile-name {
    font-size: 13px;
    font-weight: 500;
    color: #222;
    line-height: 1.3;
    padding: 8px 8px 2px;
    word-break: break-word;
}

.ipt-frame-picker-tile-meta {
    font-size: 11px;
    color: #666;
    line-height: 1.3;
    padding: 0 8px 8px;
}

@media (max-width: 600px) {
    .ipt-frame-picker-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}
