/* ========================================
   LOADING STATES - Probachi Premium
   ======================================== */

/* Button Loading State */
.btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: btn-spin 0.8s linear infinite;
}

/* For dark buttons (gold background) */
.btn-primary.btn-loading::after,
.btn-hero-primary.btn-loading::after,
.btn-confirm.btn-loading::after {
    border-top-color: #000;
}

/* For light/outline buttons */
.btn-secondary.btn-loading::after,
.btn-outline.btn-loading::after {
    border-top-color: #ffd700;
}

@keyframes btn-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Button with text change */
.btn-loading-text {
    position: relative;
}

.btn-loading-text .btn-text {
    transition: opacity 0.2s ease;
}

.btn-loading-text.is-loading .btn-text {
    opacity: 0;
}

.btn-loading-text .btn-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    align-items: center;
    gap: 8px;
}

.btn-loading-text.is-loading .btn-loader {
    display: flex;
}

.btn-loader-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: btn-spin 0.8s linear infinite;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-title {
    height: 24px;
    width: 80%;
    margin-bottom: 12px;
}

.skeleton-image {
    width: 100%;
    padding-bottom: 100%;
}

.skeleton-card {
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
}

/* Full Page Loading Overlay */
.page-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.page-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.page-loader {
    width: 60px;
    height: 60px;
    position: relative;
}

.page-loader::before,
.page-loader::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.page-loader::before {
    inset: 0;
    border: 3px solid rgba(255, 215, 0, 0.1);
}

.page-loader::after {
    inset: 0;
    border: 3px solid transparent;
    border-top-color: #ffd700;
    animation: page-spin 1s linear infinite;
}

@keyframes page-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.page-loading-text {
    margin-top: 20px;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
}

/* Inline Loading Spinner */
.inline-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 215, 0, 0.2);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: btn-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

/* Cart Button Loading */
.cart-btn.is-adding {
    animation: cart-pulse 0.5s ease;
}

@keyframes cart-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Add to Cart Animation */
.add-to-cart-success {
    position: relative;
    overflow: hidden;
}

.add-to-cart-success::before {
    content: '✓';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    animation: success-flash 1.5s ease forwards;
}

@keyframes success-flash {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; pointer-events: none; }
}

/* Input Loading State */
.input-loading {
    position: relative;
}

.input-loading::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 215, 0, 0.2);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: btn-spin 0.8s linear infinite;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #f59e0b);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.progress-bar-indeterminate .progress-bar-fill {
    width: 30%;
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* Disabled State */
.btn:disabled,
.btn[disabled],
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Processing Order Animation */
.order-processing {
    text-align: center;
    padding: 40px;
}

.order-processing-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    position: relative;
}

.order-processing-icon::before {
    content: '📦';
    font-size: 40px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: package-bounce 1s ease-in-out infinite;
}

@keyframes package-bounce {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -60%) scale(1.1); }
}

.order-processing-text {
    font-size: 18px;
    color: #fff;
    margin-bottom: 8px;
}

.order-processing-subtext {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Dots Loading Animation */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: #ffd700;
    border-radius: 50%;
    animation: dots-bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dots-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}
