/* DualSell for WooCommerce — Frontend styles */

/* ───────────────────────────────────────────────────────────────────────
   CTA button — render is <a role="button">; theme controls visuals.
   We intentionally do NOT force colors / background here — every theme
   already styles its `a.button` / `a.single_add_to_cart_button` /
   `a.buy_now_button`. DualSell only sets cursor and inherits everything else.

   Admins who want to override the theme's color can use the per-product
   colour controls in the metabox (or the global setting), which inject an
   inline `style="..."` directly on the CTA element — that ALWAYS wins.
   ─────────────────────────────────────────────────────────────────────── */
a.dualsell-cta-button,
.dualsell-cta-button { cursor: pointer; text-decoration: none; }

/* Optional admin-defined overrides via CSS custom properties.
   When admin leaves a color empty → the corresponding `--ds-*` variable
   is NOT set on the element → the rule below resolves to its fallback
   (`unset`), letting the theme's native button style win. When admin
   fills a value → inline style sets the variable → rule wins without
   any !important. */
a.dualsell-cta-button[style*="--ds-bg"]            { background-color: var(--ds-bg); }
a.dualsell-cta-button[style*="--ds-color"]         { color: var(--ds-color); }
a.dualsell-cta-button[style*="--ds-border"]        { border: 2px solid var(--ds-border); }
a.dualsell-cta-button[style*="--ds-hover-border"]:hover     { border: 2px solid var(--ds-hover-border); }
a.dualsell-cta-button[style*="--ds-radius"]        { border-radius: var(--ds-radius); }
a.dualsell-cta-button[style*="--ds-hover-bg"]:hover         { background-color: var(--ds-hover-bg); }
a.dualsell-cta-button[style*="--ds-hover-color"]:hover      { color: var(--ds-hover-color); }
a.dualsell-cta-button[style*="--ds-hover-border"]:hover     { border-color: var(--ds-hover-border); }
/* Smooth transition for state changes */
a.dualsell-cta-button { transition: background-color .2s ease, color .2s ease, border-color .2s ease, border-radius .2s ease; }
.dualsell-fallback-page { max-width: 800px; margin: 2em auto; padding: 0 1em; }
.dualsell-form-container { background: #fff; padding: 2em; border: 1px solid #ddd; border-radius: 4px; }

/* ────────────────────────────────────────────────────────────────────────
   Modal — overlay + panel.
   Inherits the host theme's typography and uses neutral monochrome accents
   so it visually belongs to the site instead of looking bolted-on.
   ──────────────────────────────────────────────────────────────────────── */
.dualsell-modal {
    display: none;
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(0, 0, 0, .5);
    align-items: center; justify-content: center;
    padding: 16px;
    animation: dsFadeIn .18s ease-out;
    font-family: inherit;
    color: inherit;
}
.dualsell-modal__panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,.25);
    max-width: 480px; width: 100%; max-height: 92vh; overflow-y: auto;
    padding: 28px 28px 24px;
    position: relative;
    animation: dsSlideUp .22s ease-out;
    font-family: inherit;
    color: inherit;
}
.dualsell-modal__close {
    position: absolute; top: 12px; right: 12px;
    width: 32px; height: 32px;
    background: transparent; border: none; border-radius: 4px;
    color: inherit; opacity: .6; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: opacity .15s ease, background .15s ease;
}
.dualsell-modal__close:hover { opacity: 1; background: rgba(0,0,0,.04); }
.dualsell-modal__close svg { width: 18px; height: 18px; }

.dualsell-modal__title {
    margin: 0 36px 4px 0;
    font-family: inherit; color: inherit;
    font-size: 1.35rem; font-weight: 700; line-height: 1.25;
}
.dualsell-modal__intro {
    margin: 0 0 20px;
    font-family: inherit;
    font-size: .9rem; opacity: .65;
}

/* ────────────────────────────────────────────────────────────────────────
   Form fields with leading icons (icons inherit currentColor → theme color)
   ──────────────────────────────────────────────────────────────────────── */
.dualsell-form { margin: 0; font-family: inherit; }
.dualsell-form .ds-hp { display: none; }

.ds-field { margin-bottom: 14px; }
.ds-label {
    display: inline-flex; align-items: center; gap: 6px;
    font: inherit; font-size: .85rem; font-weight: 600;
    color: inherit; opacity: .85;
    margin-bottom: 6px;
}
.ds-req { opacity: .55; margin-left: 2px; }

/* Icon-prefixed input: SVG sits absolutely on the left, input has padding-left
   to make room. Textarea uses the same wrap but the icon aligns to the top. */
.ds-input-wrap { position: relative; }
.ds-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: inherit; opacity: .45;
    pointer-events: none;
    display: inline-flex; align-items: center; justify-content: center;
}
.ds-input-icon .ds-i { width: 16px; height: 16px; }
.ds-field--textarea .ds-input-icon { top: 14px; transform: none; }

.dualsell-form input[type="text"],
.dualsell-form input[type="email"],
.dualsell-form input[type="tel"],
.dualsell-form textarea {
    width: 100%; box-sizing: border-box;
    padding: 10px 14px 10px 40px;
    font: inherit; color: inherit;
    background: transparent;
    border: 1px solid rgba(0,0,0,.18); border-radius: 4px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.dualsell-form input:focus + .ds-input-icon,
.dualsell-form textarea:focus + .ds-input-icon { opacity: .75; }
.ds-input-wrap:focus-within .ds-input-icon { opacity: .75; }
.dualsell-form input::placeholder,
.dualsell-form textarea::placeholder { color: inherit; opacity: .4; }
.dualsell-form input:hover,
.dualsell-form textarea:hover { border-color: rgba(0,0,0,.35); }
.dualsell-form input:focus,
.dualsell-form textarea:focus {
    outline: none;
    border-color: currentColor;
    box-shadow: 0 0 0 3px rgba(0,0,0,.06);
}
.dualsell-form textarea { resize: vertical; min-height: 88px; }

/* ────────────────────────────────────────────────────────────────────────
   GDPR — neutral checkbox
   ──────────────────────────────────────────────────────────────────────── */
.ds-gdpr {
    display: flex; gap: 10px; align-items: flex-start;
    margin: 16px 0 4px;
    padding: 0;
    font: inherit;
    cursor: pointer;
}
/* Control container: keeps the real <input> hit-target on top of the visible box. */
.ds-gdpr-control {
    position: relative;
    flex-shrink: 0;
    width: 18px; height: 18px;
    margin-top: 2px;
    display: inline-block;
}
.ds-gdpr-control input {
    position: absolute;
    inset: 0;
    width: 18px; height: 18px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}
.ds-gdpr-box {
    position: absolute;
    inset: 0;
    background: transparent; border: 1.5px solid rgba(0,0,0,.4); border-radius: 3px;
    display: inline-flex; align-items: center; justify-content: center;
    color: transparent;
    pointer-events: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.ds-gdpr-box svg { width: 12px; height: 12px; }
.ds-gdpr-control input:checked + .ds-gdpr-box {
    background: #111; border-color: #111; color: #fff;
}
.ds-gdpr-control input:focus-visible + .ds-gdpr-box {
    box-shadow: 0 0 0 3px rgba(0,0,0,.15);
}
.ds-gdpr-control input:hover + .ds-gdpr-box { border-color: rgba(0,0,0,.7); }
.ds-gdpr-text {
    font-size: .8rem; line-height: 1.5;
    color: inherit; opacity: .8;
    display: flex; gap: 6px; align-items: flex-start;
}
.ds-gdpr-text .ds-i-shield { opacity: .55; width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; }

/* ────────────────────────────────────────────────────────────────────────
   Submit — solid dark / theme-aligned monochrome
   ──────────────────────────────────────────────────────────────────────── */
.ds-submit {
    width: 100%;
    margin-top: 16px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 20px;
    font: inherit; font-size: 1rem; font-weight: 600;
    color: #fff;
    background: #111;
    border: none; border-radius: 4px; cursor: pointer;
    transition: background .15s ease, opacity .15s ease;
}
.ds-submit:hover:not(:disabled) { background: #000; }
.ds-submit:disabled,
.ds-submit.ds-submit--loading { cursor: wait; opacity: .65; }
.ds-submit.ds-submit--loading .ds-i { animation: dsSpin 1s linear infinite; }
.ds-submit .ds-i { width: 16px; height: 16px; }

.ds-error {
    margin: 12px 0 0;
    padding: 8px 12px;
    font-size: .85rem; color: #b00020;
    background: rgba(176, 0, 32, .06); border-left: 3px solid #b00020;
    display: none;
}

.ds-success {
    text-align: center; padding: 24px 8px 8px;
    font-family: inherit;
    color: inherit;
}
.ds-success svg {
    width: 48px; height: 48px;
    background: rgba(0,0,0,.05); border-radius: 50%; padding: 10px;
    box-sizing: border-box;
    margin-bottom: 12px;
    color: #1a7f37;
    animation: dsPop .35s ease-out;
}
.ds-success p {
    font-size: 1.05rem; font-weight: 600;
    margin: 0;
}

/* ────────────────────────────────────────────────────────────────────────
   Animations
   ──────────────────────────────────────────────────────────────────────── */
@keyframes dsFadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes dsSlideUp { from { opacity: 0; transform: translateY(12px) scale(.98) } to { opacity: 1; transform: translateY(0) scale(1) } }
@keyframes dsSpin    { to   { transform: rotate(360deg) } }
@keyframes dsPop     { 0% { transform: scale(.4); opacity: 0 } 60% { transform: scale(1.08); opacity: 1 } 100% { transform: scale(1) } }

@media (prefers-reduced-motion: reduce) {
    .dualsell-modal, .dualsell-modal__panel, .ds-success svg, .ds-submit.ds-submit--loading .ds-i { animation: none; }
}

@media (max-width: 480px) {
    .dualsell-modal__panel { padding: 22px 18px 18px; border-radius: 14px; }
    .dualsell-modal__title { font-size: 1.2rem; }
}

/* HOTFIX 2026-05-20: hide WC quantity input on DualSell form-mode products */
.dualsell-hidden-qty,
form.cart .dualsell-hidden-qty,
.product-buttons-wrapper .quantity:has(.dualsell-hidden-qty),
.product-buttons-wrapper > .quantity { display: none !important; }

