/* 1️⃣ Import Montserrat font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

/* 2️⃣ Theme-aligned CSS variables */
:root {
    --crf-orange: #F26531;
    --crf-blue: #1B4298;
    --crf-black: #4A4A4A;
    --crf-gray: #F2F2F2;
    --crf-light-gray: #C1C1C1;
    --crf-text-gray: #ADADAD;
    --crf-white: #FFF;
    --crf-light-orange: #FFA726;
}

/* 3️⃣ Apply Montserrat globally */
body, #customer-request-form, #crf-toast, #crf-toast button {
    font-family: 'Montserrat', sans-serif;
}

/* Customer Request Form Labels and Inputs */
#customer-request-form label {
    display: block;
    margin-top: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--crf-blue);
}

#customer-request-form select,
#customer-request-form input,
#customer-request-form textarea {
    width: 100%;
    margin: 5px 0;
    padding: 10px 15px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    border: 1px solid var(--crf-light-gray);
    border-radius: 2px;
    color: var(--crf-black);
    background-color: var(--crf-white);
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

#customer-request-form select:focus,
#customer-request-form input:focus,
#customer-request-form textarea:focus {
    border-color: var(--crf-blue);
    outline: none;
}

#customer-request-form select:disabled,
#customer-request-form input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#crf-client-info {
    border: 1px solid var(--crf-light-gray);
    padding: 20px;
    margin-top: 15px;
    background: var(--crf-gray);
    border-radius: 2px;
}

#crf-client-info h4 {
    margin-top: 0;
    color: var(--crf-blue);
    font-weight: 600;
    font-size: 16px;
}

/* File upload hint text */
.crf-file-hint {
    font-size: 12px;
    color: var(--crf-text-gray);
    margin-top: 2px;
    margin-bottom: 5px;
    display: block;
}

/* Ensure form and all children respect container width */
#customer-request-form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#crf-step-inquiry,
#crf-client-info,
.crf-consent-container,
.crf-submit-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#crf-client-info input,
#crf-client-info textarea,
#crf-client-info select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* File label */
.crf-file-label {
    display: block;
    margin-top: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #crf-client-info {
        padding: 15px;
    }

    #customer-request-form select,
    #customer-request-form input,
    #customer-request-form textarea {
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    .crf-consent-container {
        padding: 15px;
    }

    .crf-toast {
        width: 90%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    #crf-client-info {
        padding: 12px;
    }

    #customer-request-form select,
    #customer-request-form input,
    #customer-request-form textarea {
        padding: 10px 10px;
    }

    .crf-consent-container {
        padding: 12px;
    }
}

/* Submit Button — centered */
.crf-submit-wrapper {
    text-align: center;
    margin-top: 20px;
}

#crf-submit-btn {
    position: relative;
    padding: 12px 24px;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 500;
    background-color: var(--crf-orange);
    color: var(--crf-white);
    border: none;
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.5s ease;
}

#crf-submit-btn:hover {
    background-color: var(--crf-light-orange);
}

#crf-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loader {
    font-size: 14px;
}

/* Overlay background */
.crf-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99998;
}

/* Toast / Modal */
.crf-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%) scale(0.9);
    background: var(--crf-white);
    color: var(--crf-black);
    padding: 20px 24px;
    border-radius: 2px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    font-size: 15px;
    text-align: center;
    max-width: 90%;
    width: 320px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99999;
    font-family: 'Montserrat', sans-serif;
}

/* Show state */
.crf-overlay.show {
    opacity: 1;
    visibility: visible;
}

.crf-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Success & Error styles */
.crf-toast.success {
    border-top: 5px solid #4CAF50;
}

.crf-toast.error {
    border-top: 5px solid #f44336;
}

/* Toast Button */
.crf-toast button {
    margin-top: 15px;
    padding: 12px 24px;
    border: none;
    border-radius: 2px;
    background: var(--crf-blue);
    color: var(--crf-white);
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.5s ease;
}

.crf-toast button:hover {
    background: var(--crf-orange);
}

.crf-toast.error button {
    background: #f44336;
}

/* PROCEED Button */
#crf-proceed-btn {
    display: block;
    width: 100%;
    padding: 12px 24px;
    background-color: var(--crf-blue);
    color: var(--crf-white);
    font-weight: 500;
    font-size: 16px;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.5s ease;
    margin-top: 10px;
}

#crf-proceed-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#crf-proceed-btn:hover:not(:disabled) {
    background-color: var(--crf-orange);
}

/* Consent Section Container */
.crf-consent-container {
    border: 1px solid var(--crf-light-gray);
    padding: 20px;
    border-radius: 2px;
    background-color: var(--crf-gray);
    max-width: 1000px;
    margin: 0 auto 20px auto;
    font-family: 'Montserrat', sans-serif;
}

/* Consent Title */
.crf-consent-container h3 {
    margin-top: 0;
    font-weight: 600;
    color: var(--crf-blue);
    text-align: center;
}

/* Scrollable Consent Text */
.crf-consent-text {
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 15px;
    background-color: var(--crf-white);
    border: 1px solid var(--crf-light-gray);
    border-radius: 2px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--crf-black);
}

.crf-consent-text a {
    color: var(--crf-blue);
    text-decoration: underline;
}

/* Consent Checkbox Inline */
.crf-consent-agree {
    margin-bottom: 15px;
    font-weight: 500;
}

.crf-consent-agree label {
    display: inline-flex !important;
    align-items: center;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 500;
    color: var(--crf-black);
}

/* Only affect checkbox inside consent section */
.crf-consent-agree input[type="checkbox"] {
    width: auto !important;
    margin-right: 12px;
    vertical-align: middle;
}

/* Validation Bubble (mimics native browser tooltip) */
.crf-validation-bubble {
    position: absolute;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 99999;
    white-space: nowrap;
    font-family: 'Montserrat', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
}

.crf-validation-bubble::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 14px;
    width: 10px;
    height: 10px;
    background: #fff;
    border-left: 1px solid #ccc;
    border-top: 1px solid #ccc;
    transform: rotate(45deg);
}

.crf-validation-bubble .crf-bubble-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #E8941A;
    color: #fff;
    border-radius: 2px;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

/* Invalid field highlight */
#customer-request-form input.crf-invalid {
    border-color: #e74c3c !important;
    background-color: #fef2f2 !important;
}