/*
 * PRODUCT VARIANTS FULL WIDTH DESIGN
 * Universal full-width solution for ALL variant types (fixed and weight-based)
 * Targets the exact JavaScript-generated structure
 * Created: 2025-10-11
 */

/* ==========================================================================
   UNIVERSAL VARIANT CONTAINER - FULL WIDTH FOR ALL TYPES
   ========================================================================== */

/* Target the size options container */
#dynamic-product-container div[id*="size-options"],
.product-card-wrapper div[id*="size-options"] {
    margin-bottom: 15px !important;
    text-align: left !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Target the inline-block wrapper and make it full width */
#dynamic-product-container div[id*="size-options"] > div,
.product-card-wrapper div[id*="size-options"] > div {
    display: block !important;
    text-align: left !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* ==========================================================================
   UNIVERSAL LABEL STRUCTURE - CLICKABLE VARIANT AREAS
   ========================================================================== */

/* Target ALL variant labels (both fixed and weight-based) */
#dynamic-product-container label[style*="display: block"],
.product-card-wrapper label[style*="display: block"] {
    display: block !important;
    margin: 8px 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    position: relative !important;
}

/* Target the variant container div (with border styling) */
#dynamic-product-container label > div[style*="border:"],
#dynamic-product-container label > div[style*="border-radius:"],
.product-card-wrapper label > div[style*="border:"],
.product-card-wrapper label > div[style*="border-radius:"] {
    display: flex !important;
    align-items: flex-start !important;
    width: 100% !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    gap: 12px !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
    position: relative !important;
}

/* Add hover effect for better UX */
#dynamic-product-container label:hover > div[style*="border:"],
.product-card-wrapper label:hover > div[style*="border:"] {
    border-color: #D2691E !important;
    background: #fff9f5 !important;
}

/* Visual feedback for selected state - STRONG OVERRIDE */
#dynamic-product-container input[type="radio"]:checked + div[style*="border:"],
.product-card-wrapper input[type="radio"]:checked + div[style*="border:"],
#dynamic-product-container input[type="radio"]:checked + div.variant-container,
.product-card-wrapper input[type="radio"]:checked + div.variant-container {
    border-color: #D2691E !important;
    background: #fff5f0 !important;
}

/* Unselected state - ensure proper reset */
#dynamic-product-container input[type="radio"]:not(:checked) + div[style*="border:"],
.product-card-wrapper input[type="radio"]:not(:checked) + div[style*="border:"],
#dynamic-product-container input[type="radio"]:not(:checked) + div.variant-container,
.product-card-wrapper input[type="radio"]:not(:checked) + div.variant-container {
    border-color: #e0e0e0 !important;
    background: #ffffff !important;
}

/* ==========================================================================
   RADIO BUTTON POSITIONING - UNIVERSAL FOR ALL VARIANTS
   ========================================================================== */

/* Target ALL radio buttons in variants */
#dynamic-product-container input[type="radio"][name*="size"],
.product-card-wrapper input[type="radio"][name*="size"] {
    margin: 0 !important;
    transform: scale(1.2) !important;
    flex-shrink: 0 !important;
    align-self: flex-start !important;
    margin-top: 2px !important;
}

/* ==========================================================================
   CONTENT AREA - FULL WIDTH FOR ALL VARIANT TYPES
   ========================================================================== */

/* Target the content div that contains variant information */
#dynamic-product-container label div[style*="width: calc(100% - 30px)"],
.product-card-wrapper label div[style*="width: calc(100% - 30px)"] {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* ==========================================================================
   WEIGHT-BASED VARIANT SPECIFIC STYLING
   ========================================================================== */

/* Target the weight selection background container */
#dynamic-product-container div[style*="background: #f8f9fa"],
.product-card-wrapper div[style*="background: #f8f9fa"] {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 8px !important;
    margin: 8px 0 0 0 !important;
    background: #f8f9fa !important;
    border-radius: 6px !important;
    border: 1px solid #e9ecef !important;
    overflow: hidden !important;
}

/* Weight selection label - more compact */
#dynamic-product-container div[style*="font-size: 12px"][style*="margin-bottom: 6px"],
.product-card-wrapper div[style*="font-size: 12px"][style*="margin-bottom: 6px"] {
    font-size: 11px !important;
    color: #666 !important;
    margin-bottom: 4px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
}

/* Price display area - more compact */
#dynamic-product-container div[style*="border-top: 1px solid"],
.product-card-wrapper div[style*="border-top: 1px solid"] {
    margin-top: 6px !important;
    padding-top: 6px !important;
    border-top: 1px solid #e9ecef !important;
}

/* Price text - smaller for better fit */
#dynamic-product-container div[style*="border-top: 1px solid"] div,
.product-card-wrapper div[style*="border-top: 1px solid"] div {
    font-size: 12px !important;
    line-height: 1.3 !important;
    margin-bottom: 2px !important;
}

/* Grundpreis text - even smaller */
#dynamic-product-container div[style*="border-top: 1px solid"] div:last-child,
.product-card-wrapper div[style*="border-top: 1px solid"] div:last-child {
    font-size: 10px !important;
    color: #888 !important;
}

/* Weight control row - full width with proper spacing and overflow protection */
#dynamic-product-container div[style*="display: flex"][style*="gap: 8px"],
.product-card-wrapper div[style*="display: flex"][style*="gap: 8px"] {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
    margin-bottom: 8px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    flex-wrap: nowrap !important;
}

/* Weight input - flexible width with constraints */
#dynamic-product-container input[type="number"][id*="weight-"],
.product-card-wrapper input[type="number"][id*="weight-"] {
    flex: 1 !important;
    min-width: 50px !important;
    max-width: calc(100% - 80px) !important;
    width: auto !important;
    padding: 6px 8px !important;
    border: 2px solid #e9ecef !important;
    border-radius: 6px !important;
    text-align: center !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    box-sizing: border-box !important;
    height: 32px !important;
}

/* Weight adjustment buttons - smaller for desktop but always visible */
#dynamic-product-container button[onclick*="adjustWeight"],
.product-card-wrapper button[onclick*="adjustWeight"] {
    width: 28px !important;
    height: 28px !important;
    flex-shrink: 0 !important;
    border: 2px solid #D2691E !important;
    background: #fff !important;
    color: #D2691E !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: bold !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    min-width: 28px !important;
    max-width: 28px !important;
}

/* kg unit label - more compact */
#dynamic-product-container div[style*="display: flex"] span,
.product-card-wrapper div[style*="display: flex"] span {
    font-size: 12px !important;
    color: #666 !important;
    font-weight: 600 !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ==========================================================================
   UNIFIED CLICKABLE VARIANT DESIGN - ALL DEVICES (NO RADIO BUTTONS)
   ========================================================================== */

/* UNIVERSAL: Hide radio buttons completely for modern clickable interface */
#dynamic-product-container input[type="radio"][name*="size"],
.product-card-wrapper input[type="radio"][name*="size"] {
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* UNIVERSAL: Make entire variant container clickable and use full width */
#dynamic-product-container label > div[style*="border:"],
#dynamic-product-container label > div[style*="border-radius:"],
#dynamic-product-container label > div.variant-container,
.product-card-wrapper label > div[style*="border:"],
.product-card-wrapper label > div[style*="border-radius:"],
.product-card-wrapper label > div.variant-container {
    display: block !important;
    width: 100% !important;
    padding: 16px !important;
    box-sizing: border-box !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
    position: relative !important;
    margin-bottom: 8px !important;
}

/* UNIVERSAL: Content area uses full width without radio button space */
#dynamic-product-container label div[style*="width: calc(100% - 30px)"],
.product-card-wrapper label div[style*="width: calc(100% - 30px)"] {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* UNIVERSAL: Selected state visual indicator - ENHANCED OVERRIDE */
#dynamic-product-container input[type="radio"]:checked + div[style*="border:"],
.product-card-wrapper input[type="radio"]:checked + div[style*="border:"],
#dynamic-product-container input[type="radio"]:checked + div.variant-container,
.product-card-wrapper input[type="radio"]:checked + div.variant-container {
    border-color: #D2691E !important;
    background: #fff5f0 !important;
}

/* UNIVERSAL: Unselected state - ensure proper reset */
#dynamic-product-container input[type="radio"]:not(:checked) + div[style*="border:"],
.product-card-wrapper input[type="radio"]:not(:checked) + div[style*="border:"],
#dynamic-product-container input[type="radio"]:not(:checked) + div.variant-container,
.product-card-wrapper input[type="radio"]:not(:checked) + div.variant-container {
    border-color: #e9ecef !important;
    background: #ffffff !important;
}

/* UNIVERSAL: Visual checkmark for selected variants */
#dynamic-product-container input[type="radio"]:checked + div[style*="border:"]::before,
.product-card-wrapper input[type="radio"]:checked + div[style*="border:"]::before,
#dynamic-product-container input[type="radio"]:checked + div.variant-container::before,
.product-card-wrapper input[type="radio"]:checked + div.variant-container::before {
    content: "✓" !important;
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    background: #D2691E !important;
    color: white !important;
    border-radius: 50% !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    font-weight: bold !important;
    z-index: 1 !important;
}

/* UNIVERSAL: Hover effect for clickable areas */
#dynamic-product-container label:hover > div[style*="border:"],
.product-card-wrapper label:hover > div[style*="border:"],
#dynamic-product-container label:hover > div.variant-container,
.product-card-wrapper label:hover > div.variant-container {
    border-color: #D2691E !important;
    background: #fff9f5 !important;
}

/* UNIVERSAL: Better spacing for weight container with overflow protection */
#dynamic-product-container div[style*="display: flex"][style*="gap: 8px"],
.product-card-wrapper div[style*="display: flex"][style*="gap: 8px"] {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    margin-bottom: 10px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    flex-wrap: nowrap !important;
    padding: 0 !important;
}

/* UNIVERSAL: Weight input styling */
#dynamic-product-container input[type="number"][id*="weight-"],
.product-card-wrapper input[type="number"][id*="weight-"] {
    flex: 1 !important;
    min-width: 60px !important;
    max-width: calc(100% - 100px) !important;
    width: auto !important;
    padding: 8px 10px !important;
    border: 2px solid #e9ecef !important;
    border-radius: 8px !important;
    text-align: center !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    box-sizing: border-box !important;
    height: 36px !important;
}

/* UNIVERSAL: Weight adjustment buttons */
#dynamic-product-container button[onclick*="adjustWeight"],
.product-card-wrapper button[onclick*="adjustWeight"] {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    flex-shrink: 0 !important;
    border: 2px solid #D2691E !important;
    background: #fff !important;
    color: #D2691E !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: bold !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    z-index: 1 !important;
    position: relative !important;
}

/* UNIVERSAL: kg unit label with proper spacing */
#dynamic-product-container div[style*="display: flex"] span,
.product-card-wrapper div[style*="display: flex"] span {
    font-size: 12px !important;
    color: #666 !important;
    font-weight: 600 !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 0 4px !important;
    margin: 0 !important;
    min-width: auto !important;
}

/* UNIVERSAL: Better text sizing */
#dynamic-product-container label > div > div:first-child,
.product-card-wrapper label > div > div:first-child {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin-bottom: 8px !important;
}

/* ==========================================================================
   DEVICE-SPECIFIC OPTIMIZATIONS
   ========================================================================== */

@media screen and (max-width: 768px) {
    
    /* Mobile: Larger touch targets and spacing */
    #dynamic-product-container label > div[style*="border:"],
    #dynamic-product-container label > div.variant-container,
    .product-card-wrapper label > div[style*="border:"],
    .product-card-wrapper label > div.variant-container {
        padding: 18px !important;
        margin-bottom: 12px !important;
    }
    
    /* Mobile: Enhanced weight controls */
    #dynamic-product-container input[type="number"][id*="weight-"],
    .product-card-wrapper input[type="number"][id*="weight-"] {
        font-size: 16px !important;
        height: 40px !important;
        padding: 10px 12px !important;
    }
    
    /* Mobile: Larger weight adjustment buttons */
    #dynamic-product-container button[onclick*="adjustWeight"],
    .product-card-wrapper button[onclick*="adjustWeight"] {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        font-size: 16px !important;
    }
    
    /* Mobile: Better text sizing */
    #dynamic-product-container label > div > div:first-child,
    .product-card-wrapper label > div > div:first-child {
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }
    
    /* Mobile: kg unit label */
    #dynamic-product-container div[style*="display: flex"] span,
    .product-card-wrapper div[style*="display: flex"] span {
        font-size: 14px !important;
        padding: 0 6px !important;
    }
}

@media screen and (min-width: 769px) {
    
    /* Desktop: Optimized spacing and sizing */
    #dynamic-product-container label > div[style*="border:"],
    #dynamic-product-container label > div.variant-container,
    .product-card-wrapper label > div[style*="border:"],
    .product-card-wrapper label > div.variant-container {
        padding: 14px !important;
        margin-bottom: 8px !important;
    }
    
    /* Desktop: Compact weight controls */
    #dynamic-product-container input[type="number"][id*="weight-"],
    .product-card-wrapper input[type="number"][id*="weight-"] {
        font-size: 14px !important;
        height: 32px !important;
        padding: 6px 8px !important;
    }
    
    /* Desktop: Compact weight adjustment buttons */
    #dynamic-product-container button[onclick*="adjustWeight"],
    .product-card-wrapper button[onclick*="adjustWeight"] {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        max-width: 28px !important;
        font-size: 14px !important;
    }
    
    /* Desktop: Compact text sizing */
    #dynamic-product-container label > div > div:first-child,
    .product-card-wrapper label > div > div:first-child {
        font-size: 14px !important;
        margin-bottom: 6px !important;
    }
}

/* ==========================================================================
   HOVER AND FOCUS STATES
   ========================================================================== */

/* Weight input focus state */
#dynamic-product-container input[type="number"][id*="weight-"]:focus,
.product-card-wrapper input[type="number"][id*="weight-"]:focus {
    border-color: #2C5530 !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(44, 85, 48, 0.1) !important;
}

/* Button hover states */
#dynamic-product-container button[onclick*="adjustWeight"]:hover,
.product-card-wrapper button[onclick*="adjustWeight"]:hover {
    background: #D2691E !important;
    color: #fff !important;
}

/* Legacy radio button styling override - ensure consistency */
#dynamic-product-container input[type="radio"][style*="margin-right: 10px"],
.product-card-wrapper input[type="radio"][style*="margin-right: 10px"] {
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ==========================================================================
   GRUNDPREIS STYLING
   ========================================================================== */

/* Grundpreis display in price section */
[id$="-grundpreis"] {
    font-size: 11px !important;
    color: #888 !important;
    font-style: italic;
    margin-bottom: 5px;
    padding: 2px 0;
    border-top: 1px solid #eee;
    margin-top: 3px;
    padding-top: 5px;
}

/* Grundpreis in size selector options */
.product-size-option small {
    display: block;
    color: #888;
    font-size: 10px;
    font-style: italic;
    margin-top: 2px;
    line-height: 1.2;
}

/* Mobile responsive adjustments for Grundpreis */
@media (max-width: 768px) {
    [id$="-grundpreis"] {
        font-size: 10px !important;
    }
    
    .product-size-option small {
        font-size: 9px;
    }
}
