/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #FF8A00;
    --primary-light: #ED751C;
    --primary-dark: #0a2a31;
    --accent: #ED751C;
    --accent-light: #f5a14e;
    --accent-dark: #c65c00;
    --red: #e63946;
    --white: #FFFFFF;
    --light: #F8FAFC;
    --dark: #0A1929;
    --text: #333333;
    --text-light: #666666;
    --card-bg: #FFFFFF;
    --border-color: #E5E7EB;
    --shadow: 0 10px 30px rgba(17, 55, 65, 0.1);
    --shadow-hover: 0 20px 40px rgba(17, 55, 65, 0.15);
    --card-border-radius: 12px;
    --card-padding: 25px;
    --card-shadow: 0 10px 30px rgba(17, 55, 65, 0.08);
    --card-shadow-hover: 0 20px 40px rgba(17, 55, 65, 0.15);
    --transition: all 0.3s ease;
}

body {
    background-color: #f4f7f6;
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
    color: var(--text);
}

.agreement-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 0;
    background-color: transparent;
    box-shadow: none;
}

/* Step Indicator Styles */
.step-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
    padding: 0 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.step-indicator::before {
    content: "";
    position: absolute;
    top: 24px;
    left: 50px;
    right: 50px;
    height: 4px;
    background-color: #e0e0e0;
    z-index: 0;
    border-radius: 4px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

.step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #e0e0e0;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    border: 3px solid white;
}

.step.active .step-number {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    transform: scale(1.15);
    box-shadow: 0 6px 12px rgba(237, 117, 28, 0.25);
}

.step.completed .step-number {
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: white;
}

.step.completed .step-number::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.step-text {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
    transition: var(--transition);
    text-align: center;
    max-width: 100px;
}

.step.active .step-text {
    color: var(--primary);
    font-weight: 600;
}

/* Form Container Styles */
.form-container {
    background-color: var(--white);
    border-radius: var(--card-border-radius);
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.form-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--accent));
}

.form-container h2 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    position: relative;
    font-family: 'Poppins', sans-serif;
}

.form-subtitle {
    color: var(--text-light);
    font-size: 16px;
    text-align: center;
    margin-bottom: 30px;
}

.form-container h3 {
    color: var(--primary);
    margin: 20px 0 10px;
    font-size: 20px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
}

/* Broker Info Card (Step 1) */
.broker-info-card {
    background-color: var(--light);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.broker-info-header {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    padding: 20px;
    color: white;
}

.broker-info-header h3 {
    color: white;
    margin: 0 0 5px;
    font-size: 20px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
}

.decorative-line {
    width: 60px;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
}

.broker-info-content {
    padding: 20px;
}

.broker-info-row {
    display: flex;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.broker-info-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.broker-info-label {
    flex: 0 0 150px;
    font-weight: 600;
    color: var(--primary);
}

.broker-info-value {
    flex: 1;
    color: var(--text);
}

/* Carrier Form Styles */
.form-section-title {
    display: flex;
    align-items: center;
    margin: 30px 0 20px;
}

.form-section-title h3 {
    margin: 0 15px 0 0;
    font-family: 'Poppins', sans-serif;
}

.form-section-title .decorative-line {
    flex: 1;
    background: linear-gradient(to right, var(--primary), var(--accent-light));
    height: 2px;
    opacity: 0.5;
}

.carrier-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-field {
    margin-bottom: 0;
}

.form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
    font-size: 15px;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: var(--transition);
    font-family: 'Poppins', sans-serif;
    background-color: var(--white);
    box-sizing: border-box;
}

.form-field input:focus,
.form-field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(237, 117, 28, 0.1);
    outline: none;
}

.form-field input.error,
.form-field select.error {
    border-color: var(--red);
    background-color: rgba(230, 57, 70, 0.05);
}

.error-message {
    color: var(--red);
    font-size: 13px;
    margin-top: 5px;
    display: flex;
    align-items: center;
}

.error-message::before {
    content: '\f071';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-right: 6px;
    font-size: 12px;
}

.note {
    color: var(--text);
    font-size: 14px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    background-color: rgba(237, 117, 28, 0.05);
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.note::before {
    content: '\f05a';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-right: 10px;
    font-size: 16px;
    color: var(--accent);
}

/* Button Styles */
.button-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 30px;
    gap: 15px;
}

.back-button,
.continue-button {
    padding: 14px 30px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: var(--transition);
    font-family: 'Poppins', sans-serif;
    min-width: 150px;
    text-align: center;
}

.back-button {
    background-color: var(--light);
    color: var(--text);
    border: 1px solid var(--border-color);
}

.back-button:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
}

.continue-button {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 4px 15px rgba(237, 117, 28, 0.2);
}

.continue-button:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--accent-dark));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(237, 117, 28, 0.3);
}

/* Terms Content Styles - Updated for Step 2 */
.terms-content {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    line-height: 1.6;
    font-size: 14px;
    text-align: justify;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.terms-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.terms-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.terms-section h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(237, 117, 28, 0.2);
}

.terms-section-content p {
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.6;
}

.terms-section-content p:last-child {
    margin-bottom: 0;
}

.agreement-checkbox {
    margin-top: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background-color: rgba(237, 117, 28, 0.05);
    border-radius: 8px;
}

.agreement-checkbox label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
    color: var(--text);
    font-weight: 500;
}

.agreement-checkbox input[type="checkbox"] {
    margin-right: 10px;
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

/* Payment Method Container - Updated for Step 3 */
.payment-method-container {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin: 25px 0;
}

.payment-option {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    background-color: var(--light);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.payment-option:hover {
    border-color: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.payment-option.selected {
    border-color: var(--accent);
    background-color: rgba(237, 117, 28, 0.05);
    box-shadow: 0 4px 12px rgba(237, 117, 28, 0.1);
}

.payment-option-radio {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.payment-option-radio input[type="radio"] {
    margin-bottom: 10px;
    transform: scale(1.3);
    accent-color: var(--accent);
}

.payment-option-radio label {
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
}

.payment-error {
    text-align: center;
    display: block;
    margin-top: -15px;
    margin-bottom: 20px;
}

/* Contract Terms Section */
.contract-terms {
    margin-top: 40px;
    padding: 20px;
    background-color: rgba(0, 119, 204, 0.03);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.contract-section {
    margin-bottom: 20px;
}

.contract-section:last-child {
    margin-bottom: 0;
}

.contract-section h4 {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 8px;
    color: var(--primary);
}

.contract-section p {
    font-size: 14px;
    line-height: 1.6;
    text-align: justify;
    color: var(--text);
}

/* Signature Input styling */
.signature-input {
    font-family: 'Brush Script MT', cursive !important;
    font-size: 22px !important;
    text-align: center;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    height: auto !important;
    line-height: 1.2 !important;
}

/* Agreement Document Styles - Updated for Step 4 */
.agreement-document-container {
    padding: 20px 0;
    background-color: #f4f7f6;
}

.agreement-document {
    background-color: white;
    border-radius: 0;
    max-width: 850px;
    margin: 0 auto 30px;
    padding: 40px 50px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    font-family: 'Times New Roman', Times, serif;
    font-size: 11pt;
    line-height: 1.5;
    color: #000000;
}

.agreement-document::before {
    display: none;
}

/* PDF Header Section */
.pdf-header {
    position: relative;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #000;
    min-height: 60px;
}

.pdf-logo {
    position: absolute;
    top: 5px;
    right: 0;
    width: 150px;
    height: auto;
    text-align: right;
}

.pdf-logo img {
    max-width: 100%;
    max-height: 45px;
    display: block;
    margin-left: auto;
}

.pdf-title {
    font-size: 14pt;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: left;
}

.pdf-header-details {
    display: grid;
    grid-template-columns: auto minmax(150px, 1fr) auto minmax(150px, 1fr);
    gap: 8px 20px;
    font-size: 10pt;
    align-items: baseline;
}

.pdf-header-details span {
    padding-bottom: 2px;
    min-height: 1.2em;
}

.pdf-header-details strong {
    font-weight: bold;
    white-space: nowrap;
    padding-right: 5px;
}

.pdf-header-details .value {
    border-bottom: 1px solid #000;
    padding-left: 5px;
    word-break: break-word;
}

/* PDF Body Sections */
.pdf-section {
    margin-bottom: 20px;
}

.pdf-section-title {
    font-size: 11pt;
    font-weight: bold;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.pdf-section-content p {
    margin-bottom: 10px;
    text-align: justify;
    font-size: 11pt;
    line-height: 1.5;
}

.pdf-section-content p strong {
    font-weight: bold;
}

/* PDF Party Details */
.pdf-party-intro {
    margin-bottom: 15px;
    font-size: 11pt;
}

/* PDF Signature Section */
.pdf-signature-section {
    margin-top: 40px;
}

.pdf-signature-content {
    display: flex;
    gap: 30px;
    margin-top: 15px;
}

.pdf-signature-party {
    flex: 1;
}

.pdf-signature-party h4 {
    font-size: 11pt;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.pdf-signature-details {
    font-size: 10pt;
}

.pdf-signature-item {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-end;
}

.pdf-signature-item strong {
    flex: 0 0 80px;
    font-weight: bold;
    padding-right: 5px;
}

.pdf-signature-value-container {
    flex: 1;
    border-bottom: 1px solid #000;
    padding-left: 5px;
    min-height: 25px;
    display: flex;
    align-items: flex-end;
}

.pdf-signature-value-container span {
    font-family: 'Brush Script MT', cursive;
    font-size: 14pt;
    color: var(--primary-dark);
    line-height: 1;
}

.pdf-signature-value-container img.signature-image {
    display: inline-block;
    max-height: 25px;
    width: auto;
    vertical-align: bottom;
    margin-bottom: -2px;
}

.pdf-signature-item span.value-normal {
    flex: 1;
    border-bottom: 1px solid #000;
    padding-left: 5px;
    font-family: 'Times New Roman', Times, serif;
    font-size: 10pt;
    color: #000;
    min-height: 20px;
}

/* PDF Certificate Section Styles */
.pdf-certificate-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #000;
}

.pdf-certificate-title {
    font-size: 12pt;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.pdf-certificate-details {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 10pt;
    line-height: 1.4;
}

.pdf-certificate-ids {
    text-align: left;
}

.pdf-certificate-address {
    text-align: right;
}

.pdf-certificate-address p {
    margin: 0;
}

.pdf-certificate-body {
    font-size: 10pt;
    text-align: justify;
    line-height: 1.5;
    margin-bottom: 20px;
}

.pdf-certificate-body p {
    margin-bottom: 10px;
}

.pdf-certificate-signature {
    margin-top: 30px;
    text-align: right;
    font-size: 10pt;
}

.pdf-certificate-signature p {
    margin: 0;
    line-height: 1.4;
}

.pdf-certificate-note {
    margin-top: 30px;
    font-size: 9pt;
    font-weight: bold;
    text-align: left;
}

.pdf-certificate-note p {
    margin-bottom: 5px;
}

/* Done Step Styles */
.done-container {
    max-width: 800px;
    margin: 0 auto 30px;
}

.done-header {
    text-align: center;
    margin-bottom: 40px;
}

.done-header h2 {
    font-size: 32px;
    font-family: 'Poppins', sans-serif;
}

.decorative-line-center {
    margin: 20px auto;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
}

.done-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.done-info-card {
    background-color: var(--light);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

.done-info-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    font-family: 'Poppins', sans-serif;
}

.done-info-card h3 i {
    color: var(--accent);
    font-size: 20px;
}

.done-info-card p {
    margin-bottom: 10px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
}

.done-info-card p strong {
    color: var(--primary);
    margin-right: 5px;
}

.signature-value {
    font-family: 'Brush Script MT', cursive;
    font-size: 18px;
    color: var(--primary-dark);
}

.payment-value {
    font-weight: 600;
    color: var(--accent-dark);
}

/* PDF Generation Functionality */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.spinner {
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 5px solid var(--accent);
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.pdf-preview {
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.download-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.download-button {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(237, 117, 28, 0.3);
}

.download-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(237, 117, 28, 0.4);
}

.download-button i {
    margin-right: 10px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .form-container {
        padding: 30px 20px;
    }

    .carrier-form-grid {
        grid-template-columns: 1fr;
    }

    .pdf-signature-content {
        flex-direction: column;
        gap: 40px;
    }

    .pdf-header-details {
        grid-template-columns: auto 1fr;
    }

    /* Payment options mobile layout */
    .payment-method-container {
        flex-wrap: wrap;
        justify-content: flex-start; /* Or center, if preferred for the last row */
    }

    .payment-option {
        flex-grow: 0; /* Do not grow to fill space if last row is not full */
        flex-shrink: 0; /* Do not shrink smaller than basis */
        /* Calculate basis for 3 items per row, with 15px gap (2 gaps = 30px) */
        flex-basis: calc((100% - 30px) / 3);
        /* Consider adding a min-width if they become too narrow on very small screens before a new breakpoint */
        /* e.g., min-width: 120px; */
    }
}

@media (max-width: 576px) {
    .step-indicator {
        padding: 0 10px;
    }

    .step-number {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .step-text {
        font-size: 12px;
    }

    .button-container {
        flex-direction: column;
    }

    .back-button,
    .continue-button {
        width: 100%;
    }

    /* Payment options for very small screens - adjust to 2 or 1 per row if 3 is too cramped */
    .payment-option {
        /* Example: 2 items per row on very small screens */
        flex-basis: calc((100% - 15px) / 2); /* 1 gap = 15px */
        /* Or 1 item per row: */
        /* flex-basis: 100%; */
    }
}