/* Nutrish Product Widget Styles */

.nutrish-products-container {
    margin: 20px 0;
}

/* Custom Grid System */
.nutrish-products-grid {
    display: flex;
    flex-wrap: wrap;
    margin: -15px; /* Negative margin für einheitliche Abstände */
}

.nutrish-product-wrapper {
    box-sizing: border-box;
    padding: 15px;
    flex: 0 0 var(--nutrish-col-width, 33.333%);
    max-width: var(--nutrish-col-width, 33.333%);
}

@media (max-width: 1024px) {
    .nutrish-product-wrapper {
        flex-basis: var(--nutrish-col-width-tablet, 50%);
        max-width: var(--nutrish-col-width-tablet, 50%);
    }
}
@media (max-width: 767px) {
    .nutrish-product-wrapper {
        flex-basis: var(--nutrish-col-width-mobile, 100%);
        max-width: var(--nutrish-col-width-mobile, 100%);
    }
}

/* Product Card */
.nutrish-product-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    position: relative;
}

.nutrish-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.nutrish-product-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.nutrish-product-link:hover {
    text-decoration: none;
    color: inherit;
}

.nutrish-product-image-wrapper {
    width: 100%;
    height: 200px; /* Default - wird durch Widget-Settings überschrieben */
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; /* Für Badge Overlay Positioning */
}

.nutrish-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Default - wird durch Widget-Settings überschrieben */
    transition: transform 0.3s ease;
}

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

.nutrish-product-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.nutrish-product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.nutrish-product-title {
    font-size: 16px; /* Default - wird durch Widget-Settings überschrieben */
    font-weight: 600; /* Default - wird durch Widget-Settings überschrieben */
    margin: 0;
    color: #333;
    line-height: 1.4;
    flex-grow: 1;
}

.nutrish-product-link:hover .nutrish-product-title {
    color: #007cba;
}

.nutrish-product-meta {
    margin-bottom: 8px;
}

.nutrish-product-id {
    font-size: 12px;
    color: #666;
    background: #f1f1f1;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
}

.nutrish-product-description {
    font-size: 14px; /* Default - wird durch Widget-Settings überschrieben */
    color: #666;
    margin-bottom: 15px;
    flex-grow: 1;
    line-height: 1.5;
}

.nutrish-product-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.nutrish-product-price {
    font-size: 18px; /* Default - wird durch Widget-Settings überschrieben */
    font-weight: 700; /* Default - wird durch Widget-Settings überschrieben */
    color: #e74c3c;
}

/* Availability Badge - verschiedene Positionen */
.nutrish-product-availability {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    font-weight: 500;
    white-space: nowrap;
}

/* Badge im Footer (Standard) */
.nutrish-badge-footer {
    /* Standard Badge Styling - bereits definiert */
}

/* Badge neben Titel */
.nutrish-badge-title-area {
    flex-shrink: 0;
    margin-left: auto;
}

/* Badge über Bild (Overlay) */
.nutrish-badge-image-overlay {
    position: absolute;
    z-index: 10;
    /* Position wird via inline styles gesetzt */
}

.nutrish-availability--in-stock {
    background: #d4edda;
    color: #155724;
}

.nutrish-availability--out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

.nutrish-product-additional {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.nutrish-product-additional > div {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    line-height: 1.4;
}

.nutrish-product-additional > div:last-child {
    margin-bottom: 0;
}

.nutrish-product-additional strong {
    color: #333;
}

/* Load More Button */
.nutrish-load-more-container {
    text-align: center;
    margin-top: 30px;
    padding: 20px 0;
}

.nutrish-load-more-btn {
    background: #007cba;
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.nutrish-load-more-btn:hover {
    background: #005a8b;
    transform: translateY(-2px);
}

.nutrish-load-more-btn:active {
    transform: translateY(0);
}

.nutrish-load-more-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Loading State */
.nutrish-load-more-btn.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: nutrish-spin 1s linear infinite;
}

@keyframes nutrish-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Messages */
.nutrish-message {
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
}

.nutrish-message p {
    margin: 0;
    font-size: 14px;
}

.nutrish-message--error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.nutrish-message--info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .nutrish-col-2 { flex: 0 0 25%; max-width: 25%; } /* 6 wird zu 4 Spalten */
}

@media (max-width: 992px) {
    .nutrish-col-2 { flex: 0 0 33.33333%; max-width: 33.33333%; } /* 6 wird zu 3 Spalten */
    .nutrish-col-3 { flex: 0 0 33.33333%; max-width: 33.33333%; } /* 4 wird zu 3 Spalten */
}

@media (max-width: 768px) {
    .nutrish-col-2,
    .nutrish-col-3,
    .nutrish-col-4 { flex: 0 0 50%; max-width: 50%; } /* Alles wird zu 2 Spalten */
    
    .nutrish-product-content {
        padding: 12px;
    }
    
    .nutrish-product-title {
        font-size: 15px;
    }
    
    .nutrish-product-price {
        font-size: 16px;
    }
    
    .nutrish-product-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .nutrish-product-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .nutrish-badge-title-area {
        margin-left: 0;
        margin-top: 5px;
    }

    .nutrish-load-more-btn {
        min-width: 180px;
        padding: 10px 20px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .nutrish-col-2,
    .nutrish-col-3,
    .nutrish-col-4,
    .nutrish-col-6 { flex: 0 0 100%; max-width: 100%; } /* Alles wird zu 1 Spalte */
    
    .nutrish-products-container {
        margin: 15px 0;
    }
    
    .nutrish-product-content {
        padding: 10px;
    }
    
    .nutrish-product-image-wrapper {
        height: 150px;
    }

    .nutrish-load-more-btn {
        width: 100%;
        min-width: auto;
    }

    /* Overlay Badges auf Mobile anpassen */
    .nutrish-badge-image-overlay {
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* Accessibility */
.nutrish-product-link:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.nutrish-load-more-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .nutrish-product-card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
        margin-bottom: 15px;
    }
    
    .nutrish-product-card:hover {
        transform: none;
        box-shadow: none;
    }
    
    .nutrish-product-image {
        max-height: 150px;
    }

    .nutrish-load-more-container {
        display: none;
    }

    /* Overlay Badges für Print optimieren */
    .nutrish-badge-image-overlay {
        position: static !important;
        display: block;
        margin-top: 5px;
    }
}

/* Animation for new products being shown */
.nutrish-product-wrapper.nutrish-fade-in {
    animation: nutrish-fadeIn 0.5s ease-in;
}

@keyframes nutrish-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover Effekte - können durch Widget-Settings deaktiviert werden */
/* Diese Selektoren werden bei deaktivierten Hover-Effekten überschrieben */

/* Standard Hover Effekte für Karten */
.nutrish-product-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Standard Hover Effekte für Bilder */
.nutrish-product-image {
    transition: transform 0.3s ease;
}

/* Erweiterte Badge Unterstützung */
.nutrish-product-availability {
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Badge Hover Effekte für bessere Interaktivität */
.nutrish-product-card:hover .nutrish-product-availability {
    transform: none; /* Badges sollen beim Card Hover nicht mittransformiert werden */
}

/* Spezielle Behandlung für Overlay Badges */
.nutrish-badge-image-overlay {
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* Verbesserte Flexibilität für verschiedene Badge Größen */
.nutrish-product-header .nutrish-product-availability {
    align-self: flex-start;
}

/* Optimierungen für verschiedene Bildverhältnisse */
.nutrish-product-image-wrapper img {
    width: 100%;
    height: 100%;
    display: block;
}

/* Fallback für fehlende Bilder */
.nutrish-product-image-wrapper:empty::before {
    content: 'Kein Bild verfügbar';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #999;
    font-size: 14px;
    background: #f8f9fa;
} 

/* Deaktiviere Hover-Effekte, wenn die Wrapper-Klasse fehlt */
.nutrish-products-container:not(.hover-enabled) .nutrish-product-card:hover {
    transform: none !important;
    box-shadow: none !important;
}
.nutrish-products-container:not(.hover-image-enabled) .nutrish-product-card:hover .nutrish-product-image {
    transform: none !important;
} 