:root {
    --primary-color: #2c5282;
    --secondary-color: #2d3748;
    --accent-color: #38a169;
    --background-color: #f7fafc;
    --text-color: #4a5568;
    --white: #ffffff;
    --border-color: #e2e8f0;
    --error-color: #e53e3e;
    --font-family: 'Poppins', sans-serif;
}
body, html { margin: 0; padding: 0; font-family: var(--font-family); background-color: var(--background-color); color: var(--text-color); box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
.main-container { max-width: 800px; margin: 1rem auto; padding: 1rem; background-color: var(--white); border-radius: 12px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08); }
.form-step { display: none; animation: fadeIn 0.5s ease-in-out; }
.form-step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
h1, h2 { color: var(--primary-color); text-align: center; margin-top: 0; margin-bottom: 1rem; }
p { line-height: 1.7; text-align: center; margin-bottom: 1.5rem; }
.icon-header { display: block; font-size: 3rem; color: var(--accent-color); text-align: center; margin-bottom: 1rem; }
.btn { display: block; width: 100%; padding: 14px 20px; border: none; border-radius: 8px; cursor: pointer; font-size: 1rem; font-weight: 600; text-align: center; transition: background-color 0.3s, transform 0.2s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background-color: var(--accent-color); color: var(--white); }
.btn-primary:hover { background-color: #2f855a; }
.btn-primary:disabled { background-color: #a0aec0; cursor: not-allowed; }
.btn-secondary { background-color: var(--border-color); color: var(--secondary-color); }
.btn-secondary:hover { background-color: #cbd5e0; }
.intro-content { margin-bottom: 2rem; }
.benefits ul { list-style: none; padding: 0; margin: 2.5rem 0; }
.benefits li { display: flex; align-items: center; gap: 16px; margin-bottom: 1.75rem; }
.benefits li i { color: var(--accent-color); font-size: 1.5rem; flex-shrink: 0; width: 30px; display: flex; justify-content: center; align-items: center; }
.benefits li strong { display: block; font-weight: 600; color: var(--secondary-color); margin-bottom: 2px; }
.benefits li p { margin: 0; text-align: left; line-height: 1.6; color: var(--text-color); }
#preset-buttons-container { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1.5rem; }
.preset-button { padding: 8px 12px; font-size: 0.875rem; font-weight: 600; background-color: var(--white); color: var(--primary-color); border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer; transition: background-color 0.2s, color 0.2s, border-color 0.2s; }
.preset-button:hover { background-color: #eef2f7; border-color: #a0aec0; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.form-group { margin-bottom: 1.5rem; }
label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: var(--secondary-color); }
input[type="text"], input[type="number"], input[type="email"], input[type="date"] { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 1rem; transition: border-color 0.3s, box-shadow 0.3s; }
input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1); }
.input-with-symbol { position: relative; }
.input-with-symbol span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-color); font-weight: 600; }
.input-with-symbol input { padding-left: 30px; }
.radio-group { display: flex; gap: 1rem; border: 1px solid var(--border-color); border-radius: 8px; padding: 8px; }
.radio-group label { display: flex; align-items: center; flex: 1; padding: 8px 12px; cursor: pointer; border-radius: 6px; transition: background-color 0.3s; font-weight: 500; }
.radio-group input { margin-right: 8px; }
.radio-group label:has(input:checked) { background-color: #e6f6eb; color: var(--accent-color); }
.terms-checkbox { display: flex; align-items: center; }
.terms-checkbox label { margin: 0 0 0 0.5rem; font-weight: 500; }
#payment-form { border: 1px solid var(--border-color); border-radius: 8px; padding: 1.5rem; margin: 2rem 0; }
.spinner { display: inline-block; border: 2px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: var(--white); width: 16px; height: 16px; animation: spin 1s ease-in-out infinite; }
.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-message { color: var(--error-color); font-size: 0.875rem; margin-top: 0.5rem; min-height: 1.2em; }
.report-content .container { background-color: transparent !important; padding: 0 !important; }
footer { text-align: center; padding: 2rem 1rem; color: #a0aec0; font-size: 0.9rem; }
.wizard-progress { position: relative; margin-bottom: 2.5rem; }
.progress-steps { display: flex; justify-content: space-between; padding: 0; margin: 0 0 8px 0; list-style-type: none; }
.progress-step { position: relative; font-weight: 500; color: #a0aec0; flex: 1; text-align: center; font-size: 0.9rem; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.progress-step .step-icon { font-size: 0.75rem; color: #cbd5e0; transition: all 0.3s ease; }
.progress-step.active { font-weight: 700; color: var(--primary-color); }
.progress-step.active .step-icon { color: var(--primary-color); }
.progress-step.completed .step-icon { color: var(--accent-color); }
.progress-step.completed .step-icon::before { content: "\f058"; }
.progress-bar { position: absolute; top: 120%; left: 0; height: 4px; width: 0%; background-color: var(--accent-color); z-index: 1; transition: width 0.4s ease; border-radius: 2px; }
.progress-bar::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--border-color); z-index: -1; border-radius: 2px; }
.wizard-step { display: none; animation: fadeIn 0.5s ease-in-out; }
.wizard-step.active { display: block; }
.wizard-step h2 { text-align: left; }
.wizard-step p { text-align: left; font-size: 1rem; color: var(--text-color); }
.wizard-navigation { display: flex; justify-content: space-between; margin-top: 2rem; border-top: 1px solid var(--border-color); padding-top: 1.5rem; }
.wizard-navigation .btn { width: auto; min-width: 120px; }
.input-with-helper { position: relative; display: flex; align-items: center; }
.input-with-helper input { flex-grow: 1; }
.tooltip-trigger { position: absolute; right: 10px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid #a0aec0; background-color: var(--white); color: #a0aec0; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.tooltip-trigger:hover { background-color: #f7fafc; }
.tooltip-content { display: none; position: fixed; width: min(280px, 90vw); max-height: 50vh; overflow-y: auto; z-index: 9999; padding: 12px; background-color: var(--secondary-color); color: var(--white); border-radius: 8px; font-size: 0.875rem; line-height: 1.6; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.report-tabs { display: flex; justify-content: center; gap: 10px; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; }
.report-tab-button { padding: 10px 15px; cursor: pointer; border: none; border-bottom: 3px solid transparent; background-color: transparent; font-size: 1rem; font-weight: 500; color: var(--text-color); transition: all 0.3s ease; }
.report-tab-button:hover { color: var(--primary-color); }
.report-tab-button.active { color: var(--primary-color); font-weight: 600; border-bottom: 3px solid var(--primary-color); }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-in-out;
}

.modal.active {
    display: block;
}

.modal-content {
    background-color: var(--white);
    margin: 2% auto;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease-in-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-color);
    text-align: left;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #a0aec0;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--error-color);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-body h3 {
    color: var(--primary-color);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    text-align: left;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.modal-body ul {
    margin: 0.75rem 0 1rem 1.5rem;
    line-height: 1.7;
}

.modal-body ul li {
    margin-bottom: 0.5rem;
}

.modal-body a {
    color: var(--accent-color);
    text-decoration: none;
}

.modal-body a:hover {
    text-decoration: underline;
}

.terms-update {
    font-size: 0.875rem;
    color: #a0aec0;
    font-style: italic;
    margin-top: 2rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    background-color: #f7fafc;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.modal-footer .btn {
    width: auto;
    flex: 1;
}

/* Terms link styling */
.terms-checkbox a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.terms-checkbox a:hover {
    text-decoration: underline;
}

/* ── Mobile first (default, <768px) ── */
body {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-tap-highlight-color: transparent;
    /* Prevent browsers from scaling text/layout on orientation change */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
.main-container {
    padding: 1rem;
    overflow-x: hidden;
    margin: 0.5rem;
    border-radius: 8px;
}

/* Safe area padding for notched iPhones */
@supports (padding: env(safe-area-inset-left)) {
    .main-container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    .modal-content {
        margin-left: max(5%, env(safe-area-inset-left));
        margin-right: max(5%, env(safe-area-inset-right));
        width: auto;
    }
}

/* Minimum 44px touch targets on all interactive elements */
.btn { min-height: 44px; }
.wizard-navigation .btn { min-height: 44px; }
.tooltip-trigger { width: 44px; height: 44px; border-radius: 50%; }
.terms-checkbox { min-height: 44px; align-items: center; }
.terms-checkbox input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; flex-shrink: 0; }
.radio-group label { min-height: 44px; display: flex; align-items: center; }

/* Active states for touch feedback */
.btn:active { opacity: 0.85; transform: none; }
.preset-button:active { background-color: #eef2f7; }

/* Landscape mobile: reduce vertical spacing so content doesn't feel cramped */
@media (max-height: 500px) and (orientation: landscape) {
    .main-container { margin: 0.25rem; }
    h1 { font-size: 1.4rem; margin-bottom: 0.5rem; }
    h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
    .intro-content { margin-bottom: 1rem; }
    .benefits ul { margin: 1rem 0; }
    .benefits li { margin-bottom: 0.75rem; }
    .form-group { margin-bottom: 0.75rem; }
    .wizard-progress { margin-bottom: 1rem; }
    .wizard-navigation { margin-top: 1rem; padding-top: 0.75rem; }
}

input[type="text"], input[type="number"], input[type="email"], input[type="date"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: block;
    font-size: 16px; /* Prevents iOS Safari auto-zoom on focus */
}

/* Prevent date input native chrome overflowing on iOS/Android */
input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
}

/* Card payment fields stack on mobile */
.card-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.card-fields-grid .card-postcode {
    grid-column: 1 / -1;
}

/* Form columns stack on mobile */
.form-column { width: 100%; }

/* Progress steps: smaller text on mobile */
.progress-step { font-size: 0.75rem; }
.progress-step .step-text { display: none; }

/* Wizard nav buttons: equal width, sensible size */
.wizard-navigation .btn { min-width: 90px; font-size: 0.9rem; padding: 12px 16px; }

/* ── Tablet and above (≥768px) ── */
@media (min-width: 768px) {
    .main-container { padding: 3rem; margin: 2rem auto; }
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .card-fields-grid { grid-template-columns: 1fr 1fr 1fr; }
    .card-fields-grid .card-postcode { grid-column: auto; }
    .progress-step .step-text { display: inline; }
    .wizard-navigation .btn { min-width: 120px; font-size: 1rem; padding: 14px 20px; }
}
@media print {
    body * { visibility: hidden; }
    #report-container, #report-container * { visibility: visible; }
    #report-container { position: absolute; top: 0; left: 0; width: 100%; }
    .report-actions, #backToStartButton { display: none !important; }
}
