/**
 * Form Styles for Magendoo Form Handler
 * Styles for form states, messages, and validation
 */

/* Form Messages */
.form-messages {
    margin-bottom: 20px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.form-messages:empty {
    display: none;
}

.form-messages.alert {
    padding: 15px 20px;
    position: relative;
    animation: slideDown 0.3s ease-out;
}

.form-messages .close {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    padding: 0;
}

.form-messages .close:hover {
    opacity: 0.8;
}

/* Success Messages */
.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

/* Error Messages */
.alert-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Field Errors */
.form-group.has-error .form-control {
    border-color: #dc3545;
    background-color: #fff5f5;
}

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

.field-error {
    display: block;
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    animation: fadeIn 0.3s ease-out;
}

/* Loading State */
.form-loading {
    opacity: 0.7;
    pointer-events: none;
}

.form-loading .form-control {
    background-color: #f8f9fa;
}

button[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Spinner for Bootstrap 4 compatibility */
.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: 0.15em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

.spinner-border-sm {
    width: 0.875rem;
    height: 0.875rem;
    border-width: 0.1em;
}

.mr-2 {
    margin-right: 0.5rem !important;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* Form Enhancement Indicators */
form[data-form-type] {
    position: relative;
}

/* Progressive Enhancement - JS Enhanced Forms */
.js form[data-form-type] input:invalid {
    border-color: initial;
}

.js form[data-form-type] .form-control:focus {
    border-color: #7C4DFF;
    box-shadow: 0 0 0 0.2rem rgba(124, 77, 255, 0.25);
}

/* Honeypot Field (Should be hidden) */
div[style*="position: absolute"][style*="left: -9999px"] {
    position: absolute !important;
    left: -9999px !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Responsive Adjustments */
@media (max-width: 576px) {
    .form-messages.alert {
        padding: 12px 35px 12px 15px;
        font-size: 0.875rem;
    }
    
    .form-messages .close {
        right: 10px;
        font-size: 20px;
    }
}

/* Print Styles */
@media print {
    .form-messages,
    .field-error {
        display: none !important;
    }
}