/**
 * B2B Registration Frontend Styles
 */

.b2b-registration-form {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.form-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--b2b-accent, #4068a9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group {
    margin-bottom: 20px;
}

.form-control-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 5px;
    display: block;
}

.form-control-label.required::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

.form-control {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 14px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--b2b-accent, #4068a9);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: 0;
}

.form-control.is-invalid {
    border-color: #dc3545;
}

.form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-footer {
    background: transparent;
    padding: 25px;
    margin-top: 30px;
    text-align: center;
}

/* Custom checkbox styling */
.custom-checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    margin-bottom: 20px;
    gap: 12px;
}

.custom-checkbox {
    display: none; /* Hide the default checkbox */
}

.custom-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    line-height: 1.5;
    gap: 12px;
}

.checkbox-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid #ced4da;
    border-radius: 4px;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.checkbox-indicator::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.custom-checkbox:checked + .custom-checkbox-label .checkbox-indicator {
    background-color: var(--b2b-accent, #4068a9);
    border-color: var(--b2b-accent, #4068a9);
}

.custom-checkbox:checked + .custom-checkbox-label .checkbox-indicator::after {
    opacity: 1;
}

.custom-checkbox:focus + .custom-checkbox-label .checkbox-indicator {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: 0;
}

.checkbox-text {
    flex: 1;
}

/* Registration success styling */
.registration-success {
    text-align: center;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.registration-success h4 {
    color: #155724;
    margin-bottom: 15px;
    font-size: 24px;
}

.registration-success p {
    margin-bottom: 15px;
    font-size: 16px;
}

.success-actions {
    margin-top: 20px;
}

.success-actions .btn {
    padding: 12px 24px;
    font-size: 16px;
    text-decoration: none;
    border-radius: 4px;
    display: inline-block;
    margin: 5px;
}

.success-actions .btn-primary {
    background-color: var(--b2b-accent, #4068a9);
    color: white;
    border: 1px solid var(--b2b-accent, #4068a9);
}

.success-actions .btn-secondary {
    background-color: #6c757d;
    color: white;
    border: 1px solid #6c757d;
}

.success-actions .btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* Form validation styling (like PrestaShop) */
.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
}

.form-group.has-error .form-control {
    border-color: #dc3545;
}

.form-group.has-error .form-control:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Success validation styling */
.form-control.is-valid {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

.valid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #28a745;
}

/* Enhanced error alert styling */
.alert.alert-warning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.alert.alert-warning h4 {
    color: #856404;
    margin-bottom: 10px;
}

.error-list {
    margin-bottom: 0;
    padding-left: 20px;
}

.error-list li {
    margin-bottom: 5px;
}

.business-conditions-link {
    color: var(--b2b-accent, #4068a9);
    text-decoration: underline;
    font-weight: 500;
}

.business-conditions-link:hover {
    color: #0056b3;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--b2b-accent, #4068a9);
    border-color: var(--b2b-accent, #4068a9);
    padding: 12px 40px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    transition: all 0.15s ease-in-out;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.existing-customer-link {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.existing-customer-link p {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
}

.existing-customer-link a {
    color: var(--b2b-accent, #4068a9);
    text-decoration: none;
    font-weight: 500;
}

.existing-customer-link a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Alert styles */
.alert {
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 15px 20px;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert ul {
    margin: 0;
    padding-left: 20px;
}

.alert li {
    margin-bottom: 5px;
}

.alert li:last-child {
    margin-bottom: 0;
}

/* Cloudflare Turnstile widget */
.cf-turnstile {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .b2b-registration-form {
        padding: 10px;
    }
    
    .form-section {
        padding: 20px 15px;
        margin-bottom: 15px;
    }
    
    .section-title {
        font-size: 14px;
        margin-bottom: 15px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-footer {
        padding: 20px 15px;
    }
    
    .btn-primary {
        width: 100%;
        padding: 15px;
    }
    
    .form-check {
        text-align: left;
        justify-content: flex-start;
    }
}

@media (max-width: 576px) {
    .row .col-md-6 {
        margin-bottom: 15px;
    }
    
    .form-control {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Loading state */
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary.loading::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

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

/* Form validation feedback */
.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 5px;
    font-size: 12px;
    color: #dc3545;
}

.valid-feedback {
    display: block;
    width: 100%;
    margin-top: 5px;
    font-size: 12px;
    color: #28a745;
}

/* ================================================= */
/* ENHANCED ERROR VISIBILITY STYLES */
/* ================================================= */

/* Shake animation for error banner */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Pulse animation for invalid fields */
@keyframes fieldPulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* Enhanced error banner */
.error-banner {
    animation: shake 0.5s ease-in-out;
    border-left: 4px solid #dc3545;
    position: relative;
    background-color: #f8d7da;
    border-color: #f5c6cb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.error-banner .error-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.error-banner .error-header h4 {
    margin: 0;
    color: #721c24;
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.error-banner .error-count {
    background: #dc3545;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.error-banner .error-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.error-banner .error-list {
    margin: 0;
    padding-left: 20px;
}

.error-banner .error-list li {
    margin-bottom: 8px;
    color: #721c24;
}

.error-banner .error-list li:last-child {
    margin-bottom: 0;
}

/* Enhanced invalid field styling with pulse */
.form-control.is-invalid {
    border-color: #dc3545;
    border-width: 2px;
    animation: fieldPulse 1s ease-out;
}

.form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    animation: none;
}

/* Select field invalid state */
select.form-control.is-invalid {
    border-color: #dc3545;
    border-width: 2px;
    animation: fieldPulse 1s ease-out;
}

/* Checkbox error display */
.checkbox-error {
    display: block;
    margin-top: 8px;
    margin-left: 32px;
}

.custom-checkbox.is-invalid + .custom-checkbox-label .checkbox-indicator {
    border-color: #dc3545;
    border-width: 2px;
    animation: fieldPulse 1s ease-out;
}

.form-group.has-error .custom-checkbox-label .checkbox-indicator {
    border-color: #dc3545;
    border-width: 2px;
}

/* Responsive error banner */
@media (max-width: 576px) {
    .error-banner .error-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .error-banner .error-count {
        order: -1;
        margin-bottom: 5px;
    }

    .checkbox-error {
        margin-left: 0;
    }
}

/* ================================================= */
/* B2B SURVEY SECTION STYLES */
/* ================================================= */

.survey-section {
    margin-top: 40px;
    padding-top: 30px;
}

.survey-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
    text-align: center;
}

.survey-description {
    text-align: center;
    color: #6c757d;
    font-size: 14px;
    margin-bottom: 30px;
}

.survey-block {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-left: 4px solid var(--b2b-accent, #4068a9);
    margin-bottom: 25px;
}

.section-hint {
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
    margin-bottom: 15px;
}

/* Checkbox grid for survey options */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.checkbox-grid .custom-checkbox-wrapper {
    justify-content: flex-start;
    margin-bottom: 8px;
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.checkbox-grid .custom-checkbox-wrapper:hover {
    background: #e9ecef;
}

.checkbox-grid .custom-checkbox:checked + .custom-checkbox-label {
    font-weight: 600;
}

/* Survey checkbox styling */
.survey-checkbox + .custom-checkbox-label .checkbox-indicator {
    width: 18px;
    height: 18px;
}

/* Conditional fields */
.conditional-field {
    margin-top: 15px;
    padding: 15px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 6px;
    animation: slideDown 0.3s ease;
}

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

/* Radio group styling */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-radio-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.custom-radio-wrapper:hover {
    background: #e9ecef;
}

.custom-radio {
    display: none;
}

.custom-radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    width: 100%;
}

.radio-indicator {
    width: 18px;
    height: 18px;
    border: 2px solid #ced4da;
    border-radius: 50%;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.radio-indicator::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #fff;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.custom-radio:checked + .custom-radio-label .radio-indicator {
    background-color: var(--b2b-accent, #4068a9);
    border-color: var(--b2b-accent, #4068a9);
}

.custom-radio:checked + .custom-radio-label .radio-indicator::after {
    opacity: 1;
}

.custom-radio:checked + .custom-radio-label {
    font-weight: 600;
}

.radio-text {
    flex: 1;
}

/* Margin utility */
.mt-3 {
    margin-top: 1rem;
}

/* Responsive survey styles */
@media (max-width: 768px) {
    .survey-section {
        margin-top: 30px;
        padding-top: 20px;
    }

    .survey-title {
        font-size: 20px;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .radio-group {
        gap: 6px;
    }
}
