/* NR Custom Contact Forms - Frontend Styles */

.nrccf-form-container {
    max-width: 900px;
    margin: 0;
    padding: 0 20px; /* Only left/right padding, no top/bottom */
}

/* Form alignment classes */
.nrccf-form-container.nrccf-align-center {
    margin-left: auto;
    margin-right: auto;
}

.nrccf-form-container.nrccf-align-center .nrccf-form-fields,
.nrccf-form-container.nrccf-align-center .nrccf-icon-box-grid {
    margin-left: auto;
    margin-right: auto;
}

.nrccf-form-container.nrccf-align-right {
    margin-left: auto;
    margin-right: 0;
}

.nrccf-form-container.nrccf-align-right .nrccf-form-fields,
.nrccf-form-container.nrccf-align-right .nrccf-icon-box-grid {
    margin-left: auto;
    margin-right: 0;
}

.nrccf-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-weight: 600;
}

.nrccf-message.nrccf-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.nrccf-message.nrccf-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.nrccf-form-description {
    margin-bottom: 20px;
    color: #666;
}

.nrccf-form-fields {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    row-gap: 20px;
    column-gap: 20px;
    width: fit-content;
    max-width: 100%;
}

.nrccf-field-wrapper {
    margin-bottom: 0;
    box-sizing: border-box;
    min-width: 0; /* Prevents overflow in flex items */
}

/* Column Width Classes */
/* Gap is 20px, so we calculate: width - (total_gaps / items_per_row) */
.nrccf-col-full {
    flex: 0 0 100%;
    max-width: 100%;
}

.nrccf-col-three-quarters {
    flex: 0 0 75%;
    max-width: 75%;
}

.nrccf-col-half {
    /* 50% - (20px gap / 2 items) = 50% - 10px */
    flex: 0 0 calc(50% - 10px);
    max-width: calc(50% - 10px);
}

.nrccf-col-third {
    /* 33.333% - (40px total gaps / 3 items) = 33.333% - 13.333px */
    flex: 0 0 calc(33.333% - 13.333px);
    max-width: calc(33.333% - 13.333px);
}

.nrccf-col-quarter {
    /* 25% - (60px total gaps / 4 items) = 25% - 15px */
    flex: 0 0 calc(25% - 15px);
    max-width: calc(25% - 15px);
}

.nrccf-field-wrapper label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.nrccf-required-indicator {
    color: #d63638;
    margin-left: 3px;
}

.nrccf-field {
    width: 100%;
    padding: 10px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background-color: #fff;
    color: #2c3338;
    text-align: center;
}

/* Center placeholder text */
.nrccf-field::placeholder {
    text-align: center;
}

.nrccf-field::-webkit-input-placeholder {
    text-align: center;
}

.nrccf-field::-moz-placeholder {
    text-align: center;
}

.nrccf-field:-ms-input-placeholder {
    text-align: center;
}

.nrccf-field:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.nrccf-field.nrccf-required:invalid {
    border-color: #d63638;
}

select.nrccf-field,
textarea.nrccf-field {
    resize: vertical;
    min-height: 100px;
}

select.nrccf-field {
    min-height: auto;
    cursor: pointer;
}

.nrccf-field-description {
    display: block;
    margin-top: 5px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

/* Phone Verification Field */
.nrccf-phone-verify-wrapper {
    background: #f9f9f9;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.nrccf-phone-verify-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.nrccf-phone-verify-input-group input,
.nrccf-phone-verify-input-group select {
    font-size: 16px; /* Prevent zoom on mobile */
}

.nrccf-phone-verify-input {
    flex: 1;
}

.nrccf-send-code-btn,
.nrccf-verify-code-btn {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.nrccf-send-code-btn:hover,
.nrccf-verify-code-btn:hover {
    background: #135e96;
}

.nrccf-send-code-btn:disabled,
.nrccf-verify-code-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

.nrccf-verification-code-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.nrccf-verification-message {
    margin-bottom: 10px;
    font-size: 14px;
}

.nrccf-code-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.nrccf-verification-code-input {
    flex: 1;
    font-size: 18px;
    letter-spacing: 2px;
    text-align: center;
    font-weight: bold;
}

.nrccf-verification-status {
    margin-top: 10px;
    font-size: 14px;
}

/* Address Field */
.nrccf-address-field-wrapper {
    margin-bottom: 30px;
}

.nrccf-address-autocomplete {
    margin-bottom: 15px;
}

.nrccf-address-search {
    width: 100%;
    padding: 12px;
    border: 2px solid #2271b1;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    touch-action: manipulation;
    /* Prevent zoom on mobile devices */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.nrccf-address-search:focus {
    outline: none;
    border-color: #135e96;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
    font-size: 16px; /* Ensure font size doesn't change on focus */
}

.nrccf-address-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.nrccf-address-field {
    display: flex;
    flex-direction: column;
}

.nrccf-address-field:first-child {
    grid-column: 1 / -1;
}

.nrccf-address-field label {
    font-size: 13px;
    margin-bottom: 5px;
    color: #555;
}

.nrccf-address-field input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 16px; /* Prevent zoom on mobile */
}

.nrccf-address-field input[readonly] {
    background: #e9ecef;
    cursor: not-allowed;
}

/* Submit Button */
.nrccf-form-submit {
    text-align: center;
    margin-top: 30px;
}

.nrccf-submit-button {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.nrccf-submit-button:hover {
    background: #135e96;
}

.nrccf-submit-button:active {
    background: #0a4d7a;
}

.nrccf-loading {
    margin-left: 15px;
    color: #666;
    font-style: italic;
}

/* Google Maps Autocomplete Dropdown */
.pac-container {
    z-index: 9999;
    border-top: 1px solid #d9d9d9;
    font-family: inherit;
}

.pac-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.pac-item:hover {
    background-color: #f5f5f5;
}

.pac-item-query {
    font-weight: 600;
    color: #333;
}

/* Multi-Step Form Styles */
.nrccf-multistep-form {
    position: relative;
}

.nrccf-step-progress {
    background: #fff;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.nrccf-step-progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.nrccf-step-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2271b1 0%, #135e96 100%);
    transition: width 0.4s ease;
    border-radius: 4px;
}

.nrccf-step-indicator {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #555;
}

.nrccf-step-current {
    color: #2271b1;
    font-size: 20px;
}

.nrccf-step-total {
    color: #999;
}

.nrccf-form-step {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.nrccf-form-step.nrccf-slide-up {
    animation: none !important;
    will-change: transform;
}

.nrccf-step-title {
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: 700;
    color: #2271b1;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 10px;
}

.nrccf-step-description {
    margin: 0 0 25px 0;
    font-size: 16px;
    color: #666;
    line-height: 1.6;
}

.nrccf-step-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
    gap: 15px;
}

.nrccf-prev-step,
.nrccf-next-step {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
}

.nrccf-prev-step {
    background: #6c757d;
}

.nrccf-prev-step:hover {
    background: #5a6268;
    transform: translateX(-2px);
}

.nrccf-next-step:hover,
.nrccf-step-navigation .nrccf-submit-button:hover {
    background: #135e96;
    transform: translateX(2px);
}

.nrccf-prev-step:active,
.nrccf-next-step:active {
    transform: scale(0.98);
}

/* Error state for validation */
.nrccf-field-error {
    border-color: #d63638 !important;
    box-shadow: 0 0 0 2px rgba(214, 54, 56, 0.1) !important;
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.nrccf-step-navigation .nrccf-submit-button {
    margin-left: auto;
}

.nrccf-step-navigation .nrccf-loading {
    margin-left: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .nrccf-form-container {
        padding: 15px;
    }

    /* Stack columns on tablet and mobile */
    .nrccf-col-three-quarters,
    .nrccf-col-half,
    .nrccf-col-third,
    .nrccf-col-quarter {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .nrccf-address-fields {
        grid-template-columns: 1fr;
    }

    .nrccf-address-field:first-child {
        grid-column: 1;
    }

    .nrccf-submit-button {
        width: 100%;
    }

    /* Multi-step responsive */
    .nrccf-step-navigation {
        flex-direction: column;
    }

    .nrccf-prev-step,
    .nrccf-next-step,
    .nrccf-step-navigation .nrccf-submit-button {
        width: 100%;
        margin-left: 0;
    }

    .nrccf-step-title {
        font-size: 20px;
    }

    .nrccf-step-description {
        font-size: 14px;
    }
}

/* Tablet breakpoint - half columns still work side by side */
@media (min-width: 769px) and (max-width: 1024px) {
    .nrccf-col-third,
    .nrccf-col-quarter {
        flex: 0 0 calc(50% - 10px);
        max-width: calc(50% - 10px);
    }
}

/* Label Field Styles */
.nrccf-field-label {
    border: none !important;
    padding: 0 !important;
    background-color: transparent !important;
}

/* Icon Box Styles */
.nrccf-icon-box-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
    width: fit-content;
}

.nrccf-icon-box-grid.nrccf-cols-1 {
    grid-template-columns: 1fr;
}

.nrccf-icon-box-grid.nrccf-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.nrccf-icon-box-grid.nrccf-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.nrccf-icon-box-grid.nrccf-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.nrccf-icon-box-grid.nrccf-cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

.nrccf-icon-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    box-sizing: border-box;
}

.nrccf-icon-box:focus {
    outline: none;
}

.nrccf-icon-box.nrccf-icon-box-active {
    /* Active state - background color applied via JavaScript */
}

.nrccf-icon-box-icon {
    color: #555;
    transition: color 0.3s ease;
    line-height: 1;
}

.nrccf-icon-box-label {
    margin-bottom: 8px;
    color: #333;
    text-align: center;
}

.nrccf-icon-box-label strong {
    font-weight: 700 !important;
}

.nrccf-icon-box-description {
    font-size: 14px;
    color: #666;
    text-align: center;
    line-height: 1.4;
}

/* Responsive Icon Boxes */
@media (max-width: 768px) {
    /* Stack icon boxes on mobile */
    .nrccf-icon-box-grid.nrccf-cols-2,
    .nrccf-icon-box-grid.nrccf-cols-3,
    .nrccf-icon-box-grid.nrccf-cols-4,
    .nrccf-icon-box-grid.nrccf-cols-5 {
        grid-template-columns: 1fr;
    }

    .nrccf-icon-box {
        padding: 15px;
    }

    .nrccf-icon-box-description {
        font-size: 13px;
    }
}

/* Tablet breakpoint for icon boxes */
@media (min-width: 769px) and (max-width: 1024px) {
    /* 4 and 5 column grids become 2 columns on tablet */
    .nrccf-icon-box-grid.nrccf-cols-4,
    .nrccf-icon-box-grid.nrccf-cols-5 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 3 column grid becomes 2 columns on small tablets */
    .nrccf-icon-box-grid.nrccf-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Button Field Styles */
.nrccf-field-button-wrapper {
    width: 100%;
}

button.nrccf-button-field,
.nrccf-button-field {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0;
    font-family: inherit;
    font-weight: 600 !important;
    text-align: center !important;
    text-decoration: none !important;
    cursor: pointer !important;
    border: 2px solid transparent !important;
    transition: all 0.3s ease !important;
    user-select: none !important;
    vertical-align: middle;
    white-space: normal !important;
}

/* Button custom icon */
.nrccf-button-custom-icon {
    max-height: 1.2em;
    width: auto;
    display: inline-block;
    vertical-align: middle;
}

/* Button Sizes */
button.nrccf-button-small,
.nrccf-button-small {
    padding: 8px 16px !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
}

button.nrccf-button-medium,
.nrccf-button-medium {
    padding: 12px 24px !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
}

button.nrccf-button-large,
.nrccf-button-large {
    padding: 16px 32px !important;
    font-size: 18px !important;
    line-height: 1.6 !important;
}

/* Button Styles */
button.nrccf-button-primary,
.nrccf-button-primary {
    background-color: #0073aa !important;
    color: #ffffff !important;
    border-color: #0073aa !important;
}

button.nrccf-button-primary:hover,
.nrccf-button-primary:hover {
    background-color: #005a87 !important;
    border-color: #005a87 !important;
}

button.nrccf-button-secondary,
.nrccf-button-secondary {
    background-color: #6c757d !important;
    color: #ffffff !important;
    border-color: #6c757d !important;
}

button.nrccf-button-secondary:hover,
.nrccf-button-secondary:hover {
    background-color: #5a6268 !important;
    border-color: #5a6268 !important;
}

button.nrccf-button-outline,
.nrccf-button-outline {
    background-color: transparent !important;
    color: #0073aa !important;
    border-color: #0073aa !important;
}

button.nrccf-button-outline:hover,
.nrccf-button-outline:hover {
    background-color: #0073aa !important;
    color: #ffffff !important;
}

/* Full Width Button */
.nrccf-button-full-width {
    width: 100%;
    display: flex;
}

/* Button States */
.nrccf-button-field:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.nrccf-button-field:active {
    transform: scale(0.98);
}

.nrccf-button-field:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive Button Styles */
@media (max-width: 768px) {
    .nrccf-button-small {
        padding: 6px 12px;
        font-size: 13px;
    }

    .nrccf-button-medium {
        padding: 10px 20px;
        font-size: 15px;
    }

    .nrccf-button-large {
        padding: 14px 28px;
        font-size: 17px;
    }
}
