/**
 * Yushunxin Custom Two-Step Recycling Form Styles
 * Optimized for both Modal Popup and Inline Page contexts.
 */

/* ==========================================================================
   1. Base Wrapper & Popup Modal Overrides
   ========================================================================== */
.msg-box {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 66666 !important;
    background: #ffffff !important;
    padding: 0 !important;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.28) !important;
    display: none;
    width: 92% !important;
    max-width: 820px !important;
    max-height: 88vh !important;
    border-radius: 8px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
}

.msg-box .bt {
    display: none !important; /* Hide old redundant title inside msg-box */
}

.msg-box .clock {
    /* sticky, not fixed: .msg-box is the scroll container and is transformed,
       so position:fixed would scroll out of view together with the content */
    position: sticky !important;
    float: right !important;
    margin: 14px 14px -28px 0 !important;
    display: block !important;
    top: 14px !important;
    right: 14px !important;
    z-index: 99 !important;
    width: 28px !important;
    height: 28px !important;
    background-size: 22px !important;
}

/* ==========================================================================
   Popup modal: single unified scroll container (.msg-box)
   ========================================================================== */
.msg-box .ysx-two-step-form-wrap {
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
    background: transparent !important;
}

.msg-box .ysx-step-panel {
    max-height: none !important;
    overflow: visible !important;
    padding: 18px 24px 30px !important;
}

.msg-box .ysx-form-top-bar {
    position: sticky !important;
    top: 0 !important;
    z-index: 20 !important;
    background: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

.msg-box::-webkit-scrollbar {
    width: 6px;
}
.msg-box::-webkit-scrollbar-track {
    background: #f4f6f6;
    border-radius: 3px;
}
.msg-box::-webkit-scrollbar-thumb {
    background: #c2d6d1;
    border-radius: 3px;
}
.msg-box::-webkit-scrollbar-thumb:hover {
    background: #48a634;
}


.ysx-two-step-form-wrap {
    font-family: "Poppins", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
    color: #333333;
    display: flex;
    flex-direction: column;
    max-height: 88vh;
    box-sizing: border-box;
    background: #ffffff;
}

/* ==========================================================================
   2. Header & Step Progress Bar
   ========================================================================== */
.ysx-form-top-bar {
    padding: 16px 24px 14px;
    background: #ffffff;
    border-bottom: 1px solid #edf2f2;
    flex-shrink: 0;
    position: relative;
}

.ysx-form-title-group {
    padding-right: 36px;
}

.ysx-form-title {
    font-size: 19px;
    font-weight: 700;
    color: #212529;
    margin: 0 0 4px 0;
    line-height: 1.25;
    position: relative;
    padding-bottom: 6px;
}

.ysx-form-title::before {
    content: "";
    width: 46px;
    height: 3px;
    background-color: #ff5500; /* brand orange underline */
    position: absolute;
    left: 0;
    bottom: 0;
    border-radius: 2px;
}

.ysx-form-subtitle {
    font-size: 12px;
    color: #6c757d;
    margin: 0;
    line-height: 1.4;
}

/* Progress bar */
.ysx-step-progress-bar {
    display: flex;
    align-items: center;
    margin-top: 12px;
    gap: 8px;
}

.ysx-step-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #888888;
    font-weight: 500;
}

.ysx-step-item.active {
    color: #48a634;
    font-weight: 700;
}

.ysx-step-item.completed {
    color: #2e7d32;
}

.ysx-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e9ecef;
    color: #666666;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.2s;
}

.ysx-step-item.active .ysx-step-num {
    background: #48a634;
    color: #ffffff;
}

.ysx-step-item.completed .ysx-step-num {
    background: #2e7d32;
    color: #ffffff;
}

.ysx-step-divider {
    flex: 1;
    max-width: 60px;
    height: 2px;
    background: #e2e8e7;
    border-radius: 1px;
}

/* ==========================================================================
   3. Step Panels & Body Scrolling
   ========================================================================== */
.ysx-step-panel {
    padding: 18px 24px 24px;
    overflow-y: auto;
    max-height: calc(88vh - 120px);
    overscroll-behavior: contain;
    box-sizing: border-box;
}

/* Slim modern scrollbar */
.ysx-step-panel::-webkit-scrollbar {
    width: 6px;
}
.ysx-step-panel::-webkit-scrollbar-track {
    background: #f4f6f6;
    border-radius: 3px;
}
.ysx-step-panel::-webkit-scrollbar-thumb {
    background: #c2d6d1;
    border-radius: 3px;
}
.ysx-step-panel::-webkit-scrollbar-thumb:hover {
    background: #48a634;
}

.ysx-section-intro {
    background: #f7faf9;
    border-left: 3px solid #48a634;
    padding: 8px 12px;
    margin-bottom: 16px;
    font-size: 13px;
    border-radius: 0 4px 4px 0;
}

.ysx-section-intro strong {
    display: block;
    color: #212529;
    font-size: 13px;
    margin-bottom: 2px;
}

.ysx-section-intro p {
    margin: 2px 0 0 0;
    color: #48a634;
    font-weight: 600;
    font-size: 12px;
}

.ysx-section-intro span {
    display: block;
    color: #666666;
    font-size: 11.5px;
    line-height: 1.4;
}

/* ==========================================================================
   4. Form Field Groups & Pill Options (Chips)
   ========================================================================== */
.ysx-field-group {
    margin-bottom: 14px;
}

.ysx-label-main {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #222222;
    margin-bottom: 6px;
    line-height: 1.4;
}

.ysx-q-num {
    color: #48a634;
    font-weight: 700;
    margin-right: 2px;
}

.ysx-tag-optional {
    font-size: 11px;
    color: #888888;
    font-weight: 400;
    margin-left: 4px;
}

.ysx-badge-type {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 5px;
    vertical-align: middle;
}

/* Pill / Chip Grid */
.ysx-pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.ysx-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 6px 13px;
    border: 1px solid #d4dedd;
    border-radius: 20px;
    background: #d4dedd;
    color: #555555;
    font-size: 12.5px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    user-select: none;
    line-height: 1.25;
}

.ysx-pill:hover {
    background: #c8d4d3;
    border-color: #c8d4d3;
    color: #333333;
}

.ysx-pill input[type="radio"],
.ysx-pill input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
    margin: 0;
}

/* Checked state using :has or JS fallback */
.ysx-pill.active,
.ysx-pill:has(input:checked) {
    background: #48a634;
    border-color: #48a634;
    color: #ffffff;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(72, 166, 52, 0.28);
}

.ysx-pill.active span,
.ysx-pill input:checked + span {
    color: #ffffff;
}

/* White checkmark on selected pills */
.ysx-pill.active span::after,
.ysx-pill:has(input:checked) span::after {
    content: "";
    display: inline-block;
    width: 4px;
    height: 8px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-left: 7px;
    margin-bottom: 2px;
    vertical-align: middle;
}

/* Text input / textarea */
.ysx-input-text {
    display: block;
    width: 100%;
    height: 38px;
    line-height: 38px;
    padding: 0 10px;
    border: 1px solid #c2d6d1;
    background: #E9F1F1;
    border-radius: 4px;
    font-size: 13px;
    color: #333333;
    box-sizing: border-box;
    transition: all 0.2s;
}

.ysx-input-text:focus {
    background: #ffffff;
    border-color: #48a634;
    outline: none;
    box-shadow: 0 0 0 2px rgba(72, 166, 52, 0.15);
}

.ysx-textarea-control {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #c2d6d1;
    background: #E9F1F1;
    border-radius: 4px;
    font-size: 13px;
    color: #333333;
    resize: vertical;
    box-sizing: border-box;
    line-height: 1.4;
    transition: all 0.2s;
    font-family: inherit;
}

.ysx-textarea-control:focus {
    background: #ffffff;
    border-color: #48a634;
    outline: none;
    box-shadow: 0 0 0 2px rgba(72, 166, 52, 0.15);
}

/* ==========================================================================
   5. Contact Information Block
   ========================================================================== */
.ysx-contact-block {
    background: #f7fbf9;
    border: 1px solid #d4e7e2;
    border-radius: 6px;
    padding: 14px 16px;
    margin-top: 16px;
    margin-bottom: 16px;
}

.ysx-contact-header h4 {
    margin: 0 0 3px 0;
    font-size: 14px;
    font-weight: 700;
    color: #1a4d1a;
}

.ysx-contact-header p {
    margin: 0 0 12px 0;
    font-size: 11.5px;
    color: #666666;
}

.ysx-contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
}

.ysx-grid-full {
    grid-column: 1 / -1;
}

.ysx-input-field {
    display: flex;
    flex-direction: column;
    position: relative;
}

.ysx-input-field label {
    font-size: 12px;
    font-weight: 600;
    color: #444444;
    margin-bottom: 4px;
}

.ysx-req {
    color: #e53935;
    font-style: normal;
    font-weight: bold;
    margin-left: 2px;
}

.ysx-input-control {
    display: block;
    width: 100%;
    height: 38px;
    line-height: 38px;
    padding: 0 10px;
    border: 1px solid #c2d6d1;
    background: #E9F1F1;
    border-radius: 4px;
    font-size: 13px;
    color: #333333;
    box-sizing: border-box;
    transition: all 0.2s;
}

.ysx-input-control:focus {
    background: #ffffff;
    border-color: #48a634;
    outline: none;
    box-shadow: 0 0 0 2px rgba(72, 166, 52, 0.15);
}

.ysx-input-control.ysx-error {
    border-color: #e53935 !important;
    background: #fff8f8 !important;
}

.ysx-field-error {
    display: none;
    font-size: 11px;
    color: #e53935;
    margin-top: 3px;
}

.ysx-field-error.show {
    display: block;
}

/* ==========================================================================
   6. Action Buttons & Spinner
   ========================================================================== */
.ysx-form-actions {
    margin-top: 14px;
}

.ysx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    border-radius: 4px;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    box-sizing: border-box;
    text-decoration: none;
}

.ysx-btn-primary {
    background: #48a634;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(72, 166, 52, 0.25);
}

.ysx-btn-primary:hover {
    background: #3a8c28;
    box-shadow: 0 4px 10px rgba(72, 166, 52, 0.35);
}

.ysx-btn-secondary {
    background: transparent;
    border: 1px solid #b2c9c2;
    color: #555555;
    font-size: 13px;
    height: 38px;
    margin-top: 8px;
}

.ysx-btn-secondary:hover {
    background: #f4f8f7;
    border-color: #8faea4;
    color: #222222;
}

.ysx-step2-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ysx-privacy-note {
    font-size: 11px;
    color: #888888;
    text-align: center;
    margin-top: 8px;
}

.ysx-spinner-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: ysx-spin 0.8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

@keyframes ysx-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   7. Success Screen
   ========================================================================== */
.ysx-success-content {
    text-align: center;
    padding: 30px 15px;
}

.ysx-success-icon-wrap {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px auto;
}

.ysx-checkmark-svg {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #48a634;
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px #48a634;
    animation: ysx-fill .4s ease-in-out .4s forwards, ysx-scale .3s ease-in-out .9s both;
}

.ysx-checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: #48a634;
    fill: none;
    animation: ysx-stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.ysx-checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke: #48a634;
    stroke-width: 3;
    animation: ysx-stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes ysx-stroke {
    100% { stroke-dashoffset: 0; }
}
@keyframes ysx-scale {
    0%, 100% { transform: none; }
    50% { transform: scale3d(1.1, 1.1, 1); }
}
@keyframes ysx-fill {
    100% { box-shadow: inset 0px 0px 0px 30px rgba(72, 166, 52, 0.1); }
}

.ysx-success-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a4d1a;
    margin: 0 0 10px 0;
}

.ysx-success-msg {
    font-size: 13px;
    color: #555555;
    line-height: 1.5;
    max-width: 480px;
    margin: 0 auto 16px auto;
}

.ysx-success-lead-meta {
    background: #f7fbf9;
    border: 1px dashed #b2d6c8;
    padding: 8px 14px;
    display: inline-block;
    border-radius: 4px;
    font-size: 12px;
    color: #216e15;
    margin-bottom: 20px;
}

.ysx-success-actions {
    max-width: 240px;
    margin: 0 auto;
}

/* ==========================================================================
   8. Inline Context Overrides (for /contact-us/ page)
   ========================================================================== */
.contact1-fl .ysx-two-step-form-wrap {
    max-height: none !important;
    background: transparent !important;
}

.contact1-fl .ysx-step-panel {
    max-height: none !important;
    overflow: visible !important;
    padding: 16px 0 0 0 !important;
}

.contact1-fl .ysx-form-top-bar {
    padding: 0 0 14px 0 !important;
    background: transparent !important;
}

.contact1-fl .ysx-form-title-group {
    padding-right: 0 !important;
}

.contact1-fl .ysx-contact-block {
    background: #ffffff !important;
}

.contact1-fl .ysx-section-intro {
    background: #ffffff !important;
}

/* ==========================================================================
   9. Responsive Layout (Mobile screens)
   ========================================================================== */
@media (max-width: 768px) {
    .msg-box {
        width: 95% !important;
        max-height: 90vh !important;
    }

    .ysx-form-top-bar {
        padding: 14px 16px 12px;
    }

    .ysx-form-title {
        font-size: 16px;
    }

    .ysx-step-panel {
        padding: 14px 16px 20px;
        max-height: calc(90vh - 110px);
    }

    .ysx-contact-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .ysx-pill {
        padding: 5px 11px;
        font-size: 12px;
    }

    .ysx-step-label {
        font-size: 11px;
    }
}

/* ==========================================================================
   10. Global Bottom Inquiry Section (non-home, non-contact pages)
   ========================================================================== */
.ysx-bottom-inquiry-section {
    padding: 45px 0 55px 0;
    background: #fbfdfc;
    border-top: 1px solid #e5eeec;
    width: 100%;
    box-sizing: border-box;
}

.ysx-bottom-inquiry-box {
    width: 100%;
    background: #ffffff;
    border: 1px solid #dbe7e4;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    padding: 30px 35px 35px;
    box-sizing: border-box;
}

.ysx-bottom-inquiry-box .ysx-two-step-form-wrap {
    max-height: none !important;
    background: transparent !important;
}

.ysx-bottom-inquiry-box .ysx-step-panel {
    max-height: none !important;
    overflow: visible !important;
    padding: 18px 0 0 0 !important;
}

.ysx-bottom-inquiry-box .ysx-form-top-bar {
    padding: 0 0 16px 0 !important;
    background: transparent !important;
}

.ysx-bottom-inquiry-box .ysx-form-title-group {
    padding-right: 0 !important;
}

@media (max-width: 768px) {
    .ysx-bottom-inquiry-box {
        padding: 20px 14px 25px;
    }
    .ysx-bottom-inquiry-section {
        padding: 30px 0 40px 0;
    }
}
