/**
 * Iowa Food Hub WordPress Plugin Styles
 */

.ifh-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    max-width: 100%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Header */
.ifh-header {
    background: #C67C3B;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* Status Banner */
.ifh-status-banner {
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
}

.ifh-status-open {
    background: #E8F5E9;
    color: #2E7D32;
}

.ifh-status-closed {
    background: #F5F5F5;
    color: #666;
}

.ifh-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.ifh-header a {
    color: white;
    font-size: 13px;
    text-decoration: none;
    opacity: 0.9;
}

.ifh-header a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Product List - Grid Layout (3 columns on desktop) */
.ifh-products {
    list-style: none;
    margin: 0;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.ifh-products li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ifh-products li::before {
    display: none;
}

/* Product Item - Card Style */
.ifh-product {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e0e0e0;
    height: 100%;
}

.ifh-product:hover {
    text-decoration: none;
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* Product Image */
.ifh-product-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #f0f0f0;
    display: block;
}

.ifh-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* Product Info */
.ifh-product-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px;
}

.ifh-product-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    display: block;
    line-height: 1.3;
}

.ifh-product-vendor {
    font-size: 13px;
    color: #666;
    display: block;
    margin-top: 2px;
}

.ifh-product-price {
    font-size: 16px;
    font-weight: 700;
    color: #7A3E2A;
    display: block;
    margin-top: 4px;
}

/* New Badge */
.ifh-badge {
    display: inline-block;
    background: #FDF0E6;
    color: #C67C3B;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
    vertical-align: middle;
}

/* Closed Preview */
.ifh-closed-preview {
    display: flex;
    gap: 8px;
    padding: 12px;
    justify-content: center;
}

.ifh-closed-product {
    flex: 0 0 auto;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.ifh-closed-product:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.ifh-closed-product img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Footer */
.ifh-footer {
    padding: 14px 20px;
    background: #f9f9f9;
    text-align: center;
    border-top: 1px solid #e0e0e0;
}

.ifh-footer a {
    color: #C67C3B;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.ifh-footer a:hover {
    text-decoration: underline;
}

/* Error State */
.ifh-error {
    padding: 24px 16px;
    text-align: center;
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* Shop Link / CTA Banner */
.ifh-shop-link {
    padding: 14px 20px;
    text-align: center;
    background: #FDF0E6;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.ifh-cta-button {
    display: inline-block;
    color: #C67C3B !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    transition: opacity 0.2s ease;
}

.ifh-cta-button:hover {
    opacity: 0.7;
    text-decoration: underline !important;
}

/* Closed Message */
.ifh-closed-message {
    padding: 16px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    background: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
}

/* Widget Preview (Sidebar) */
.ifh-widget-preview {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
}

.ifh-preview-product {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e0e0e0;
}

.ifh-preview-product:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.ifh-preview-product img,
.ifh-preview-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.ifh-no-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    color: #ccc;
}

.ifh-preview-info {
    padding: 12px;
    background: #fff;
}

.ifh-preview-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    margin-bottom: 4px;
}

.ifh-preview-vendor {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.ifh-preview-price {
    font-size: 14px;
    font-weight: 700;
    color: #7A3E2A;
}

/* Widget Closed Thumbnails */
.ifh-widget .ifh-closed-preview {
    display: flex;
    gap: 8px;
    padding: 12px;
    justify-content: center;
}

.ifh-closed-thumb {
    flex: 0 0 auto;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
}

.ifh-closed-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Widget Footer */
.ifh-widget-footer {
    padding: 14px 20px;
    background: #f9f9f9;
    text-align: center;
    border-top: 1px solid #e0e0e0;
}

.ifh-view-more {
    color: #C67C3B;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.ifh-view-more:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 1024px) {
    .ifh-products {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .ifh-products {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .ifh-products {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 10px;
    }

    .ifh-product-info {
        padding: 14px;
    }

    .ifh-header {
        padding: 14px 16px;
    }

    .ifh-product-title {
        font-size: 14px;
    }

    .ifh-product-price {
        font-size: 15px;
    }
}

/* Widget Description */
.ifh-widget-description {
    padding: 14px 20px;
    background: #f5f5f5;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
}

.ifh-widget-description p {
    margin: 0;
}

/* Sidebar-specific adjustments */
.widget .ifh-widget {
    border: none;
    border-radius: 0;
}

.widget .ifh-header {
    border-radius: 0;
}

/* Keep sidebar as single column with smaller images */
.widget .ifh-products {
    grid-template-columns: 1fr;
    padding: 10px;
    gap: 12px;
}

.widget .ifh-product-info {
    padding: 12px;
}

.widget .ifh-product-title {
    font-size: 13px;
}

/* Block editor preview */
.editor-styles-wrapper .ifh-widget {
    pointer-events: none;
}
