/**
 * Button Loading States
 * Flat design animations for ECOON
 * NO rounded corners, NO shadows, NO gradients
 */

/* Loading State */
.btn-loading {
    position: relative;
    cursor: not-allowed;
}

.btn-loading-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

/* Square Dots Animation */
.btn-loading-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-loading-dot {
    width: 8px;
    height: 8px;
    background-color: currentColor;
    animation: btn-loading-pulse 1.4s ease-in-out infinite;
}

.btn-loading-dot:nth-child(1) {
    animation-delay: 0s;
}

.btn-loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.btn-loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes btn-loading-pulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.btn-loading-text {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

/* Success State */
.btn-success {
    background-color: #10B981 !important;
    border-color: #059669 !important;
    cursor: not-allowed;
    animation: btn-success-flash 0.3s ease-out;
}

@keyframes btn-success-flash {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* Alternative: Spinner Animation (Square Rotating) */
.btn-loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid currentColor;
    border-right-color: transparent;
    animation: btn-loading-spin 0.8s linear infinite;
}

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

/* Alternative: Bars Animation */
.btn-loading-bars {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 16px;
}

.btn-loading-bar {
    width: 3px;
    height: 100%;
    background-color: currentColor;
    animation: btn-loading-bar 1s ease-in-out infinite;
}

.btn-loading-bar:nth-child(1) {
    animation-delay: 0s;
}

.btn-loading-bar:nth-child(2) {
    animation-delay: 0.15s;
}

.btn-loading-bar:nth-child(3) {
    animation-delay: 0.3s;
}

.btn-loading-bar:nth-child(4) {
    animation-delay: 0.45s;
}

@keyframes btn-loading-bar {
    0%, 100% {
        transform: scaleY(0.5);
        opacity: 0.5;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* Form loading overlay (optional) */
form.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

form.form-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.5);
    z-index: 10;
}

/* Disable hover effects when loading */
.btn-loading:hover {
    background-color: inherit;
}
