/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    min-height: 100vh;
    padding: 0;
    color: #333;
}

/* Header */
.custom-headerbar {
    background-color: #ffffff;
    padding: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-img {
    height: 60px;
    width: auto;
}

.reviews-badge {
    display: block;
}

.reviews-badge img {
    height: 50px;
    width: auto;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Progress Bar */
.progress-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1e3a8a 0%, #3b82f6 100%);
    border-radius: 10px;
    transition: width 0.4s ease;
    width: 14.28%;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #666;
}

/* Form Wrapper */
.form-wrapper {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    margin-bottom: 30px;
}

/* Form Steps */
.form-step {
    display: none;
    animation: fadeIn 0.4s ease;
}

.form-step.active {
    display: block;
}

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

/* Typography */
h1 {
    font-size: 42px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 10px;
    line-height: 1.2;
}

h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 10px;
}

h3.subsection-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e3a8a;
    margin: 30px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.step-description {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    padding: 20px 0;
}

.welcome-title {
    font-size: 36px;
    font-weight: 700;
    color: #1e3a8a;
    margin-bottom: 15px;
    line-height: 1.2;
}

.welcome-subtitle {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

.welcome-text {
    font-size: 17px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 35px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.benefits-grid {
    display: grid;
    gap: 15px;
    margin: 35px auto;
    max-width: 500px;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f8f9fa;
    padding: 16px 20px;
    border-radius: 10px;
    text-align: left;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.benefit-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.benefit-item .checkmark {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 18px;
}

.benefit-item span:not(.checkmark) {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.btn-start {
    margin-top: 20px;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-divider {
    grid-column: 1 / -1;
    height: 1px;
    background: linear-gradient(to right, transparent, #e0e0e0, transparent);
    margin: 20px 0;
}

.date-select-group {
    display: grid;
    grid-template-columns: 1fr 2fr 1.5fr;
    gap: 10px;
}

.date-select-group select {
    width: 100%;
}

/* Form Elements */
label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

.optional-label {
    font-size: 15px;
    font-weight: 600;
    color: #1e3a8a;
    margin-top: 10px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

input[type="date"] {
    cursor: pointer;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Removed automatic invalid styling - validation is handled by JavaScript only
input[type="text"]:invalid:not(:placeholder-shown),
input[type="email"]:invalid:not(:placeholder-shown),
input[type="tel"]:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}
*/

/* Postcode Lookup */
.postcode-lookup {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.postcode-lookup input {
    flex: 1;
}

.postcode-lookup .btn {
    flex-shrink: 0;
}

#person_1_address_select,
#address_1_address_select {
    margin-top: 10px;
    margin-bottom: 15px;
}

/* Radio Groups */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    justify-content: center;
}

.radio-option:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.radio-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: #1e3a8a;
}

.radio-option:has(input:checked) {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

/* Checkbox Container */
.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.checkbox-container:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3b82f6;
    margin-top: 2px;
    flex-shrink: 0;
    transform: scale(0.7);
}

.checkbox-label {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}

/* Signature Section */
.signature-section {
    margin-bottom: 30px;
}

.signature-hint {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-style: italic;
}

.signature-container {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    margin: 15px 0;
    width: 100%;
    max-width: 600px;
    height: 200px;
    position: relative;
    touch-action: none;
}

#signaturePad {
    cursor: crosshair;
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* Buttons */
.btn {
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.btn-secondary:hover {
    background: #e8e8e8;
}

.btn-large {
    padding: 18px 48px;
    font-size: 18px;
}

.btn-small {
    padding: 10px 20px;
    font-size: 14px;
    background: #f5f5f5;
    color: #666;
}

.btn-small:hover {
    background: #e8e8e8;
}

.button-group {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    margin-top: 30px;
}

/* Info Boxes */
.info-box {
    background: #fff7ed;
    border-left: 4px solid #f59e0b;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.info-box p {
    font-size: 14px;
    line-height: 1.6;
    color: #78350f;
    margin-bottom: 10px;
}

.info-box p:last-child {
    margin-bottom: 0;
}

.info-box strong {
    color: #92400e;
}

/* Terms Section */
.terms-section {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.terms-section a {
    color: #1e3a8a;
    text-decoration: none;
    font-weight: 600;
}

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

.document-list {
    background: #f9fafb;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.document-list p {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.document-list ul {
    margin-left: 20px;
}

.document-list li {
    margin-bottom: 8px;
    color: #555;
}

/* Footer */
.custom-bottombar {
    background-color: #1e293b;
    color: #e2e8f0;
    padding: 40px 20px;
    margin-top: 0;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-container p {
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 15px;
    color: #cbd5e1;
}

.footer-container .copyright {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 20px;
    font-weight: 600;
    color: #e2e8f0;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #60a5fa;
    text-decoration: underline;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-dialog {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
}

.modal-content {
    background: white;
    border-radius: 12px;
    animation: modalFadeIn 0.3s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-content-small {
    background: white;
    padding: 40px;
    border-radius: 16px;
    max-width: 500px;
    text-align: center;
    animation: modalFadeIn 0.3s ease;
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    color: #1e3a8a;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #1e3a8a;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    max-height: 60vh;
}

.modal-body h4 {
    font-size: 20px;
    color: #1e3a8a;
    margin-bottom: 15px;
}

.modal-body h5 {
    font-size: 16px;
    color: #1e3a8a;
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: 600;
}

.modal-body p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #4b5563;
}

.modal-body ul,
.modal-body ol {
    margin-left: 25px;
    margin-bottom: 15px;
}

.modal-body li {
    margin-bottom: 8px;
    line-height: 1.6;
    color: #4b5563;
}

.modal-body .fee-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.modal-body .fee-table th,
.modal-body .fee-table td {
    border: 1px solid #e5e7eb;
    padding: 12px;
    text-align: left;
}

.modal-body .fee-table th {
    background-color: #f3f4f6;
    font-weight: 600;
    color: #1e3a8a;
}

.modal-body .scroll-notice {
    text-align: center;
    color: #9ca3af;
    font-style: italic;
    margin-top: 20px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 18px;
    font-weight: 500;
}

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
    body {
        padding: 0;
        background: #f5f7fa;
    }

    .header-container {
        padding: 0 15px;
    }

    .logo-img {
        height: 45px;
    }

    .reviews-badge {
        display: none;
    }

    .container {
        padding: 10px;
    }

    .form-wrapper {
        padding: 25px 18px;
        border-radius: 12px;
    }

    h1 {
        font-size: 32px;
    }

    h2 {
        font-size: 24px;
    }

    .welcome-title {
        font-size: 32px;
    }

    .welcome-subtitle {
        font-size: 22px;
    }

    .welcome-text {
        font-size: 16px;
        padding: 0 10px;
    }

    .welcome-section {
        padding: 10px 0;
    }

    .benefits-grid {
        margin: 25px auto;
    }

    .benefit-item {
        padding: 14px 16px;
    }

    .benefit-item span:not(.checkmark) {
        font-size: 15px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .form-group.full-width {
        grid-column: 1;
    }

    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    select {
        padding: 16px;
        font-size: 16px;
    }

    label {
        font-size: 15px;
        margin-bottom: 10px;
    }

    .radio-group {
        flex-direction: column;
        gap: 12px;
    }

    .radio-option {
        padding: 16px 20px;
    }

    .button-group {
        flex-direction: column-reverse;
        gap: 12px;
        margin-top: 25px;
    }

    .button-group .btn {
        width: 100%;
        padding: 16px 24px;
        font-size: 17px;
    }

    .btn-large {
        padding: 18px 40px;
        font-size: 18px;
        width: 100%;
    }

    .signature-container {
        height: 200px;
        max-width: 100%;
    }

    #signaturePad {
        width: 100%;
        height: 100%;
    }

    .progress-container {
        padding: 15px;
        margin-bottom: 20px;
    }

    .step-description {
        font-size: 15px;
        margin-bottom: 25px;
    }

    .date-select-group {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
    }

    .modal-dialog {
        margin: 0;
        padding: 0;
    }

    .modal-body {
        max-height: 70vh;
        padding: 20px;
    }

    .modal-header {
        padding: 15px 20px;
    }

    .modal-footer {
        padding: 15px 20px;
    }

    .footer-links {
        flex-direction: column;
        gap: 15px;
    }

    .info-box {
        padding: 15px;
        font-size: 13px;
    }

    .terms-section {
        font-size: 13px;
    }

    .document-list {
        padding: 15px;
        font-size: 13px;
    }

    .checkbox-container {
        padding: 14px;
    }

    .checkbox-label {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .welcome-title {
        font-size: 28px;
    }

    .welcome-subtitle {
        font-size: 20px;
    }

    .welcome-text {
        font-size: 15px;
    }

    .benefit-item {
        padding: 12px 14px;
    }

    .benefit-item span:not(.checkmark) {
        font-size: 14px;
    }

    .benefit-item .checkmark {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .postcode-lookup {
        flex-direction: column;
    }

    .postcode-lookup .btn {
        width: 100%;
    }

    h2 {
        font-size: 22px;
    }

    .btn-large {
        font-size: 17px;
        padding: 16px 32px;
    }
}

/* Touch-friendly tap targets for mobile */
@media (hover: none) and (pointer: coarse) {
    button,
    select,
    input[type="radio"],
    input[type="checkbox"],
    a {
        min-height: 44px;
        min-width: 44px;
    }

    .radio-option {
        min-height: 50px;
    }

    .checkbox-container {
        min-height: 50px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .progress-container,
    .button-group,
    .custom-headerbar,
    .custom-bottombar {
        display: none;
    }
}

/* Error Shake Animation */
@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.error-shake {
    animation: errorShake 0.5s ease;
}

.field-error {
    border: 2px solid #ef4444 !important;
    border-color: #ef4444 !important;
}
