/* Kudita storefront enhancements — shared across themes */

/* --- Product card consistency --- */
.products-container .product_item .product-card-image .img-wrapper,
.products-container .product_item .product-card-image > a.img-wrapper {
    display: block;
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    border-radius: 8px;
    background: var(--third-color, #f5f5f5);
}

.products-container .product_item .product-card-image img,
.products-container .product_item .product-card-image .default-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.products-container .product_item .product-image-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-color, #666);
    background: var(--third-color, #f0f0f0);
}

.products-container .product_item .product-content-top h3,
.products-container .product_item .product-content-top h3 a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    min-height: 2.7em;
    margin-bottom: 6px;
}

.products-container .product_item .product-content-bottom {
    margin-top: auto;
}

.products-container .product_item .product-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Overlay actions on image only (theme1/3); theme5 keeps buttons in product-content-bottom */
.products-container .product_item .product-card-image .pro-btn-wrapper {
    position: absolute;
    bottom: 8px;
    right: 8px;
    left: 8px;
    z-index: 2;
}

.products-container .product_item .product-content-bottom .pro-btn-wrapper {
    position: static;
    width: 100%;
}

/* --- Empty states --- */
.store-empty-state {
    text-align: center;
    padding: 48px 24px;
    max-width: 420px;
    margin: 0 auto;
}

.store-empty-state__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--theme-color, #333) 12%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-color, #333);
    font-size: 2rem;
}

.store-empty-state h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--black, #1a1a1a);
}

.store-empty-state p {
    font-size: 0.9rem;
    color: var(--text-color, #666);
    margin-bottom: 16px;
    line-height: 1.5;
}

.store-empty-state .btn {
    background: var(--theme-color, #333);
    color: var(--white, #fff);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.875rem;
    text-decoration: none;
    display: inline-block;
}

.store-empty-state--inline {
    padding: 32px 16px;
}

.store-empty-state--search {
    padding: 24px 16px;
    max-width: 100%;
}

/* --- Skeleton loaders --- */
@keyframes storefront-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.store-skeleton {
    background: linear-gradient(90deg, var(--third-color, #eee) 25%, color-mix(in srgb, var(--white, #fff) 60%, var(--third-color, #eee)) 50%, var(--third-color, #eee) 75%);
    background-size: 200% 100%;
    animation: storefront-shimmer 1.2s ease-in-out infinite;
    border-radius: 8px;
}

.store-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px;
}

@media (min-width: 768px) {
    .store-skeleton-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .store-skeleton-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.store-skeleton-card {
    border-radius: 12px;
    overflow: hidden;
}

.store-skeleton-card .store-skeleton-img {
    padding-top: 100%;
    border-radius: 8px 8px 0 0;
}

.store-skeleton-card .store-skeleton-line {
    height: 12px;
    margin: 10px 12px 0;
}

.store-skeleton-card .store-skeleton-line.short {
    width: 60%;
    margin-bottom: 12px;
}

.store-skeleton-search-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    align-items: center;
}

.store-skeleton-search-item .store-skeleton-thumb {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 8px;
}

.store-skeleton-search-item .store-skeleton-line {
    flex: 1;
    height: 12px;
}

/* --- Mobile sticky cart bar --- */
.mobile-cart-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9990;
    background: var(--theme-color, #111);
    color: var(--white, #fff);
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.mobile-cart-bar.is-visible {
    display: block;
    transform: translateY(0);
}

.mobile-cart-bar__inner {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mobile-cart-bar__info {
    flex: 1;
    min-width: 0;
}

.mobile-cart-bar__count {
    font-size: 0.8rem;
    opacity: 0.9;
    margin: 0 0 2px;
}

.mobile-cart-bar__total {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-cart-bar__btn {
    flex-shrink: 0;
    background: var(--white, #fff);
    color: var(--theme-color, #111) !important;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.mobile-cart-bar__btn:hover {
    opacity: 0.95;
}

@media (min-width: 768px) {
    .mobile-cart-bar {
        display: none !important;
    }
}

body.mobile-cart-bar-active {
    padding-bottom: 72px;
}

/* --- PWA install prompt --- */
.pwa-install-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9985;
    background: var(--white, #fff);
    border-top: 1px solid var(--border-color, #e5e5e5);
    padding: 14px 16px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    transition: transform 0.35s ease;
}

.pwa-install-banner.is-visible {
    display: block;
    transform: translateY(0);
}

body.mobile-cart-bar-active .pwa-install-banner.is-visible {
    bottom: 68px;
}

.pwa-install-banner__icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: #fff;
}

.pwa-install-banner__inner {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.pwa-install-banner__text {
    flex: 1;
    min-width: 0;
}

.pwa-install-banner__text strong {
    display: block;
    font-size: 0.9rem;
    color: var(--black, #111);
}

.pwa-install-banner__text span {
    font-size: 0.75rem;
    color: var(--text-color, #666);
}

.pwa-install-banner__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.pwa-install-banner__install {
    background: var(--theme-color, #333);
    color: var(--white, #fff);
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.pwa-install-banner__dismiss {
    background: transparent;
    border: none;
    color: var(--text-color, #666);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 8px;
}

/* --- Theme1: footer must follow products, not overlap them --- */
body[class*="theme1-v"] .main-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body[class*="theme1-v"] .main-wrapper > .row {
    flex: 0 0 auto;
    width: 100%;
    position: relative;
    z-index: 1;
}

body[class*="theme1-v"] .main-wrapper .store-footer-extended {
    margin-top: auto;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    clear: both;
}

body[class*="theme1-v"] .products-section {
    padding-bottom: 48px;
}

@media screen and (min-width: 992px) {
    body[class*="theme1-v"] .main-left-col main.wrapper {
        max-height: none !important;
        overflow-y: visible !important;
    }
}

/* --- Footer contact & newsletter --- */
.store-footer-extended .footer-contact-col p,
.store-footer-extended .footer-contact-col a {
    font-size: 0.875rem;
    color: var(--white, #fff);
    opacity: 0.88;
    margin: 0 0 8px;
    text-decoration: none;
    display: block;
}

.store-footer-extended .footer-contact-col a:hover {
    opacity: 1;
    text-decoration: underline;
}

.store-footer-newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.store-footer-newsletter-form input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--white, #fff) 25%, transparent);
    background: color-mix(in srgb, var(--white, #fff) 10%, transparent);
    color: var(--white, #fff);
    font-size: 0.875rem;
}

.store-footer-newsletter-form input[type="email"]::placeholder {
    color: color-mix(in srgb, var(--white, #fff) 55%, transparent);
}

.store-footer-newsletter-form button {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: var(--white, #fff);
    color: var(--theme-color, #333);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
}

.store-footer-newsletter-consent {
    font-size: 0.7rem;
    opacity: 0.65;
    line-height: 1.4;
    margin: 0;
}

@media (min-width: 768px) {
    .store-footer-extended .footer-main-row--enhanced {
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.1fr);
    }
}

/* Sale / compare-at pricing (theme resets remove default <del> strikethrough) */
.price .storefront-price-compare,
.variation_price1 .storefront-price-compare,
del.storefront-price-compare {
    text-decoration: line-through !important;
    -webkit-text-decoration: line-through !important;
    color: #6b7280;
    font-weight: 400;
    font-size: 0.92em;
    opacity: 0.9;
}

.price .storefront-price-sale,
.variation_price1 .storefront-price-sale {
    text-decoration: none !important;
    font-weight: 600;
}
