/* Tenseal Form Embed Styles
 * --tenseal-primary is set inline by the shortcode renderer from the
 * form's settings.primary_color. Defaults to Tenseal teal.
 */
.tenseal-form-wrapper {
    --tenseal-primary: #00d4aa;
    --tenseal-primary-soft: rgba(0, 212, 170, 0.08);
    --tenseal-primary-hover: rgba(0, 212, 170, 0.85);
    max-width: 640px;
    margin: 2rem auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.tenseal-form-wrapper[data-theme="dark"] {
    background: #1a1a2e;
    border-color: #2d2d44;
    color: #e2e8f0;
}

.tenseal-form-header { margin-bottom: 1.5rem; }

.tenseal-form-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: inherit;
}

.tenseal-form-desc {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0;
}

.tenseal-form-wrapper[data-theme="dark"] .tenseal-form-desc { color: #94a3b8; }

.tenseal-field { margin-bottom: 1.25rem; }

.tenseal-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: inherit;
}

.tenseal-required { color: #ef4444; }

.tenseal-input {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.tenseal-input:focus {
    border-color: var(--tenseal-primary);
    box-shadow: 0 0 0 3px var(--tenseal-primary-soft);
}

.tenseal-form-wrapper[data-theme="dark"] .tenseal-input {
    background: #16213e;
    border-color: #2d2d44;
    color: #e2e8f0;
}

textarea.tenseal-input { resize: vertical; min-height: 80px; }
select.tenseal-input { cursor: pointer; }

.tenseal-checkbox-label,
.tenseal-radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.tenseal-checkbox-label input,
.tenseal-radio-label input { accent-color: var(--tenseal-primary); }

/* ---------- Product Selector ---------- */
.tenseal-product-selector { margin-top: 0.5rem; }

.tenseal-product-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.9rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 0.65rem;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    background: #fff;
}

.tenseal-product-card:hover { border-color: var(--tenseal-primary); }
.tenseal-product-card.selected {
    border-color: var(--tenseal-primary);
    background: var(--tenseal-primary-soft);
    box-shadow: 0 0 0 2px var(--tenseal-primary-soft);
}

.tenseal-form-wrapper[data-theme="dark"] .tenseal-product-card {
    background: #16213e;
    border-color: #2d2d44;
}

.tenseal-product-img {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    background: #f1f5f9;
    flex-shrink: 0;
}

.tenseal-product-info { flex: 1; min-width: 0; }

.tenseal-product-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0 0 0.3rem;
    line-height: 1.3;
}

.tenseal-product-price {
    font-size: 1rem;
    color: var(--tenseal-primary);
    font-weight: 700;
}

/* Discount tier list */
.tenseal-discount-tiers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.tenseal-discount-tier {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
    transition: all 0.15s;
}

.tenseal-discount-tier.active {
    background: var(--tenseal-primary);
    color: #fff;
    border-color: var(--tenseal-primary);
    box-shadow: 0 0 0 2px var(--tenseal-primary-soft);
}

.tenseal-form-wrapper[data-theme="dark"] .tenseal-discount-tier {
    background: rgba(251, 146, 60, 0.12);
    color: #fdba74;
    border-color: rgba(251, 146, 60, 0.35);
}

.tenseal-qty-control {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.65rem;
}

.tenseal-qty-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #475569;
}

.tenseal-qty-btn:hover {
    border-color: var(--tenseal-primary);
    color: var(--tenseal-primary);
}

.tenseal-form-wrapper[data-theme="dark"] .tenseal-qty-btn {
    background: #16213e;
    border-color: #2d2d44;
    color: #e2e8f0;
}

.tenseal-qty-input {
    width: 44px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.25rem;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
    color: inherit;
}

.tenseal-form-wrapper[data-theme="dark"] .tenseal-qty-input {
    background: #16213e;
    border-color: #2d2d44;
}

/* ---------- Order Summary ---------- */
.tenseal-order-summary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.25rem;
    margin: 1.5rem 0;
}

.tenseal-form-wrapper[data-theme="dark"] .tenseal-order-summary {
    background: #16213e;
    border-color: #2d2d44;
}

.tenseal-summary-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
}

.tenseal-summary-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 0.375rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.tenseal-form-wrapper[data-theme="dark"] .tenseal-summary-item { border-color: #2d2d44; }

.tenseal-summary-total {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 2px solid var(--tenseal-primary);
}

.tenseal-total-amount { color: var(--tenseal-primary); }

/* ---------- Submit Button ---------- */
.tenseal-form-footer { margin-top: 1.5rem; }

.tenseal-submit-btn {
    width: 100%;
    padding: 0.85rem 1.5rem;
    background: var(--tenseal-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.05s;
    font-family: inherit;
}

.tenseal-submit-btn:hover { opacity: 0.92; }
.tenseal-submit-btn:active { transform: translateY(1px); }
.tenseal-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------- Message ---------- */
.tenseal-form-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
}

.tenseal-form-message.success { background: rgba(0,212,170,0.1); color: #00857a; border: 1px solid #00d4aa; }
.tenseal-form-message.error { background: rgba(239,68,68,0.1); color: #b91c1c; border: 1px solid #ef4444; }

/* ---------- Powered by ---------- */
.tenseal-powered {
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 1.5rem;
}

.tenseal-powered a { color: var(--tenseal-primary); text-decoration: none; }
.tenseal-powered a:hover { text-decoration: underline; }

.tenseal-loading {
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
    padding: 1rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .tenseal-form-wrapper { padding: 1.25rem; margin: 1rem; }
    .tenseal-product-card { flex-wrap: wrap; }
    .tenseal-product-img { width: 56px; height: 56px; }
}

/* ---------- Confirm Modal (centered, branded) ---------- */
/* Pure JS/CSS — no jQuery, no third-party libs — so it never collides
   with the host WordPress theme's own modal stack. The Confirm button
   uses --tenseal-primary which the shortcode set from the form's
   primary_color, so the dialog naturally matches the merchant's brand. */
.tenseal-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2147483000; /* sit above WP admin bars + sticky headers */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 180ms ease-out;
    font-family: inherit;
}
.tenseal-confirm-overlay.is-open { opacity: 1; }

.tenseal-confirm-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.28), 0 0 0 1px rgba(0,0,0,0.04);
    max-width: 420px;
    width: 100%;
    padding: 1.75rem 1.75rem 1.5rem;
    transform: translateY(-12px) scale(0.97);
    transition: transform 180ms ease-out;
    text-align: center;
    box-sizing: border-box;
}
.tenseal-confirm-overlay.is-open .tenseal-confirm-box {
    transform: translateY(0) scale(1);
}

.tenseal-confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--tenseal-primary-soft, rgba(0,212,170,0.08));
    color: var(--tenseal-primary, #00d4aa);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 24px;
    line-height: 1;
}

.tenseal-confirm-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.4rem;
}

.tenseal-confirm-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #475569;
    margin: 0 0 1.5rem;
}

.tenseal-confirm-actions {
    display: flex;
    gap: 0.5rem;
    flex-direction: row-reverse;
}

.tenseal-confirm-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: none;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
    font-family: inherit;
    line-height: 1.2;
}

.tenseal-confirm-btn.is-primary {
    background: var(--tenseal-primary, #00d4aa);
    color: #fff;
}
.tenseal-confirm-btn.is-primary:hover { filter: brightness(0.93); }

.tenseal-confirm-btn.is-secondary {
    background: #f1f5f9;
    color: #475569;
}
.tenseal-confirm-btn.is-secondary:hover { background: #e2e8f0; }

@media (max-width: 480px) {
    .tenseal-confirm-box { padding: 1.5rem 1.25rem 1.25rem; }
    .tenseal-confirm-actions { flex-direction: column; }
}
