/* Form validation styles */

.validation-error-highlight {
    border: 2px solid #dc3545 !important;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
    animation: pulse-error 1.5s ease-in-out;
}

@keyframes pulse-error {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.invalid-field {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Enhanced Bootstrap validation styling */
.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
    background-image: none !important;  /* Remove Bootstrap validation icon */
    padding-right: 0.75rem !important;  /* Reset padding that was for icon */
}

/* Remove validation icons from form controls */
.form-control.is-invalid,
.form-select.is-invalid {
    background-image: none !important;
    background-repeat: no-repeat !important;
    background-position: right calc(0.375em + 0.1875rem) center !important;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem) !important;
    padding-right: 0.75rem !important;
}

/* Enhanced invalid feedback styling - only show when field is invalid */
.is-invalid ~ .invalid-feedback,
.was-validated .form-control:invalid ~ .invalid-feedback,
.was-validated .form-select:invalid ~ .invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
    background-color: #fff1f0;
    border-left: 3px solid #dc3545;
    padding: 8px 12px 8px 32px;
    border-radius: 0 4px 4px 0;
    position: relative;
    transition: all 0.3s ease;
}

.is-invalid ~ .invalid-feedback::before,
.was-validated .form-control:invalid ~ .invalid-feedback::before,
.was-validated .form-select:invalid ~ .invalid-feedback::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* Input group invalid feedback positioning */
.input-group .is-invalid ~ .invalid-feedback,
.input-group .was-validated .form-control:invalid ~ .invalid-feedback,
.input-group .was-validated .form-select:invalid ~ .invalid-feedback {
    margin-top: 0.25rem;
    margin-left: 0;
    border-radius: 0 4px 4px 0;
}

/* Business type buttons - prevent text wrapping */
.d-grid[style*="grid-template-columns"] .btn {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.875rem;
    padding: 0.375rem 0.5rem;
    line-height: 1.2;
}

/* Responsive adjustments for business type buttons */
@media (max-width: 768px) {
    .d-grid[style*="grid-template-columns"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .d-grid[style*="grid-template-columns"] .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.25rem;
    }
}

@media (max-width: 576px) {
    .d-grid[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    .d-grid[style*="grid-template-columns"] .btn {
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }
}

.error-message {
    color: #dc3545;
    margin-top: 0.25rem;
    font-size: 0.875em;
    display: none;
    background-color: #fff1f0;
    border-left: 3px solid #dc3545;
    padding: 8px 12px 8px 32px;
    border-radius: 0 4px 4px 0;
    margin-bottom: 5px;
    transition: all 0.3s ease;
    position: relative;
}

.error-message::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.error-message.d-block {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Styles for invalid checkbox rows */
.invalid-checkbox-row {
    background-color: rgba(255, 241, 240, 0.5);
    border-radius: 4px;
    padding: 5px;
    margin-bottom: 10px;
    border-left: 3px solid #dc3545;
}

.invalid-checkbox-row input[type="checkbox"] {
    outline: 2px solid #dc3545;
    outline-offset: 2px;
}

/* Toast notifications for errors */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 300px;
    max-width: 450px;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: toast-slide-in 0.3s ease-out forwards;
}

.toast-error {
    border-left: 4px solid #dc3545;
}

.toast-header {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #f8d7da;
    color: #721c24;
    font-weight: bold;
    border-bottom: 1px solid #f5c6cb;
}

.toast-title {
    flex: 1;
}

.toast-content {
    padding: 12px 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
}

.validation-errors .toast-content {
    padding: 8px 15px 12px;
}

.validation-error-list {
    margin: 0;
    padding-left: 20px;
    width: 100%;
}

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

.toast-icon {
    font-size: 20px;
}

.toast-message {
    font-size: 14px;
    color: #333;
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #aaa;
    padding: 0 12px;
}

.toast-close:hover {
    color: #666;
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/*Validation styles for form controls*/
.validation {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
    background-color: #fff1f0;
    border-left: 3px solid #dc3545;
    padding: 8px 12px;
    border-radius: 0 4px 4px 0;
    position: relative;
    transition: all 0.3s ease;
}

.invalid {
    border: 2px solid #dc3545 !important;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25) !important;
}
