/**
 * MIL6PRINT Bundle Frontend Styles
 */
.variations_form.cart .variations .label {
    display: none;
}
/* Main bundle buttons wrapper - will be moved into dropdown cell by JavaScript */
.mil6print-bundle-buttons-wrapper {
    margin: 0 0 15px 0;
    padding: 0;
    width: 100%;
}

/* When moved inside the dropdown cell */
.variations td.value .mil6print-bundle-buttons-wrapper {
    margin: 0 0 10px 0;
    padding: 0;
    width: 100%;
}

.mil6print-bundle-buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em;
    align-items: center;
    max-width: 100%;
    margin-bottom: 0.35em;
}

/* Style buttons to match the original wc-size-bundle appearance */
.mil6print-bundle-button,
.mil6print-buyall-pill {
    display: inline-block;
    padding: 0.35em 0.65em;
    background: #0073aa;
    color: white !important;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.80em;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
    flex: 0 0 auto;
}

/* ≥ 768px - make buttons fill width of the cell in equal columns */
@media (min-width: 768px) {
    .mil6print-bundle-buttons-row {
        display: grid;
        grid-template-columns: repeat(4, 1fr); /* 4 equal columns */
        gap: 0.5em;
        flex-wrap: nowrap;
        width: 100%;
        margin-bottom: 20px;
    }
    
    .mil6print-bundle-button,
    .mil6print-buyall-pill {
        font-size: 0.75em;
        padding: 0.30em 0.55em;
        width: 100%; /* stretch to cell */
        text-align: center; /* label centered */
        white-space: nowrap;
    }
}

/* ≥ 1200px - trim a touch more if needed */
@media (min-width: 1200px) {
    .mil6print-bundle-button,
    .mil6print-buyall-pill {
        font-size: 0.70em;
        padding: 0.28em 0.50em;
    }
}

.mil6print-bundle-button:hover,
.mil6print-buyall-pill:hover {
    background: #005a87;
    color: white !important;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mil6print-bundle-button:active,
.mil6print-buyall-pill:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.mil6print-bundle-button.loading,
.mil6print-buyall-pill.loading {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

.mil6print-bundle-button.loading::after,
.mil6print-buyall-pill.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: mil6print-spin 1s linear infinite;
}

@keyframes mil6print-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive adjustments for small screens */
@media (max-width: 767px) {
    .mil6print-bundle-buttons-row {
        display: flex; /* Use flex on small screens for wrapping */
        gap: 0.3em;
    }
    
    .mil6print-bundle-button,
    .mil6print-buyall-pill {
        font-size: 0.75em;
        padding: 0.3em 0.6em;
        flex: 1 1 auto; /* Allow buttons to grow and shrink */
        min-width: 0; /* Allow shrinking */
    }
}

@media (max-width: 480px) {
    .mil6print-bundle-buttons-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.4em;
    }
    
    .mil6print-bundle-button,
    .mil6print-buyall-pill {
        width: 100%;
        text-align: center;
        font-size: 0.85em;
        padding: 0.4em 0.7em;
    }
}

/* Success/Error Messages */
.mil6print-bundle-message {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    font-weight: 500;
}

.mil6print-bundle-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.mil6print-bundle-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Integration with existing button styles */
.mil6print-bundle-button.woocommerce-button,
.mil6print-buyall-pill.woocommerce-button {
    background: #e9ecef;
    color: #333 !important;
    border: 1px solid #ced4da;
}

.mil6print-bundle-button.woocommerce-button:hover,
.mil6print-buyall-pill.woocommerce-button:hover {
    background: #dee2e6;
    color: #333 !important;
}

/* Alternative styling to match WooCommerce theme */
.woocommerce .mil6print-bundle-button,
.woocommerce .mil6print-buyall-pill {
    background: #a46497;
    color: black !important;
}

.woocommerce .mil6print-bundle-button:hover,
.woocommerce .mil6print-buyall-pill:hover {
    background: #935087;
    color: black !important;
}

/* Quick View specific styles */
.mil6print-quickview-add-to-cart .mil6print-bundle-buttons-wrapper {
    margin: 15px 0;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.mil6print-quickview-add-to-cart .mil6print-bundle-buttons-row {
    gap: 6px;
}

.mil6print-quickview-add-to-cart .mil6print-bundle-button,
.mil6print-quickview-add-to-cart .mil6print-buyall-pill {
    font-size: 12px;
    padding: 5px 10px;
}

.mil6print-bundle-message {
    border-radius: 4px;
    padding: 8px 12px;
    margin: 8px 0;
    font-size: 14px;
    animation: fadeIn 0.3s ease;
}

.mil6print-bundle-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.mil6print-bundle-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
