/* ============================================================
   SwiftMoney – Apply Form Styles (apply.css)
   Uses existing SwiftMoney design tokens from style_pure.css,
   calculator.css & features.css.
   ============================================================ */

/* ── Variables (SwiftMoney palette) ── */
:root {
    --sm-navy: #0B1D3A;
    --sm-navy-light: #142D54;
    --sm-blue: #79BAEC;
    --sm-blue-accent: #2E6DB4;
    --sm-blue-glow: rgba(121, 186, 236, 0.12);
    --sm-green: #4caf50;
    --sm-green-hover: #45a049;
    --sm-green-light: #a8e4a0;
    --sm-orange: #f26100;
    --sm-bg: #F0F4F8;
    --sm-card-bg: #FFFFFF;
    --sm-border: #D1DAE6;
    --sm-border-focus: #79BAEC;
    --sm-text: #0F172A;
    --sm-text-muted: #475569;
    --sm-text-light: #64748B;
    --sm-radius: 16px;
    --sm-radius-sm: 10px;
    --sm-radius-xs: 8px;
    --sm-shadow-card: 0 2px 12px rgba(11, 29, 58, 0.06);
    --sm-shadow-hover: 0 8px 30px rgba(11, 29, 58, 0.1);
    --sm-transition: 0.25s ease;
}

/* ── Page base ── */
.apply-page {
    background: var(--sm-bg);
    min-height: 100vh;
    padding-bottom: 60px;
}

/* ── Top warning bar ── */
.apply-top-bar {
    background: var(--sm-navy);
    color: rgba(255,255,255,0.9);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 9px 0;
    text-align: center;
    letter-spacing: 0.2px;
}
.apply-top-bar a {
    color: var(--sm-blue) !important;
    text-decoration: underline;
    font-weight: 700;
}
.apply-top-bar a:hover {
    color: #fff !important;
}

/* ── Loan summary strip ── */
.loan-summary-strip {
    background: var(--sm-card-bg);
    border-bottom: 1px solid var(--sm-border);
    padding: 14px 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.loan-summary-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    max-width: 860px;
    margin: 0 auto;
    padding: 0 16px;
}
.loan-summary-info {
    font-size: 1rem;
    font-weight: 500;
    color: var(--sm-text);
}
.loan-summary-info strong {
    color: var(--sm-navy);
    font-weight: 800;
}
.loan-summary-right {
    display: flex;
    align-items: center;
    gap: 14px;
}
.btn-loan-change {
    background: var(--sm-green);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 7px 24px;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: Montserrat, sans-serif;
    cursor: pointer;
    transition: background var(--sm-transition);
    box-shadow: 0 2px 8px rgba(76,175,80,0.25);
}
.btn-loan-change:hover {
    background: var(--sm-green-hover);
}
.ssl-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--sm-text-light);
    font-weight: 600;
}
.ssl-indicator .ssl-icon {
    width: 22px;
    height: 22px;
    background: var(--sm-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ssl-indicator .ssl-icon svg {
    width: 12px;
    height: 12px;
    fill: #fff;
    stroke: none;
}

/* ── Form wrapper ── */
.apply-form-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

/* ── Section cards (feature-card style from features.css) ── */
.apply-section {
    background: var(--sm-card-bg);
    border: 1px solid var(--sm-border);
    border-radius: var(--sm-radius);
    padding: 36px 32px 30px;
    margin-bottom: 22px;
    box-shadow: var(--sm-shadow-card);
    transition: box-shadow var(--sm-transition), border-color var(--sm-transition);
    animation: fadeUp 0.5s ease both;
}
.apply-section:nth-child(1) { animation-delay: 0.05s; }
.apply-section:nth-child(2) { animation-delay: 0.10s; }
.apply-section:nth-child(3) { animation-delay: 0.15s; }
.apply-section:nth-child(4) { animation-delay: 0.20s; }
.apply-section:nth-child(5) { animation-delay: 0.25s; }
.apply-section:nth-child(6) { animation-delay: 0.30s; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Section title (mirrors features icon-wrap style) ── */
.apply-section-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 26px;
}
.apply-section-num {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    border: 2px solid var(--sm-blue-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sm-blue-glow);
    box-shadow: 0 0 0 5px rgba(46, 109, 180, 0.06);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--sm-navy);
    transition: background 0.3s, box-shadow 0.3s;
}
.apply-section:hover .apply-section-num {
    background: rgba(46, 109, 180, 0.18);
    box-shadow: 0 0 0 8px rgba(46, 109, 180, 0.08);
}
.apply-section-title h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--sm-navy);
    margin: 0;
    letter-spacing: -0.3px;
}
.apply-section-title h2 .hl {
    position: relative;
    display: inline;
}
.apply-section-title h2 .hl::after {
    content: '';
    position: absolute;
    left: -3px;
    right: -3px;
    bottom: 0;
    height: 8px;
    background: rgba(121,186,236,0.3);
    border-radius: 2px;
    z-index: -1;
}

/* ── Field groups ── */
.apply-field {
    margin-bottom: 22px;
}
.apply-field:last-child {
    margin-bottom: 0;
}
.apply-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--sm-text);
    margin-bottom: 10px;
    letter-spacing: 0.1px;
}
.apply-hint {
    font-size: 0.78rem;
    color: var(--sm-text-light);
    margin-top: 6px;
    font-weight: 500;
}
.apply-hint em {
    font-style: italic;
    color: var(--sm-blue-accent);
}

/* ── Card-select buttons ── */
.card-select {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.card-select .card-opt {
    flex: 1 1 calc(33.333% - 10px);
    min-width: 120px;
    border: 2px solid var(--sm-border);
    border-radius: var(--sm-radius-xs);
    padding: 14px 10px;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: Montserrat, sans-serif;
    color: var(--sm-text);
    cursor: pointer;
    background: var(--sm-card-bg);
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}
.card-select .card-opt:hover {
    border-color: var(--sm-blue);
    background: var(--sm-blue-glow);
}
.card-select .card-opt.active {
    border-color: var(--sm-blue-accent);
    background: var(--sm-blue-glow);
    color: var(--sm-navy);
    box-shadow: 0 0 0 1px var(--sm-blue-accent);
}
.card-select .card-opt.active::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 8px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--sm-blue-accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' d='M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
}

/* Column variants */
.card-select.cs-2 .card-opt  { flex: 1 1 calc(50% - 10px); }
.card-select.cs-4 .card-opt  { flex: 1 1 calc(25% - 10px); min-width: 80px; }

/* Icon card options (loan purpose) */
.card-opt .card-opt-icon {
    font-size: 1.7rem;
    margin-bottom: 4px;
    display: block;
    line-height: 1.2;
}
.card-opt .card-opt-label {
    font-size: 0.82rem;
    line-height: 1.3;
}

/* ── Range card select (expenses) ── */
.card-select.range-cards .card-opt {
    padding: 12px 8px;
    font-size: 0.84rem;
    min-width: 100px;
}

/* ── Text inputs (consistent with calculator panel style) ── */
.apply-input {
    width: 100%;
    border: 2px solid var(--sm-border);
    border-radius: var(--sm-radius-xs);
    padding: 12px 14px;
    font-size: 0.92rem;
    font-family: Montserrat, sans-serif;
    font-weight: 500;
    color: var(--sm-text);
    background: var(--sm-card-bg);
    transition: border-color var(--sm-transition), box-shadow var(--sm-transition);
    outline: none;
}
.apply-input:focus {
    border-color: var(--sm-blue);
    box-shadow: 0 0 0 3px rgba(121,186,236,0.15);
}
.apply-input::placeholder {
    color: #aab4c2;
    font-weight: 400;
}

/* ── DOB group ── */
.dob-row {
    display: flex;
    gap: 10px;
}
.dob-row .apply-input {
    flex: 1;
    text-align: center;
}

/* ── Sort code group ── */
.sortcode-row {
    display: flex;
    gap: 8px;
}
.sortcode-row .apply-input {
    flex: 1;
    text-align: center;
}

/* ── Postcode row ── */
.postcode-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}
.postcode-row .apply-input {
    flex: 1;
}
.btn-find-address {
    background: var(--sm-navy);
    color: #fff;
    border: none;
    border-radius: var(--sm-radius-xs);
    padding: 12px 24px;
    font-weight: 700;
    font-size: 0.88rem;
    font-family: Montserrat, sans-serif;
    cursor: pointer;
    transition: background var(--sm-transition);
    white-space: nowrap;
}
.btn-find-address:hover {
    background: var(--sm-navy-light);
}
.link-manual {
    color: var(--sm-blue-accent);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    margin-top: 6px;
    display: inline-block;
}
.link-manual:hover {
    color: var(--sm-navy);
}

/* ── More info link ── */
.more-info-link {
    color: var(--sm-blue-accent);
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    margin-top: 5px;
    display: inline-block;
}
.more-info-link:hover {
    color: var(--sm-navy);
}

/* ── Currency input ── */
.currency-wrap {
    position: relative;
}
.currency-wrap .currency-sign {
    position: absolute;
    left: 1px;
    top: 1px;
    bottom: 1px;
    width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sm-bg);
    border-radius: var(--sm-radius-xs) 0 0 var(--sm-radius-xs);
    font-weight: 700;
    color: var(--sm-text-muted);
    font-size: 0.95rem;
    border-right: 2px solid var(--sm-border);
    pointer-events: none;
}
.currency-wrap .apply-input {
    padding-left: 52px;
}

/* ── Select dropdown ── */
.select-wrap {
    position: relative;
}
.select-wrap::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%23475569' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
}
.apply-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 38px;
    cursor: pointer;
}

/* ── Grid rows ── */
.fields-row {
    display: grid;
    gap: 16px;
}
.fields-row.fr-2 { grid-template-columns: 1fr 1fr; }
.fields-row.fr-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Communication option toggles ── */
.comm-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.comm-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid var(--sm-border);
    border-radius: var(--sm-radius-xs);
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    justify-content: center;
    min-width: 100px;
    background: var(--sm-card-bg);
}
.comm-opt:hover {
    border-color: var(--sm-blue);
}
.comm-opt.active {
    border-color: var(--sm-blue-accent);
    background: var(--sm-blue-glow);
}
.comm-dot {
    width: 18px;
    height: 18px;
    border: 2px solid var(--sm-border);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s;
}
.comm-opt.active .comm-dot {
    border-color: var(--sm-blue-accent);
}
.comm-opt.active .comm-dot::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    background: var(--sm-blue-accent);
    border-radius: 50%;
}

/* ── T&C section ── */
.tc-section {
    background: var(--sm-card-bg);
    border-radius: var(--sm-radius);
    padding: 28px 32px;
    margin-bottom: 22px;
    border: 1px solid var(--sm-border);
    box-shadow: var(--sm-shadow-card);
}
.tc-section h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--sm-navy);
    margin-bottom: 16px;
}
.tc-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
    cursor: pointer;
}
.tc-row:last-child { margin-bottom: 0; }
.tc-box {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--sm-border);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-top: 2px;
}
.tc-row.checked .tc-box {
    background: var(--sm-blue-accent);
    border-color: var(--sm-blue-accent);
}
.tc-row.checked .tc-box::after {
    content: '';
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' d='M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
}
.tc-text {
    font-size: 0.84rem;
    color: var(--sm-text-muted);
    line-height: 1.55;
    font-weight: 500;
}
.tc-text a {
    color: var(--sm-blue-accent) !important;
    text-decoration: underline;
    font-weight: 700;
}

/* ── Apply Now button (btn-gradient style from style_pure.css) ── */
.btn-apply-now {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    max-width: 360px;
    margin: 32px auto 0;
    background: var(--sm-green);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 16px 36px;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: Montserrat, sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(76,175,80,0.3);
    position: relative;
    overflow: hidden;
}
.btn-apply-now:hover {
    background: var(--sm-green-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(76,175,80,0.4);
}
.btn-apply-now:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(76,175,80,0.3);
}
.btn-apply-now .icon-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.2);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
}
.btn-apply-now .icon-circle svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

/* ── Validation tick ── */
.apply-field {
    position: relative;
}
.valid-tick {
    display: none;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    background: var(--sm-blue-accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' d='M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(46,109,180,0.25);
    animation: tickPop 0.3s ease both;
}
@keyframes tickPop {
    0%   { transform: scale(0); opacity: 0; }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}
.apply-field.is-valid .valid-tick,
.fields-row .apply-field.is-valid .valid-tick {
    display: inline-flex;
}
.apply-field.is-valid .apply-input,
.apply-field.is-valid .apply-select {
    border-color: var(--sm-blue-accent);
}

/* ── Error / invalid state ── */
.error-tick {
    display: none;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    background: #e53e3e;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' d='M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(229,62,62,0.25);
    animation: tickPop 0.3s ease both;
}
.apply-field.is-invalid .error-tick {
    display: inline-flex;
}
.apply-field.is-invalid .valid-tick {
    display: none;
}
.apply-field.is-invalid .apply-input,
.apply-field.is-invalid .apply-select {
    border-color: #e53e3e;
    box-shadow: 0 0 0 3px rgba(229,62,62,0.1);
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .apply-section {
        padding: 24px 18px 22px;
    }
    .fields-row.fr-2,
    .fields-row.fr-3 {
        grid-template-columns: 1fr;
    }
    .card-select .card-opt {
        flex: 1 1 calc(50% - 10px);
        min-width: 100px;
    }
    .card-select.cs-4 .card-opt {
        flex: 1 1 calc(50% - 10px);
    }
    .card-select.range-cards .card-opt {
        flex: 1 1 calc(50% - 10px);
    }
    .apply-section-title h2 {
        font-size: 1.15rem;
    }
    .btn-apply-now {
        font-size: 1.1rem;
        padding: 14px 28px;
    }
    .tc-section {
        padding: 22px 18px;
    }
}
