/* =========================
   SHIMMER LOADING EFFECTS
   ========================= */

/* Shimmer Animation Keyframes */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Base Shimmer Class */
.shimmer {
    background: linear-gradient(
        90deg,
        var(--shimmer-base, #f0f0f0) 0%,
        var(--shimmer-highlight, #e0e0e0) 50%,
        var(--shimmer-base, #f0f0f0) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: 4px;
}

/* Dark Mode Shimmer Variables */
[data-bs-theme="dark"] .shimmer,
.dark-mode .shimmer {
    --shimmer-base: #2a2a2a;
    --shimmer-highlight: #3a3a3a;
}

/* Light Mode Shimmer Variables */
[data-bs-theme="light"] .shimmer,
.light-mode .shimmer {
    --shimmer-base: #f0f0f0;
    --shimmer-highlight: #e0e0e0;
}

/* Style Card Shimmer Skeleton */
.shimmer-card {
    background: var(--bs-body-bg);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.shimmer-card-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--shimmer-base, #f0f0f0);
    position: relative;
    overflow: hidden;
}

.shimmer-card-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

[data-bs-theme="dark"] .shimmer-card-image::before,
.dark-mode .shimmer-card-image::before {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
}

.shimmer-card-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.shimmer-card-title {
    height: 20px;
    width: 60%;
    border-radius: 4px;
}

.shimmer-card-text {
    height: 16px;
    width: 100%;
    border-radius: 4px;
}

.shimmer-card-text.short {
    width: 80%;
}

.shimmer-card-text.medium {
    width: 90%;
}

.shimmer-card-meta {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.shimmer-card-meta-item {
    height: 18px;
    width: 80px;
    border-radius: 4px;
}

/* Mobile Style Card Shimmer */
.shimmer-mobile-card {
    background: var(--bs-body-bg);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    margin-bottom: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.shimmer-mobile-image {
    width: 100%;
    height: 280px;
    background: var(--shimmer-base, #f0f0f0);
    position: relative;
    overflow: hidden;
}

.shimmer-mobile-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

[data-bs-theme="dark"] .shimmer-mobile-image::before,
.dark-mode .shimmer-mobile-image::before {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
}

.shimmer-mobile-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Grid Shimmer Container */
.shimmer-grid {
    display: grid;
    gap: 1rem;
}

.shimmer-grid.row {
    margin: 0;
}

.shimmer-grid .col-xl-3,
.shimmer-grid .col-lg-4,
.shimmer-grid .col-md-6 {
    padding: 0.5rem;
}

/* Table Shimmer */
.shimmer-table {
    width: 100%;
}

.shimmer-table-row {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--bs-border-color);
}

.shimmer-table-cell {
    flex: 1;
    height: 20px;
    border-radius: 4px;
}

.shimmer-table-cell.short {
    flex: 0 0 100px;
}

.shimmer-table-cell.medium {
    flex: 0 0 200px;
}

/* Button Shimmer */
.shimmer-button {
    height: 38px;
    width: 120px;
    border-radius: 6px;
}

/* Text Shimmer */
.shimmer-text {
    height: 1em;
    border-radius: 4px;
    margin: 0.25rem 0;
}

.shimmer-text.large {
    height: 1.5em;
}

.shimmer-text.small {
    height: 0.875em;
}

/* Circle Shimmer (for avatars, icons) */
.shimmer-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Product Detail Modal Shimmer */
.shimmer-product-detail {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.shimmer-product-image-section {
    width: 100%;
    height: 400px;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.shimmer-product-details-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.shimmer-product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.shimmer-product-title {
    height: 32px;
    width: 200px;
    border-radius: 4px;
}

.shimmer-product-price {
    height: 32px;
    width: 120px;
    border-radius: 4px;
}

.shimmer-product-specs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.shimmer-product-spec-item {
    height: 20px;
    width: 100%;
    border-radius: 4px;
}

.shimmer-product-spec-item.short {
    width: 60%;
}

.shimmer-swatch-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.shimmer-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.shimmer-swatch.rect {
    width: 60px;
    height: 30px;
    border-radius: 6px;
}

.shimmer-action-buttons {
    display: flex;
    gap: 0.75rem;
}

.shimmer-action-button {
    height: 48px;
    flex: 1;
    border-radius: 8px;
}

.shimmer-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    flex-shrink: 0;
}

.shimmer-thumbnails-container {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.shimmer-similar-product {
    width: 100px;
    height: 120px;
    border-radius: 8px;
}

.shimmer-similar-products {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.shimmer-table-row {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
}

.shimmer-table-cell {
    flex: 1;
    height: 18px;
    border-radius: 4px;
}

/* Product Detail Modal Specific */
.product-detail-modal .shimmer-product-image-section {
    background: var(--shimmer-base, #f0f0f0);
    position: relative;
    overflow: hidden;
}

.product-detail-modal .shimmer-product-image-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

[data-bs-theme="dark"] .product-detail-modal .shimmer-product-image-section::before,
.dark-mode .product-detail-modal .shimmer-product-image-section::before {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
}

/* Cart Item Shimmer */
.shimmer-cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bs-body-bg);
    border-radius: 12px;
    border: 1px solid var(--bs-border-color);
    margin-bottom: 1rem;
}

.shimmer-cart-item-image {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    flex-shrink: 0;
    background: var(--shimmer-base, #f0f0f0);
    position: relative;
    overflow: hidden;
}

.shimmer-cart-item-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

[data-bs-theme="dark"] .shimmer-cart-item-image::before,
.dark-mode .shimmer-cart-item-image::before {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
}

.shimmer-cart-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.shimmer-cart-item-title {
    height: 24px;
    width: 150px;
    border-radius: 4px;
}

.shimmer-cart-item-text {
    height: 16px;
    width: 100%;
    border-radius: 4px;
}

.shimmer-cart-item-text.short {
    width: 60%;
}

.shimmer-cart-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.shimmer-cart-action-btn {
    height: 36px;
    width: 80px;
    border-radius: 6px;
}

/* Responsive Adjustments */
@media (max-width: 767.98px) {
    .shimmer-card-body {
        padding: 0.75rem;
    }
    
    .shimmer-mobile-body {
        padding: 0.75rem;
    }
    
    .shimmer-card-title {
        height: 18px;
    }
    
    .shimmer-card-text {
        height: 14px;
    }
    
    .shimmer-product-image-section {
        height: 300px;
    }
    
    .shimmer-action-buttons {
        flex-direction: column;
    }
    
    .shimmer-action-button {
        width: 100%;
    }
    
    .shimmer-cart-item {
        flex-direction: column;
    }
    
    .shimmer-cart-item-image {
        width: 100%;
        height: 200px;
    }
    
    .shimmer-cart-item-actions {
        flex-wrap: wrap;
    }
}

/* Fade In Animation for Shimmer Removal */
@keyframes fadeOutShimmer {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.shimmer-fade-out {
    animation: fadeOutShimmer 0.3s ease-out forwards;
}

/* Loading State - Hide Content While Shimmer is Active */
.shimmer-container.loading .shimmer-content {
    display: none;
}

.shimmer-container.loading .shimmer-skeleton {
    display: block;
}

.shimmer-container:not(.loading) .shimmer-skeleton {
    display: none;
}

.shimmer-container:not(.loading) .shimmer-content {
    display: block;
}

