/* =============================================================================
 *  Slow Draw — GSTIN Checkout Field Styles
 *
 *  Scoped to .sd-gstin-* classes. Designed to feel cohesive with the rest of
 *  the checkout (rounded inputs, soft borders, brand gold for active state).
 *  All transitions use cubic-bezier(0.22, 1, 0.36, 1) for the Apple-grade
 *  ease that's used elsewhere on the site.
 * ============================================================================= */

#sd-gstin-section {
    margin-top: clamp(20px, 2.4vw, 28px);
    padding-top: clamp(18px, 2vw, 24px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* Opt-in checkbox row */
.sd-gstin-optin-row {
    margin-bottom: 0 !important;
}
.sd-gstin-optin-label {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: clamp(13px, 1vw, 14.5px);
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
}
.sd-gstin-optin-label .input-checkbox {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #9b6b28;
    cursor: pointer;
}
.sd-gstin-optin-label:hover .sd-gstin-optin-text {
    color: #9b6b28;
}
.sd-gstin-optin-text {
    transition: color 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Conditional input row (shown only when checkbox is on) */
.sd-gstin-input-row {
    margin-top: clamp(14px, 1.6vw, 18px) !important;
    animation: sd-gstin-fade-in 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sd-gstin-fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sd-gstin-label {
    display: block;
    font-size: clamp(10px, 0.8vw, 11px);
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 8px;
}
.sd-gstin-label .optional {
    display: inline-block;
    margin-left: 8px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    color: #94a3b8;
    font-size: 11px;
}

/* The input itself — tactile, monospace for legibility.
 *
 * SPECIFICITY NOTE (added 2026-05-02): we double-class the selector
 * (`.sd-gstin-input.sd-gstin-input`) and scope inside `#sd-gstin-section`
 * to win against the theme's checkout input styles which were stripping
 * the border. We avoid `!important` on most rules so theme designers can
 * still override with higher specificity if needed — only the visual
 * essentials (border + background + radius) are forced. */
#sd-gstin-section input.sd-gstin-input,
#sd-gstin-section input.sd-gstin-input.input-text {
    box-sizing: border-box !important;
    width: 100% !important;
    height: 60px !important;
    padding: 0 20px !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    color: #1a1a1a !important;
    font-family: 'Poppins', sans-serif !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
    line-height: normal;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition:
        border-color 0.26s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.26s cubic-bezier(0.22, 1, 0.36, 1),
        background 0.26s cubic-bezier(0.22, 1, 0.36, 1) !important;
    appearance: none;
    -webkit-appearance: none;
}
#sd-gstin-section input.sd-gstin-input::placeholder,
#sd-gstin-section input.sd-gstin-input.input-text::placeholder {
    color: #94a3b8 !important;
    font-weight: 500 !important;
    letter-spacing: 0.04em !important;
    text-transform: none;
    opacity: 1;
}
#sd-gstin-section input.sd-gstin-input:focus,
#sd-gstin-section input.sd-gstin-input:focus-visible,
#sd-gstin-section input.sd-gstin-input.input-text:focus {
    outline: none !important;
    border-color: #9b6b28 !important;
    box-shadow: 0 0 0 3px rgba(155, 107, 40, 0.12) !important;
    background: #ffffff !important;
}
#sd-gstin-section input.sd-gstin-input:hover:not(:focus) {
    border-color: #c5a868 !important;
}

/* Validation feedback text */
.sd-gstin-feedback {
    display: block;
    margin-top: 8px;
    min-height: 18px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.4;
    transition: color 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.sd-gstin-feedback.is-valid {
    color: #15803d;
}
.sd-gstin-feedback.is-invalid {
    color: #b91c1c;
}
.sd-gstin-feedback.is-pending {
    color: #94a3b8;
}

/* Input-state colors driven by JS classes */
.sd-gstin-input.is-valid {
    border-color: #16a34a;
    background: rgba(34, 197, 94, 0.04);
}
.sd-gstin-input.is-valid:focus {
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.18);
}
.sd-gstin-input.is-invalid {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.04);
}
.sd-gstin-input.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .sd-gstin-input-row,
    .sd-gstin-input,
    .sd-gstin-feedback,
    .sd-gstin-optin-text {
        animation: none !important;
        transition: none !important;
    }
}

/* =============================================================================
 *  Frontend display block — Thank-You + Order Details pages
 *  (uses the same `.woocommerce-customer-details` parent rules so it slots in
 *   visually next to the existing billing/shipping address blocks)
 * ============================================================================= */
.sd-gstin-frontend-block {
    margin-top: clamp(18px, 2vw, 24px);
    padding-top: clamp(16px, 1.8vw, 20px);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.sd-gstin-frontend-block .sd-gstin-block-title {
    font-size: clamp(11px, 0.85vw, 12.5px);
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #475569;
    margin: 0 0 8px;
}
.sd-gstin-frontend-block .sd-gstin-block-address {
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #0f172a;
    font-style: normal;
}
