/* ==================================================
   LOADING STATES & FORM UX IMPROVEMENTS
   Elite Wealth Capital
   ================================================== */

/* Loading Spinner */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

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

/* Success/Error Messages */
.alert-floating {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-floating.alert-fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Form Validation Feedback */
.form-control.is-invalid-custom {
    border-color: #dc3545;
    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: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.form-control.is-valid-custom {
    border-color: #28a745;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.invalid-feedback-custom,
.valid-feedback-custom {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
}

.invalid-feedback-custom {
    color: #dc3545;
}

.valid-feedback-custom {
    color: #28a745;
}

.form-control.is-invalid-custom ~ .invalid-feedback-custom,
.form-control.is-valid-custom ~ .valid-feedback-custom {
    display: block;
}

/* Disabled State */
.form-control:disabled,
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Button Hover Effects */
.btn-primary:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
    transition: all 0.2s ease;
}

.btn-success:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40,167,69,0.3);
    transition: all 0.2s ease;
}

/* Input Focus Effects */
.form-control:focus {
    border-color: #FFD700;
    box-shadow: 0 0 0 0.2rem rgba(255,215,0,0.25);
}

/* Loading Overlay (for full page loading) */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
    color: #FFD700;
}

/* Pulse Animation for Success */
@keyframes pulse-success {
    0% {
        box-shadow: 0 0 0 0 rgba(40,167,69,0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40,167,69,0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40,167,69,0);
    }
}

.btn-success-pulse {
    animation: pulse-success 1s ease-out;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .alert-floating {
        top: 60px;
        right: 10px;
        left: 10px;
        min-width: auto;
    }
}
