/**
 * D2G Purchase Module Styles
 * Matches the new D2G website bento aesthetic
 */

/* ============================================
   Module Container
   ============================================ */
.d2g-purchase-module {
    font-family: Lato, "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e5e5e5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* ============================================
   Price Header
   ============================================ */
.d2g-pm-price-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f3f4f6;
}

.d2g-pm-price-display {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.d2g-pm-price-from {
    font-size: 14px;
    color: #6b7280;
}

.d2g-pm-price-amount {
    font-size: 28px;
    font-weight: 600;
    color: #111827;
}

.d2g-pm-price-suffix {
    font-size: 14px;
    color: #6b7280;
}

.d2g-pm-price-note {
    font-size: 12px;
    color: #9ca3af;
    margin: 4px 0 0 0;
}

/* ============================================
   Options / Dropdowns
   ============================================ */
.d2g-pm-options {
    padding: 16px 24px;
}

.d2g-pm-option-group {
    margin-bottom: 12px;
}

    .d2g-pm-option-group:last-child {
        margin-bottom: 0;
    }

.d2g-pm-option-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 6px;
    padding-left: 4px;
}

.d2g-pm-select-wrapper {
    position: relative;
}

.d2g-pm-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 40px 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

    .d2g-pm-select:hover {
        border-color: #d1d5db;
    }

    .d2g-pm-select:focus {
        outline: none;
        border-color: #dc2626;
        box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    }

    /* Placeholder style for unselected */
    .d2g-pm-select option[value=""] {
        color: #9ca3af;
    }

.d2g-pm-select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #9ca3af;
    pointer-events: none;
}

/* ============================================
   Volume Pricing
   ============================================ */
.d2g-pm-volume-pricing {
    margin: 0 24px 12px;
}

.d2g-pm-volume-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f9fafb;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

    .d2g-pm-volume-toggle:hover {
        background: #f3f4f6;
    }

.d2g-pm-volume-toggle-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.d2g-pm-volume-label {
    font-size: 14px;
    color: #4b5563;
}

.d2g-pm-volume-savings {
    display: inline-block;
    background: #dcfce7;
    color: #15803d;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 9999px;
}

.d2g-pm-volume-arrow {
    width: 20px;
    height: 20px;
    color: #9ca3af;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.d2g-pm-volume-tiers {
    margin-top: 8px;
    background: #f9fafb;
    border-radius: 12px;
    overflow: hidden;
}

.d2g-pm-tiers-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
}

.d2g-pm-tiers-body {
    /* Rows added via JS */
}

.d2g-pm-tier-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 10px 16px;
    font-size: 14px;
    color: #4b5563;
    border-bottom: 1px solid #f3f4f6;
}

    .d2g-pm-tier-row:last-child {
        border-bottom: none;
    }

    .d2g-pm-tier-row.d2g-pm-tier-active {
        background: #fef2f2;
        color: #dc2626;
        font-weight: 500;
    }

        .d2g-pm-tier-row.d2g-pm-tier-active .d2g-pm-tier-savings {
            color: #15803d;
        }

.d2g-pm-tier-savings {
    color: #9ca3af;
}

.d2g-pm-tiers-footer {
    font-size: 12px;
    color: #9ca3af;
    padding: 8px 16px;
    background: #f3f4f6;
    margin: 0;
}

/* ============================================
   Selection Summary
   ============================================ */
.d2g-pm-summary {
    margin: 0 24px 16px;
    background: #f9fafb;
    border-radius: 12px;
    padding: 16px;
}

.d2g-pm-summary-inner {
    display: flex;
    gap: 16px;
}

.d2g-pm-summary-image {
    width: 80px;
    height: 80px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .d2g-pm-summary-image img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

.d2g-pm-summary-details {
    flex: 1;
    min-width: 0;
}

.d2g-pm-summary-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.d2g-pm-summary-meta {
    font-size: 12px;
    color: #6b7280;
    margin: 0 0 8px 0;
}

.d2g-pm-summary-price {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.d2g-pm-current-price {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.d2g-pm-price-each {
    font-size: 12px;
    color: #6b7280;
}

/* ============================================
   Add-on Options (Checkboxes)
   ============================================ */
.d2g-pm-addons {
    margin: 0 24px 16px;
}

.d2g-pm-addons-label {
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    margin: 0 0 8px 0;
}

.d2g-pm-addon-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

    .d2g-pm-addon-item:last-child {
        border-bottom: none;
    }

.d2g-pm-addon-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

    .d2g-pm-addon-checkbox input[type="checkbox"] {
        width: 16px;
        height: 16px;
        accent-color: #dc2626;
        cursor: pointer;
    }

.d2g-pm-addon-name {
    font-size: 14px;
    color: #374151;
}

.d2g-pm-addon-price {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

/* ============================================
   Actions (Quantity + Add to Cart)
   ============================================ */
.d2g-pm-actions {
    padding: 0 24px 20px;
}

.d2g-pm-actions-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

/* Quantity Selector */
.d2g-pm-quantity {
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 12px;
    overflow: hidden;
}

.d2g-pm-qty-btn {
    width: 40px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #4b5563;
    transition: background-color 0.2s ease;
}

    .d2g-pm-qty-btn:hover {
        background: #e5e7eb;
    }

    .d2g-pm-qty-btn svg {
        width: 16px;
        height: 16px;
    }

.d2g-pm-qty-input {
    width: 40px;
    height: 44px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    -moz-appearance: textfield;
}

    .d2g-pm-qty-input::-webkit-outer-spin-button,
    .d2g-pm-qty-input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    .d2g-pm-qty-input:focus {
        outline: none;
    }

/* Add to Cart Button */
.d2g-pm-add-to-cart {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #dc2626;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

    .d2g-pm-add-to-cart:hover {
        background: #b91c1c;
    }

    .d2g-pm-add-to-cart svg {
        width: 20px;
        height: 20px;
    }

/* Order Total */
.d2g-pm-order-total {
    text-align: right;
    font-size: 14px;
    color: #4b5563;
}

    .d2g-pm-order-total span {
        font-weight: 600;
        color: #111827;
    }

/* ============================================
   Enquire Now Section
   ============================================ */
.d2g-pm-enquire {
    text-align: center;
    font-size: 14px;
    color: #6b7280;
    padding: 16px 24px;
    border-top: 1px solid #f3f4f6;
}

.d2g-pm-enquire-link {
    color: #374151;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

    .d2g-pm-enquire-link:hover {
        color: #dc2626;
    }

.d2g-pm-phone {
    font-weight: 500;
    color: #374151;
}

/* Pre-selection enquire (when variants exist but not selected) */
.d2g-pm-preselect-enquire {
    /* Same styling, just uses the .d2g-pm-enquire inside */
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 480px) {
    .d2g-pm-price-amount {
        font-size: 24px;
    }

    .d2g-pm-summary-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .d2g-pm-summary-image {
        width: 60px;
        height: 60px;
    }

    .d2g-pm-actions-row {
        flex-direction: column;
    }

    .d2g-pm-quantity {
        justify-content: center;
    }

    .d2g-pm-order-total {
        text-align: center;
    }
}

/* ============================================
   Animation for content reveal
   ============================================ */
.d2g-pm-selected-content {
    animation: d2g-pm-fadeIn 0.3s ease;
}

@keyframes d2g-pm-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.d2g-purchase-module .selected_product .pm-product-image, .selected_product .pm-product-image {
    display: none !important;
}

/*
div[id^="pm-addons"] input[type="checkbox"] {
    appearance: block !important;
}
*/

