/**
 * Resin Driveway UK Product Calculator — Front-end Styles
 *
 * @package Resin_Driveway_UK_Calculator
 * @since   1.0.0
 */

/* === Reset scoped to plugin === */
.rduk-calc *,
.rduk-modal-overlay * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.rduk-calc {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    max-width: 680px;
    color: #1a2744;
}

/* --- Labels --- */
.rduk-label {
    font-size: 17px;
    font-weight: 700;
    color: #1a2744;
    margin-bottom: 12px;
}

/* --- Pill selectors --- */
.rduk-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.rduk-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 100px;
    padding: 12px 24px;
    border: 2px solid #3aa66a;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 500;
    color: #3aa66a;
    background: #fff;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.rduk-pill:hover {
    background: #f0faf4;
}

.rduk-pill.active {
    background: #3aa66a;
    color: #fff;
}

/* --- Tooltips --- */
.rduk-pill[data-tooltip] {
    position: relative;
}

.rduk-pill[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a2744;
    color: #fff;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    padding: 12px 18px;
    border-radius: 10px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    transform: translateX(-50%) translateY(4px);
    z-index: 10;
    min-width: 280px;
    max-width: 360px;
    width: max-content;
    white-space: normal;
    text-align: center;
}

.rduk-pill[data-tooltip]::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1a2744;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.rduk-pill[data-tooltip]:hover::after,
.rduk-pill[data-tooltip]:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.rduk-pill[data-tooltip]:hover::before {
    transform: translateX(-50%);
}

/* --- Quantity + Price row --- */
.rduk-qp-row {
    display: flex;
    align-items: flex-end;
    gap: 40px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.rduk-qp-col {
    display: flex;
    flex-direction: column;
}

/* --- Stepper --- */
.rduk-stepper {
    display: inline-flex !important;
    align-items: center !important;
    background: #e8e9eb !important;
    border-radius: 50px !important;
    padding: 5px !important;
    gap: 5px !important;
    height: 54px !important;
    width: 180px !important;
    border: none !important;
    box-shadow: none !important;
}

.rduk-stepper__input {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: 80px !important;
    height: 44px !important;
    text-align: center !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    color: #1a2744 !important;
    background: #fff !important;
    border: none !important;
    border-radius: 40px !important;
    outline: none !important;
    font-family: inherit !important;
    -moz-appearance: textfield !important;
    padding: 0 8px !important;
    margin: 0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
    line-height: 44px !important;
}

.rduk-stepper__input:focus {
    border: none !important;
    outline: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
}

.rduk-stepper__input::-webkit-outer-spin-button,
.rduk-stepper__input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

.rduk-stepper__btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #555 !important;
    cursor: pointer !important;
    background: #d5d6d9 !important;
    border: none !important;
    border-radius: 50% !important;
    font-family: inherit !important;
    transition: background 0.12s !important;
    -webkit-tap-highlight-color: transparent !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    box-shadow: none !important;
}

.rduk-stepper__btn:hover {
    background: #c5c6c9 !important;
}

.rduk-stepper__btn:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* --- Price display --- */
.rduk-price-display {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.rduk-price-exvat {
    font-size: 32px;
    font-weight: 700;
    color: #1a2744;
    line-height: 1;
}

.rduk-price-exvat .rduk-price-tag {
    font-size: 18px;
    font-weight: 600;
    color: #e96e20;
}

.rduk-price-incvat {
    font-size: 16px;
    color: #a0a4ab;
    font-weight: 400;
    white-space: nowrap;
}

.rduk-price-was {
    text-decoration: line-through;
    color: #a0a4ab;
    font-weight: 400;
    font-size: 16px;
}

/* --- CTA Buttons --- */
.rduk-cta-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 4px;
}

.rduk-cta {
    display: block;
    width: 100%;
    padding: 18px 24px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    text-align: center;
    transition: background 0.18s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    background: #e96e20;
    color: #fff;
}

.rduk-cta:hover {
    background: #d45e14;
}

.rduk-cta:active {
    transform: scale(0.985);
}

.rduk-hidden {
    display: none !important;
}

/* --- Price breakdown panel --- */
.rduk-breakdown {
    background: #f8faf8;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
    border: 2px solid #e8f0e8;
}

.rduk-breakdown__title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rduk-breakdown__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.rduk-breakdown__row:last-child {
    border-bottom: none;
}

.rduk-breakdown__label {
    font-size: 14px;
    color: #6b7280;
}

.rduk-breakdown__value {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
}

.rduk-breakdown__row--total {
    padding-top: 14px;
    margin-top: 4px;
    border-top: 2px solid #2d6a2d;
    border-bottom: none;
}

.rduk-breakdown__row--total .rduk-breakdown__label {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
}

.rduk-breakdown__row--total .rduk-breakdown__value {
    font-size: 22px;
    color: #2d6a2d;
}

.rduk-breakdown__row--vat .rduk-breakdown__label,
.rduk-breakdown__row--vat .rduk-breakdown__value {
    font-size: 13px;
    color: #a0a4ab;
    font-weight: 400;
}

.rduk-savings {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #dcfce7;
    color: #166534;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
}

.rduk-discount-badge {
    background: #fef3c7;
    color: #92400e;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

/* --- Installation result --- */
.rduk-install-result {
    display: none;
    background: #f6f7f8;
    border-radius: 14px;
    padding: 22px 24px;
    margin-top: 20px;
    border: 1px solid #e5e7eb;
}

.rduk-install-result.show {
    display: block;
}

.rduk-install-result__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.rduk-install-result__row + .rduk-install-result__row {
    border-top: 1px solid #e5e7eb;
}

.rduk-install-result__label {
    font-size: 14px;
    color: #6b7280;
}

.rduk-install-result__value {
    font-size: 15px;
    font-weight: 600;
    color: #1a2744;
}

.rduk-install-result__row.total {
    border-top: 2px solid #e96e20;
    margin-top: 4px;
    padding-top: 12px;
}

.rduk-install-result__row.total .rduk-install-result__label {
    font-size: 16px;
    font-weight: 700;
    color: #1a2744;
}

.rduk-install-result__row.total .rduk-install-result__value {
    font-size: 22px;
    font-weight: 700;
    color: #e96e20;
}

.rduk-install-result__row.vat .rduk-install-result__label,
.rduk-install-result__row.vat .rduk-install-result__value {
    font-size: 13px;
    color: #a0a4ab;
    font-weight: 400;
}

/* --- Modal --- */
.rduk-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(80, 80, 80, 0.72);
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

.rduk-modal-overlay.open {
    display: flex;
}

.rduk-modal {
    background: #f0f0f0;
    border-radius: 18px;
    padding: 36px 32px 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    text-align: center;
    position: relative;
    animation: rdukModalIn 0.25s ease;
}

@keyframes rdukModalIn {
    from { opacity: 0; transform: scale(0.92) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.rduk-modal__title {
    font-size: 19px;
    font-weight: 700;
    color: #1a2744;
    margin-bottom: 20px;
}

.rduk-modal__input {
    width: 100%;
    padding: 14px 18px;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-family: inherit;
    color: #1a2744;
    background: #fff;
    outline: none;
    text-transform: uppercase;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.rduk-modal__input::placeholder {
    text-transform: none;
    color: #b0b4ba;
}

.rduk-modal__feedback {
    min-height: 22px;
    font-size: 13px;
    margin-top: 8px;
    font-weight: 500;
}

.rduk-modal__feedback.match {
    color: #2d8a52;
}

.rduk-modal__feedback.error {
    color: #d43b3b;
}

.rduk-modal__submit {
    display: inline-block;
    margin-top: 16px;
    padding: 14px 52px;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    background: #e96e20;
    color: #fff;
    transition: background 0.18s, transform 0.1s;
}

.rduk-modal__submit:hover {
    background: #d45e14;
}

.rduk-modal__submit:active {
    transform: scale(0.97);
}

.rduk-modal__submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rduk-modal__close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    color: #888;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.rduk-modal__close:hover {
    color: #333;
}

/* --- Cart confirmation popup --- */
.rduk-cart-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(80, 80, 80, 0.72);
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

.rduk-cart-overlay.open {
    display: flex;
}

.rduk-cart-popup {
    background: #fff;
    border-radius: 18px;
    padding: 40px 36px 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    text-align: center;
    position: relative;
    animation: rdukModalIn 0.25s ease;
}

.rduk-cart-popup__close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    color: #888;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.rduk-cart-popup__close:hover {
    color: #333;
}

.rduk-cart-popup__icon {
    width: 56px;
    height: 56px;
    background: #dcfce7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: #166534;
}

.rduk-cart-popup__msg {
    font-size: 18px;
    font-weight: 700;
    color: #166534;
    margin-bottom: 24px;
}

.rduk-cart-popup__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rduk-cart-popup__btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.15s;
    border: none;
}

.rduk-cart-popup__btn--primary {
    background: #e96e20;
    color: #fff;
}

.rduk-cart-popup__btn--primary:hover {
    background: #d45e14;
    color: #fff;
}

.rduk-cart-popup__btn--secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.rduk-cart-popup__btn--secondary:hover {
    background: #e5e7eb;
}

/* --- Responsive --- */
@media (max-width: 520px) {
    .rduk-pills {
        gap: 8px;
    }

    .rduk-pill {
        min-width: 80px;
        padding: 10px 16px;
        font-size: 14px;
    }

    .rduk-qp-row {
        gap: 20px;
    }

    .rduk-price-exvat {
        font-size: 26px;
    }

    .rduk-modal {
        padding: 28px 22px 24px;
    }
}

/* --- WooCommerce cart page --- */
.woocommerce-cart-form .product-name a {
    font-weight: 700;
}
