/* ==========================================================================
   CoinScanX Apply System v2.1
   Light theme — coherente con coinscanx.com
   ========================================================================== */

.csx-apply-wrapper {

    /* === Design Tokens === */
    --csx-bg:           #fef6ec;
    --csx-bg-soft:      #fdf0e0;
    --csx-surface:      #ffffff;
    --csx-surface-2:    #fffaf3;

    --csx-border:       rgba(20, 16, 12, 0.06);
    --csx-border-mid:   rgba(20, 16, 12, 0.10);
    --csx-border-loud:  rgba(20, 16, 12, 0.18);

    --csx-text:         #14100c;
    --csx-text-soft:    #2a241e;
    --csx-text-muted:   #6b6358;
    --csx-text-dim:     #9a9085;
    --csx-text-faint:   #c4bcb0;

    --csx-accent:       #ff5f3e;
    --csx-accent-2:     #ff7b42;
    --csx-accent-hot:   #f04438;
    --csx-accent-soft:  #fff4e8;
    --csx-accent-warm:  rgba(255, 95, 62, 0.08);
    --csx-accent-glow:  rgba(255, 95, 62, 0.28);

    --csx-success:      #1f9d55;
    --csx-success-bg:   #ecfdf3;
    --csx-success-bd:   #b6f0c4;

    --csx-error:        #d11f1f;
    --csx-error-bg:     #fff5f5;
    --csx-error-bd:     #ffd6d6;

    --csx-yellow:       #fcd281;

    --csx-radius:       18px;
    --csx-radius-sm:    12px;
    --csx-radius-lg:    28px;

    /* === Container === */
    position: relative;
    max-width: 640px;
    margin: 80px auto;
    padding: 56px 52px;

    background: var(--csx-surface);
    border: 1px solid var(--csx-border);
    border-radius: var(--csx-radius-lg);

    box-shadow:
        0 1px 2px rgba(20, 16, 12, 0.04),
        0 20px 50px -20px rgba(20, 16, 12, 0.10);

    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--csx-text);

    overflow: hidden;
    isolation: isolate;
}

/* Decoraciones tipo "matriz de puntos" — coherente con tu sitio */
.csx-apply-wrapper::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 200px;
    height: 200px;
    background-image: radial-gradient(circle, var(--csx-yellow) 1.5px, transparent 2px);
    background-size: 14px 14px;
    opacity: 0.45;
    pointer-events: none;
    -webkit-mask-image: radial-gradient(circle at center, black 35%, transparent 70%);
            mask-image: radial-gradient(circle at center, black 35%, transparent 70%);
    z-index: 0;
}

.csx-apply-wrapper::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -60px;
    width: 220px;
    height: 220px;
    background-image: radial-gradient(circle, var(--csx-accent) 1.5px, transparent 2px);
    background-size: 14px 14px;
    opacity: 0.20;
    pointer-events: none;
    -webkit-mask-image: radial-gradient(circle at center, black 30%, transparent 65%);
            mask-image: radial-gradient(circle at center, black 30%, transparent 65%);
    z-index: 0;
}

.csx-grain { display: none; }

.csx-apply-wrapper > *:not(.csx-grain) {
    position: relative;
    z-index: 1;
}


/* ==========================================================================
   PROGRESS BAR
   ========================================================================== */

.csx-progress {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 36px;
    padding-bottom: 24px;
    border-bottom: 1px dashed var(--csx-border-mid);
}

.csx-progress-meta {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--csx-text-dim);
    text-transform: uppercase;
    white-space: nowrap;
}

.csx-step-label    { color: var(--csx-text-dim); }
.csx-step-num      { color: var(--csx-accent); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.csx-step-sep      { color: var(--csx-text-faint); }
.csx-step-total    { color: var(--csx-text-muted); font-weight: 600; font-variant-numeric: tabular-nums; }

.csx-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--csx-bg-soft);
    border-radius: 999px;
    overflow: hidden;
}

.csx-progress-fill {
    height: 100%;
    width: 20%;
    background: linear-gradient(90deg, var(--csx-accent-2), var(--csx-accent));
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ==========================================================================
   HEADER
   ========================================================================== */

.csx-header { margin-bottom: 44px; }

.csx-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    background: var(--csx-accent-soft);
    border: none;
    border-radius: 999px;
    color: var(--csx-accent);
    font-family: 'DM Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.10em;
    margin-bottom: 26px;
    text-transform: uppercase;
}

.csx-pulse {
    width: 6px;
    height: 6px;
    background: var(--csx-accent);
    border-radius: 50%;
    animation: csx-pulse 2.4s ease-in-out infinite;
}

@keyframes csx-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 95, 62, 0.5); opacity: 1; }
    50%      { box-shadow: 0 0 0 7px rgba(255, 95, 62, 0); opacity: 0.7; }
}

.csx-header h1 {
    font-family: 'DM Sans', sans-serif;
    font-size: 44px;
    font-weight: 700;
    line-height: 1.0;
    letter-spacing: -0.035em;
    margin: 0 0 20px 0;
    color: var(--csx-text);
}

.csx-header h1 em {
    font-style: normal;
    background: linear-gradient(135deg, var(--csx-accent-2), var(--csx-accent-hot));
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
}

.csx-header p {
    color: var(--csx-text-muted);
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    max-width: 480px;
    font-weight: 400;
}


/* ==========================================================================
   STEPS
   ========================================================================== */

.csx-step { display: none; }

.csx-step.active {
    display: block;
    animation: csx-step-in 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes csx-step-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.csx-question {
    font-family: 'DM Sans', sans-serif;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 10px 0;
    color: var(--csx-text);
    letter-spacing: -0.02em;
}

.csx-question-help {
    font-size: 14px;
    color: var(--csx-text-muted);
    margin: 0 0 28px 0;
    line-height: 1.55;
    font-weight: 400;
}


/* ==========================================================================
   OPTION CARDS
   ========================================================================== */

.csx-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.csx-option {
    display: block;
    cursor: pointer;
    user-select: none;
}

.csx-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.csx-option-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    background: var(--csx-bg);
    border: 1.5px solid transparent;
    border-radius: var(--csx-radius);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.csx-option-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.csx-option-title {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--csx-text);
    letter-spacing: -0.005em;
}

.csx-option-desc {
    font-size: 13px;
    color: var(--csx-text-muted);
    font-weight: 400;
}

.csx-option-mark {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--csx-border-mid);
    border-radius: 50%;
    transition: all 0.2s ease;
    position: relative;
    background: var(--csx-surface);
}

.csx-option:hover .csx-option-card {
    background: var(--csx-bg-soft);
    border-color: var(--csx-border-mid);
    transform: translateX(2px);
}

.csx-option:hover .csx-option-mark {
    border-color: var(--csx-text-muted);
}

.csx-option input:checked ~ .csx-option-card {
    background: var(--csx-accent-soft);
    border-color: var(--csx-accent);
    box-shadow: 0 4px 16px -4px var(--csx-accent-glow);
}

.csx-option input:checked ~ .csx-option-card .csx-option-mark {
    border-color: var(--csx-accent);
    background: var(--csx-accent);
}

.csx-option input:checked ~ .csx-option-card .csx-option-mark::after {
    content: '';
    position: absolute;
    inset: 4px;
    background: white;
    border-radius: 50%;
}

.csx-option input:focus-visible ~ .csx-option-card {
    outline: 2px solid var(--csx-accent);
    outline-offset: 2px;
}


/* ==========================================================================
   TEXT INPUTS
   ========================================================================== */

.csx-input-group { margin-bottom: 16px; }

.csx-input-group label {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--csx-text-muted);
    margin-bottom: 10px;
}

.csx-required { color: var(--csx-accent); }

.csx-input-group input {
    width: 100%;
    padding: 16px 20px;
    background: var(--csx-bg);
    border: 1.5px solid transparent;
    border-radius: var(--csx-radius);
    color: var(--csx-text);
    font-family: inherit;
    font-size: 15.5px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.csx-input-group input::placeholder {
    color: var(--csx-text-faint);
    font-weight: 400;
}

.csx-input-group input:hover { background: var(--csx-bg-soft); }

.csx-input-group input:focus {
    outline: none;
    border-color: var(--csx-accent);
    background: var(--csx-surface);
    box-shadow: 0 0 0 4px var(--csx-accent-warm);
}

.csx-input-group input.csx-error {
    border-color: var(--csx-error);
    box-shadow: 0 0 0 4px var(--csx-error-bg);
}

.csx-disclaimer {
    font-size: 12.5px;
    color: var(--csx-text-dim);
    margin: 18px 0 0 0;
    line-height: 1.55;
    text-align: center;
}

#csxWebsite {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}


/* ==========================================================================
   NAVIGATION
   ========================================================================== */

.csx-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 36px;
}

.csx-back-btn,
.csx-next-btn,
.csx-submit-btn {
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    padding: 17px 28px;
    border-radius: var(--csx-radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.005em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.csx-back-btn {
    background: var(--csx-bg);
    color: var(--csx-text-muted);
    border: 1.5px solid transparent;
    display: none;
}

.csx-back-btn.show { display: inline-flex; }

.csx-back-btn:hover {
    background: var(--csx-bg-soft);
    color: var(--csx-text);
    border-color: var(--csx-border-mid);
}

.csx-next-btn,
.csx-submit-btn {
    flex: 1;
    background: linear-gradient(135deg, var(--csx-accent-2), var(--csx-accent-hot));
    color: #fff;
    box-shadow: 0 4px 14px -4px var(--csx-accent-glow);
    position: relative;
    overflow: hidden;
}

.csx-next-btn::before,
.csx-submit-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.csx-next-btn:hover,
.csx-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -6px var(--csx-accent-glow);
}

.csx-next-btn:hover::before,
.csx-submit-btn:hover::before { opacity: 1; }

.csx-next-btn:active,
.csx-submit-btn:active { transform: translateY(0); }

.csx-submit-btn { display: none; }
.csx-submit-btn.show { display: inline-flex; }

.csx-submit-btn.loading {
    pointer-events: none;
    opacity: 0.85;
}

.csx-submit-btn.loading .csx-submit-text { opacity: 0; }
.csx-submit-btn.loading .csx-spinner    { opacity: 1; }

.csx-spinner {
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
    animation: csx-spin 0.7s linear infinite;
}

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


/* ==========================================================================
   RESULT
   ========================================================================== */

.csx-result-container { margin-top: 28px; }

.csx-approved,
.csx-rejected {
    padding: 44px 36px;
    border-radius: var(--csx-radius-lg);
    text-align: center;
    animation: csx-result-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes csx-result-in {
    from { opacity: 0; transform: scale(0.96) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.csx-result-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
}

.csx-approved {
    background: var(--csx-success-bg);
    border: 1.5px solid var(--csx-success-bd);
}

.csx-approved .csx-result-icon {
    background: rgba(31, 157, 85, 0.12);
    color: var(--csx-success);
}

.csx-approved h3 {
    font-family: 'DM Sans', sans-serif;
    font-size: 30px;
    font-weight: 700;
    color: var(--csx-text);
    margin: 0 0 12px 0;
    letter-spacing: -0.025em;
    line-height: 1.15;
}

.csx-approved h3 em {
    font-style: normal;
    color: var(--csx-success);
}

.csx-approved > p {
    color: var(--csx-text-muted);
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 26px 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.csx-score-display {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: rgba(31, 157, 85, 0.10);
    border: 1.5px solid var(--csx-success-bd);
    border-radius: 999px;
    margin-bottom: 24px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--csx-success);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.csx-score-display strong {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.csx-approved-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 17px 30px;
    background: var(--csx-text);
    color: #fff !important;
    border-radius: var(--csx-radius);
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px -4px rgba(20, 16, 12, 0.25);
}

.csx-approved-btn:hover {
    background: var(--csx-accent);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -6px var(--csx-accent-glow);
    color: #fff !important;
}

.csx-rejected {
    background: var(--csx-error-bg);
    border: 1.5px solid var(--csx-error-bd);
}

.csx-rejected .csx-result-icon {
    background: rgba(209, 31, 31, 0.10);
    color: var(--csx-error);
}

.csx-rejected h3 {
    font-family: 'DM Sans', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--csx-text);
    margin: 0 0 14px 0;
    letter-spacing: -0.025em;
    line-height: 1.15;
}

.csx-rejected h3 em {
    font-style: normal;
    color: var(--csx-error);
}

.csx-rejected p {
    color: var(--csx-text-muted);
    font-size: 14.5px;
    line-height: 1.6;
    margin: 0 0 12px 0;
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
}

.csx-rejected p:last-of-type { margin-bottom: 0; }

.csx-rejected-score {
    display: inline-block;
    margin-top: 20px;
    padding: 9px 18px;
    background: rgba(209, 31, 31, 0.08);
    border: 1.5px solid var(--csx-error-bd);
    border-radius: 999px;
    font-family: 'DM Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--csx-error);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}


/* ==========================================================================
   INLINE ERROR MESSAGE (aparece dentro del formulario, antes de los botones)
   ========================================================================== */

.csx-inline-error {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 14px 18px;
    background: #fff5f5;
    border: 1.5px solid #ffd6d6;
    border-radius: var(--csx-radius);
    color: #d11f1f;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    border-width: 0;
    transition:
        opacity 0.25s ease,
        max-height 0.35s ease,
        padding 0.35s ease,
        margin-top 0.35s ease,
        border-width 0.25s ease,
        transform 0.25s ease;
}

.csx-inline-error.show {
    opacity: 1;
    max-height: 120px;
    padding-top: 14px;
    padding-bottom: 14px;
    margin-top: 24px;
    border-width: 1.5px;
    animation: csx-error-shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes csx-error-shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-3px); }
    80%      { transform: translateX(3px); }
}

.csx-inline-error-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: #d11f1f;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    font-family: 'DM Sans', sans-serif;
}

.csx-inline-error-text {
    flex: 1;
    color: #7a1414;
    font-weight: 500;
}


/* ==========================================================================
   ERROR TOAST (legacy — kept hidden for backwards compatibility)
   ========================================================================== */

.csx-toast { display: none !important; }


/* ==========================================================================
   MOBILE
   ========================================================================== */

@media (max-width: 768px) {
    .csx-apply-wrapper {
        margin: 24px 14px;
        padding: 36px 26px;
        border-radius: 22px;
    }

    .csx-apply-wrapper::before,
    .csx-apply-wrapper::after {
        width: 140px;
        height: 140px;
    }

    .csx-progress {
        margin-bottom: 28px;
        padding-bottom: 20px;
    }

    .csx-header { margin-bottom: 32px; }
    .csx-header h1 { font-size: 32px; }
    .csx-header p  { font-size: 14px; }

    .csx-question { font-size: 22px; }

    .csx-option-card { padding: 16px 18px; }

    .csx-nav { flex-direction: column-reverse; }

    .csx-back-btn,
    .csx-next-btn,
    .csx-submit-btn { width: 100%; }

    .csx-approved,
    .csx-rejected { padding: 36px 24px; }

    .csx-approved h3,
    .csx-rejected h3 { font-size: 25px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .csx-apply-wrapper *,
    .csx-apply-wrapper *::before,
    .csx-apply-wrapper *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
