/**
 * WooCommerce Grouped Products - Frontend Styles
 */

.wgp-grouped-wrapper {
    width: 100%;
    margin: 20px 0;
}

/* Grid Layout */
.wgp-products-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.wgp-products-grid.columns-1 {
    grid-template-columns: 1fr;
}

.wgp-products-grid.columns-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wgp-products-grid.columns-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wgp-products-grid.columns-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Produkt-Karte */
.wgp-product-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    min-width: 0; /* Verhindert Grid-Expansion */
    position: relative;
}

.wgp-product-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    z-index: 200; /* Höher als sticky Produktbild (99) */
}

/* Produktbild */
.wgp-product-image {
    width: 100%;
    margin-bottom: 15px;
    border-radius: 6px;
    overflow: hidden;
    background: #f8f9fa;
}

.wgp-product-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    aspect-ratio: 1;
}

/* Produkttitel */
.wgp-product-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--e-global-color-text);
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Produkt-Actions (Icons) - unter dem Titel */
.wgp-product-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

/* Info-Icon mit Tooltip */
.wgp-info-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #888;
    cursor: help;
    position: relative;
    transition: color 0.2s ease;
}

.wgp-info-icon:hover {
    color: var(--e-global-color-primary, #e67e22);
}

/* Tooltip */
.wgp-info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #333;
    color: white;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    width: 250px;
    max-width: 300px;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: none;
    text-align: left;
}

.wgp-info-icon::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border: 6px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 2001;
}

.wgp-info-icon:hover::after,
.wgp-info-icon:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Produkt-Link Button */
.wgp-product-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #888 !important;
    text-decoration: none;
    transition: color 0.2s ease;
}

.wgp-product-link:hover {
    color: var(--e-global-color-primary, #e67e22) !important;
}

/* Custom Beschreibung aus Meta-Feld */
.wgp-product-conf-description {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 0 0 12px 0;
}

/* Varianten-Wrapper */
.wgp-variations-wrapper {
    margin-top: auto;
}

.wgp-variation-field {
    margin-bottom: 10px;
}

.wgp-variation-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    margin-bottom: 5px;
}

/* Varianten-Dropdown */
.wgp-variation-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wgp-variation-select:focus {
    outline: none;
    border-color: #a46497;
    box-shadow: 0 0 0 3px rgba(164, 100, 151, 0.1);
}

.wgp-variation-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Checkbox für einfache Produkte */
.wgp-simple-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-top: auto;
    padding: 10px 0;
}

.wgp-simple-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    background: white !important;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    margin: 0;
}

.wgp-simple-checkbox input[type="checkbox"]:checked {
    background: white !important;
    border-color: #28a745;
}

.wgp-simple-checkbox input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #28a745;
    font-size: 14px;
    font-weight: bold;
}

.wgp-simple-checkbox span {
    font-size: 14px;
    font-weight: 500;
    color: var(--e-global-color-text);
}

/* Mengenfeld */
.wgp-quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.wgp-quantity-wrapper label {
    font-weight: 600;
    min-width: 80px;
    margin: 0;
}

.wgp-quantity-wrapper input[type="number"] {
    width: 80px;
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    text-align: center;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.wgp-quantity-wrapper input[type="number"]:focus {
    outline: none;
    border-color: #a46497;
}

/* Quote Actions (Buttons vom Quote Plugin) */
.wgp-quote-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.wgp-quote-actions button {
    flex: 1;
    min-width: 200px;
}

/* Fehlermarkierung für unvollständige Varianten */
.wgp-product-card.has-error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.wgp-product-card.has-error .wgp-variation-select {
    border-color: #dc3545;
}

/* Notice Messages */
.wgp-notice {
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wgp-notice.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.wgp-notice.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Spacer Überschriften */
.wgp-spacer-heading {
    grid-column: 1 / -1; /* Nimmt die volle Breite ein */
    margin: 30px 0 15px 0;
    padding-bottom: 10px;
}

/* Höhere Spezifität um Elementor zu überschreiben */
.wgp-grouped-wrapper .wgp-spacer-heading h3,
.wgp-spacer-heading h3 {
    font-family: "Sansation", Sans-serif !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    color: var(--e-global-color-text) !important;
    margin: 0 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4 !important;
}

/* Spacer Beschreibungstext */
.wgp-spacer-description {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin: 8px 0 0 0;
    font-weight: 400;
}

/* Erste Produkt-Karte nach Spacer */
.wgp-spacer-heading + .wgp-product-card {
    margin-top: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .wgp-products-grid.columns-3,
    .wgp-products-grid.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .wgp-quote-actions {
        flex-direction: column;
    }
    
    .wgp-quote-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .wgp-products-grid.columns-2,
    .wgp-products-grid.columns-3,
    .wgp-products-grid.columns-4 {
        grid-template-columns: 1fr;
    }
    
    .wgp-product-card {
        padding: 15px;
    }
    
    .wgp-quantity-wrapper {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .wgp-quantity-wrapper label {
        min-width: auto;
    }
    
    .wgp-quantity-wrapper input[type="number"] {
        width: 100%;
    }
}

/* Elementor Editor */
.elementor-editor-active .wgp-grouped-wrapper {
    min-height: 200px;
}

.wgp-no-product,
.wgp-no-products {
    padding: 20px;
    background: #f8f9fa;
    border: 1px dashed #ddd;
    border-radius: 6px;
    text-align: center;
    color: #666;
}

/* ===================================
   Bandlängen-Kalkulator Styles
   =================================== */

/* Calculator Card */
.wgp-calculator-card {
    grid-column: 1 / -1; /* Nimmt die volle Breite ein */
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    transition: all 0.3s ease;
}

.wgp-calculator-card.hidden {
    display: none;
}

.wgp-calculator-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: var(--e-global-color-text);
}

.wgp-calculator-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Input Groups */
.wgp-calc-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wgp-calc-input-group > label {
    font-size: 14px;
    font-weight: 600;
    color: var(--e-global-color-text);
}

.wgp-calc-help {
    font-weight: 400;
    color: #666;
    font-size: 13px;
}

/* Eintauchtiefe Input */
.wgp-calc-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    transition: border-color 0.3s ease;
}

.wgp-calc-input-wrapper:focus-within {
    border-color: var(--e-global-color-primary, #e67e22);
}

.wgp-calc-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 4px;
}

.wgp-calc-unit {
    color: #666;
    font-weight: 600;
    font-size: 14px;
}

/* Montage-Optionen (Radio Buttons mit Bildern) */
.wgp-calc-mount-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.wgp-calc-mount-option {
    position: relative;
}

.wgp-calc-mount-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.wgp-calc-mount-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.wgp-calc-mount-label:hover {
    border-color: #999;
    background: #fafafa;
}

.wgp-calc-mount-option input[type="radio"]:checked + .wgp-calc-mount-label {
    border-color: var(--e-global-color-primary, #e67e22);
    background: #fff5ed;
}

.wgp-calc-mount-label img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    flex-shrink: 0;
}

.wgp-calc-mount-label span {
    font-size: 13px;
    font-weight: 500;
    color: var(--e-global-color-text);
    flex: 1;
}

.wgp-calc-mount-option input[type="radio"]:checked + .wgp-calc-mount-label span {
    font-weight: 600;
    color: var(--e-global-color-primary, #e67e22);
}

.wgp-calc-mount-label small {
    display: block;
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

/* Band-Typ (Normal/Spezial) */
.wgp-calc-band-type {
    display: flex;
    gap: 10px;
}

.wgp-calc-type-option {
    flex: 1;
    position: relative;
}

.wgp-calc-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.wgp-calc-type-label {
    display: block;
    padding: 12px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.wgp-calc-type-label:hover {
    border-color: #999;
    background: #fafafa;
}

.wgp-calc-type-option input[type="radio"]:checked + .wgp-calc-type-label {
    border-color: var(--e-global-color-primary, #e67e22);
    background: #fff5ed;
    font-weight: 600;
    color: var(--e-global-color-primary, #e67e22);
}

/* Berechnen Button */
.wgp-calc-button {
    width: 100%;
    padding: 16px 24px;
    background-image: linear-gradient(180deg, var(--e-global-color-primary, #e67e22) 0%, var(--e-global-color-21c5f65, #d35400) 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 4px;
    font-family: "Sansation", Sans-serif;
    font-size: 16px;
    font-weight: 400;
    text-transform: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: none !important;
}

.wgp-calc-button:hover {
    opacity: 0.9;
    transform: none;
}

.wgp-calc-button:active {
    transform: translateY(1px);
}

/* Warnung */
.wgp-calc-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 12px 15px;
    color: #856404;
    font-size: 14px;
    line-height: 1.5;
}

/* Ergebnisse */
.wgp-calc-results {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-top: 20px;
}

.wgp-calc-result-title {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.wgp-calc-result-value {
    font-size: 48px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 16px;
    line-height: 1.1;
}

.wgp-calc-config {
    background: #f8fafc;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
}

.wgp-calc-config-title {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 12px;
}

.wgp-calc-config-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
    color: #64748b;
}

.wgp-calc-config-item:last-child {
    border-bottom: none;
}

.wgp-calc-config-value {
    font-weight: 600;
    color: #334155;
}

.wgp-calc-recommendation {
    background: #f8fafc;
    border-radius: 6px;
    padding: 16px;
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
    border: 1px solid #e2e8f0;
}

.wgp-calc-recommendation strong {
    color: #1e293b;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .wgp-calculator-card {
        padding: 15px;
    }
    
    .wgp-calc-mount-options {
        grid-template-columns: 1fr;
    }
    
    .wgp-calc-result-value {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .wgp-calc-band-type {
        flex-direction: column;
    }
    
    .wgp-calc-result-value {
        font-size: 24px;
    }
}

/* Visuelle Hervorhebung wenn Kalkulator-Wahl übernommen wird */
.wgp-product-card.wgp-calc-selected {
    border-color: #28a745;
    box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.2);
    animation: wgpPulse 0.5s ease-in-out;
}

@keyframes wgpPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}
/* Hinweistext für Bandlängenkalkulator */
.wgp-calc-hint {
    /* Kein grid-column - nimmt normale Spalte ein */
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    background: #fff9e6;
    border: 1px solid #ffc107;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.7;
    min-width: 0;
    /* overflow: hidden entfernt - verhindert Button-Clipping */
}

.wgp-calc-hint-icon {
    display: none; /* Icon verstecken */
}

.wgp-calc-hint-content {
    flex: 1;
    color: #5d4e00;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.wgp-calc-hint-content strong {
    display: block;
    margin-bottom: 10px;
    color: #3e2e00;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.wgp-calc-hint-content p {
    margin: 0;
    color: #5d4e00;
    text-align: left;
}

.wgp-calc-hint-content p:last-child {
    margin-bottom: 0;
}

/* Button zum Einblenden des Kalkulators */
.wgp-show-calculator-btn {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    background-image: linear-gradient(180deg, var(--e-global-color-primary, #e67e22) 0%, var(--e-global-color-21c5f65, #d35400) 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 6px;
    font-family: "Sansation", Sans-serif !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 4px;
    text-align: center !important;
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.wgp-show-calculator-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.wgp-show-calculator-btn:active {
    transform: translateY(0);
}

/* ===================================
   RAPID Produkte - nebeneinander 50%/50%
   =================================== */

/* RAPID Wrapper - eigenes 2-Spalten Layout */
.wgp-rapid-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    grid-column: 1 / -1; /* Nimmt volle Breite im übergeordneten Grid */
    margin-bottom: 0;
}

/* RAPID Produkte: je 50% Breite */
.wgp-rapid-wrapper .wgp-product-card.wgp-rapid-product {
    flex: 0 0 calc(50% - 10px);
    max-width: calc(50% - 10px);
    box-sizing: border-box;
}

/* Responsiv: Auf kleinen Bildschirmen untereinander */
@media (max-width: 768px) {
    .wgp-rapid-wrapper .wgp-product-card.wgp-rapid-product {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Inaktiver RAPID */
.wgp-product-card.wgp-rapid-inactive {
    opacity: 0.5;
    filter: grayscale(30%);
    transition: all 0.3s ease;
}

.wgp-product-card.wgp-rapid-inactive:hover {
    opacity: 0.8;
    filter: grayscale(0%);
}

/* Skimmerband Produkte */
.wgp-product-card.wgp-skimmerband-product {
    /* Initial versteckt via inline style */
}