/*
 * ==========================================================================
 * COMPONENTS.CSS - Component Bundle (rem-based for density scaling)
 * ==========================================================================
 * This file imports all component CSS files for easy inclusion in pages.
 *
 * Usage in templates:
 *   <link rel="stylesheet" href="/assets/css/pyeza.css?v={{.CacheVersion}}">
 *
 * Structure:
 * - Common components: shared pyeza component styles
 * - App-specific components: storefront-specific component styles
 * - Storefront page components: split from storefront.css
 *
 * All dimensions use rem units for density control via root font-size.
 * ==========================================================================
 */

/* ========================================
   COMMON COMPONENTS (from packages)
   ======================================== */
@import url('components/button.css');
@import url('components/badge.css');
@import url('components/card.css');
@import url('components/form.css');
@import url('components/dialog.css');

/* ========================================
   APP-SPECIFIC COMPONENTS (local)
   ======================================== */
@import url('components/chip.css');
@import url('components/toast.css');
@import url('components/empty-state.css');
@import url('components/popover.css');
@import url('components/spinner.css');
@import url('components/skeleton.css');

/* ========================================
   STOREFRONT-SPECIFIC COMPONENT STYLES
   ======================================== */
@import url('app/storefront-product.css');
@import url('app/storefront-cart.css');
@import url('app/storefront-checkout.css');
@import url('app/storefront-login.css');

/* ========================================
   LOADING INDICATOR (inline to avoid @import issues)
   ======================================== */

.htmx-indicator {
    display: none;
}

.htmx-indicator.htmx-request {
    display: block;
}

/* Position the main content loading indicator as overlay */
#main-content-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-base, #F9FAFB);
    z-index: 40;
}

#main-content-loading .loading-spinner {
    height: 100%;
    min-height: 100%;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    width: 100%;
    min-height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border, #E8EAED);
    border-top-color: var(--accent-primary, var(--accent-terracotta, #C4654A));
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.spinner.sm {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

.spinner.md {
    width: 32px;
    height: 32px;
    border-width: 2.5px;
}

.spinner.lg {
    width: 48px;
    height: 48px;
    border-width: 3.5px;
}

.loading-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    min-height: auto;
}

.loading-inline .spinner {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

@media (prefers-color-scheme: dark) {
    .loading-overlay {
        background: rgba(0, 0, 0, 0.7);
    }
}

@media (max-width: 768px) {
    .loading-spinner {
        padding: 40px 20px;
        min-height: 150px;
    }
}
