/* ==========================================
   UI IMPROVEMENTS - Loading States & Empty States
   ========================================== */

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color, #4361ee);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-inline {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color, #4361ee);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-left: 8px;
}

.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 transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Skeleton Loaders */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: 8px;
}

.skeleton-card {
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Enhanced Empty States */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted, #6b7280);
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--text-muted, #6b7280);
    opacity: 0.5;
    margin-bottom: 1.5rem;
    display: block;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main, #111827);
    margin-bottom: 0.75rem;
}

.empty-state-message {
    font-size: 1rem;
    color: var(--text-muted, #6b7280);
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state-action {
    margin-top: 1.5rem;
}

/* Cart Empty State */
.cart-empty {
    padding: 5rem 2rem;
}

.cart-empty .empty-state-icon {
    color: var(--primary-color, #4361ee);
    opacity: 0.3;
}

/* Wishlist Empty State */
.wishlist-empty {
    text-align: center;
    padding: 4rem 2rem;
}

.wishlist-empty i {
    font-size: 4rem;
    color: #e91e63;
    opacity: 0.3;
    margin-bottom: 1.5rem;
    display: block;
}

.wishlist-empty h5 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-main, #111827);
}

.wishlist-empty p {
    color: var(--text-muted, #6b7280);
    margin-bottom: 2rem;
}

/* Orders Empty State */
.orders-empty {
    text-align: center;
    padding: 4rem 2rem;
}

.orders-empty i {
    font-size: 4rem;
    color: var(--text-muted, #6b7280);
    opacity: 0.5;
    margin-bottom: 1.5rem;
    display: block;
}

/* Search Empty State */
.search-empty {
    text-align: center;
    padding: 3rem 2rem;
}

.search-empty i {
    font-size: 3rem;
    color: var(--text-muted, #6b7280);
    opacity: 0.5;
    margin-bottom: 1rem;
    display: block;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid;
}

.toast.success {
    border-left-color: var(--success-color, #2ec4b6);
}

.toast.error {
    border-left-color: var(--danger-color, #e63946);
}

.toast.warning {
    border-left-color: var(--warning-color, #ff9f1c);
}

.toast.info {
    border-left-color: var(--info-color, #3a86ff);
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success-color, #2ec4b6);
}

.toast.error .toast-icon {
    color: var(--danger-color, #e63946);
}

.toast.warning .toast-icon {
    color: var(--warning-color, #ff9f1c);
}

.toast.info .toast-icon {
    color: var(--info-color, #3a86ff);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-main, #111827);
}

.toast-message {
    font-size: 0.875rem;
    color: var(--text-muted, #6b7280);
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text-main, #111827);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.hiding {
    animation: slideOutRight 0.3s ease-out forwards;
}

/* Progress Bars */
.progress-container {
    margin: 1rem 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted, #6b7280);
}

.progress-bar-wrapper {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color, #4361ee), var(--primary-light, #4895ef));
    border-radius: 4px;
    transition: width 0.3s ease;
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Form Loading States */
.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Inline Loading Indicator */
.inline-loader {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-left: 6px;
}

/* Page Loading Indicator */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #e5e7eb;
    z-index: 10000;
    overflow: hidden;
}

.page-loader-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color, #4361ee), var(--primary-light, #4895ef));
    width: 0%;
    transition: width 0.3s ease;
    animation: pageLoadProgress 2s ease-in-out infinite;
}

@keyframes pageLoadProgress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .empty-state {
        padding: 3rem 1rem;
    }
    
    .empty-state-icon {
        font-size: 3rem;
    }
    
    .empty-state-title {
        font-size: 1.25rem;
    }
    
    .toast-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

