/* shopmetro-loader.css - Cleaned, No Redundancy */

/* ============================================================
   SHARED - Ring Component (Base sizes)
   ============================================================ */

.sml-ring {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
}

.sml-ring svg {
    position: absolute;
    top: 0;
    left: 0;
}

.sml-ring__spinner {
    animation: sml-spin 1.2s linear infinite;
    transform-origin: center;
}

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

.sml-ring__logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sml-ring__logo img {
    width: 45px;
    height: 45px;
    object-fit: contain;
}

/* ============================================================
   PHASE 1 - Page Loader 
   ============================================================ */

#sml-loader-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--sml-bg, rgba(0, 0, 0, 0.15));
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(2px);
}

#sml-loader-backdrop.sml--hidden {
    opacity: 0;
    pointer-events: none;
}

/* Page loader spinner */
#sml-loader-backdrop .sml-ring {
    transform: scale(0.7);
    transform-origin: center;
}

@media (max-width: 768px) {
    #sml-loader-backdrop .sml-ring {
        transform: scale(0.65);
    }
}

@media (max-width: 480px) {
    #sml-loader-backdrop .sml-ring {
        transform: scale(0.6);
    }
}

@media (max-width: 380px) {
    #sml-loader-backdrop .sml-ring__logo {
        display: none;
    }
}

/* ============================================================
   PHASE 2 - Skeleton
   ============================================================ */

.sml-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    width: 100%;
}

@media (max-width: 849px) {
    .sml-skeleton-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 549px) {
    .sml-skeleton-grid { grid-template-columns: repeat(3, 1fr); }
}

.sml-skeleton-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sml-skel {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: sml-shimmer 1.4s infinite;
    border-radius: 4px;
}

@keyframes sml-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.sml-skel--img   { height: 180px; border-radius: 8px; }
.sml-skel--title { height: 14px; width: 80%; }
.sml-skel--sub   { height: 14px; width: 55%; }
.sml-skel--price { height: 13px; width: 40%; }
.sml-skel--btn   { height: 32px; width: 100%; border-radius: 4px; margin-top: 4px; }

.products.row.row-small.sml--loading {
    opacity: 0.3;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* ============================================================
   PHASE 3 - Add-to-Cart Button
   ============================================================ */

.add_to_cart_button.sml--atc-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
    color: transparent !important;
}

.add_to_cart_button.sml--atc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sml-btn-spin 0.7s linear infinite;
}

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

.add_to_cart_button.sml--atc-added {
    position: relative;
    pointer-events: none;
    opacity: 0.9;
}

/* ============================================================
   PHASE 4 - Checkout Modal 
   ============================================================ */

#sml-checkout-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: var(--sml-bg, rgba(0, 0, 0, 0.15));
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

#sml-checkout-backdrop.sml--active  { display: flex; }
#sml-checkout-backdrop.sml--visible { opacity: 1; }

#sml-checkout-modal {
    background: #fff;
    border-radius: var(--sml-radius, 16px);
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 200px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    animation: sml-modal-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes sml-modal-in {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

/* Checkout spinner - larger on mobile */
#sml-checkout-modal .sml-ring {
    width: 60px !important;
    height: 60px !important;
}

#sml-checkout-modal .sml-ring svg {
    width: 60px !important;
    height: 60px !important;
}

#sml-checkout-modal .sml-ring svg circle {
    r: 24 !important;
    stroke-width: 3 !important;
}

#sml-checkout-modal .sml-ring__logo {
    width: 42px !important;
    height: 42px !important;
}

#sml-checkout-modal .sml-ring__logo img {
    width: 38px !important;
    height: 38px !important;
}

/* Checkout modal text sizes */
.sml-checkout-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}

.sml-checkout-sub {
    margin: 0;
    font-size: 12px;
    color: #888;
    transition: opacity 0.3s ease;
    text-align: center;
}

/* Mobile */
@media (max-width: 768px) {
    #sml-checkout-modal {
        padding: 1.5rem 1.75rem;
        gap: 12px;
        min-width: 200px;
    }
    
    #sml-checkout-modal .sml-ring {
        width: 55px !important;
        height: 55px !important;
    }
    
    #sml-checkout-modal .sml-ring svg {
        width: 55px !important;
        height: 55px !important;
    }
    
    #sml-checkout-modal .sml-ring svg circle {
        r: 22 !important;
        stroke-width: 3 !important;
    }
    
    #sml-checkout-modal .sml-ring__logo {
        width: 38px !important;
        height: 38px !important;
    }
    
    #sml-checkout-modal .sml-ring__logo img {
        width: 34px !important;
        height: 34px !important;
    }
    
    .sml-checkout-title {
        font-size: 14px;
    }
    
    .sml-checkout-sub {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    #sml-checkout-modal .sml-ring {
        width: 50px !important;
        height: 50px !important;
    }
    
    #sml-checkout-modal .sml-ring svg {
        width: 50px !important;
        height: 50px !important;
    }
    
    #sml-checkout-modal .sml-ring svg circle {
        r: 20 !important;
        stroke-width: 3 !important;
    }
    
    #sml-checkout-modal .sml-ring__logo {
        width: 34px !important;
        height: 34px !important;
    }
    
    #sml-checkout-modal .sml-ring__logo img {
        width: 30px !important;
        height: 30px !important;
    }
}

/* Disable Place Order button while modal is active */
.sml-checkout-processing #place_order {
    pointer-events: none;
    opacity: 0.6;
}

/* ============================================================
   UTILITIES - Optional features
   ============================================================ */

/* Swipe transition (if used) */
#sml-nav-swipe {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: var(--sml-bg, rgba(0,0,0,0.15));
    transform: translateX(101%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

#sml-nav-swipe.sml--swiping {
    transform: translateX(0);
    pointer-events: all;
}

/* Page entrance animations (if used) */
body.sml-entering {
    opacity: 0;
    transform: translateX(30px);
}

body.sml-entered {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.35s ease, transform 0.35s ease;
}