/* ========================================
   ABOS Product Card System
   Inspired by forvital.cz, adapted to ABOS minimal aesthetic
   ======================================== */

:root {
    --abos-product-card-bg: #ffffff;
    --abos-product-card-padding: 16px;
    --abos-product-card-radius: 18px;
    --abos-product-card-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    --abos-product-card-shadow-hover: 0 8px 28px rgba(0, 0, 0, 0.14);
    
    --abos-product-image-bg: #f8f8f8;
    --abos-product-image-padding: 14px;
    
    --abos-product-text-primary: #111213;
    --abos-product-text-secondary: #7f858a;
    
    --abos-product-accent: #F90505;
    --abos-product-button-bg: #111213;
    --abos-product-button-text: #ffffff;
    --abos-product-button-radius: 999px;
    --abos-product-button-padding: 11px 20px;
}

/* Hide original Shoptet structure only after rebuild (homepage) */
body.type-index .product .p.abos-treated > :not(.abos-product-card) {
    display: none !important;
}

/* Main product card */
body.type-index .product .p {
    background-color: var(--abos-product-card-bg) !important;
    border-radius: var(--abos-product-card-radius) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    padding: 0 !important;
    display: block !important;
    height: 100% !important;
    overflow: visible !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    box-shadow: var(--abos-product-card-shadow) !important;
    cursor: pointer !important;
    position: relative !important;
}

/* Show our custom rebuilt structure */
body.type-index .product .p .abos-product-card {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

body.type-index .product .p:hover {
    transform: translateY(-3px) !important;
    box-shadow: var(--abos-product-card-shadow-hover) !important;
}

/* Custom rebuilt card structure */
.abos-product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.abos-product-card__image {
    position: relative;
    background: var(--abos-product-image-bg);
    border-radius: var(--abos-product-card-radius) var(--abos-product-card-radius) 0 0;
    overflow: hidden;
    padding-top: 75%;
}

.abos-product-card__image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: var(--abos-product-image-padding);
    transition: transform 0.4s ease;
}

.product .p:hover .abos-product-card__image img {
    transform: scale(1.05);
}

.abos-product-card__content {
    padding: var(--abos-product-card-padding);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.abos-product-card__name {
    font-size: 15px;
    font-weight: 700;
    color: var(--abos-product-text-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    min-height: calc(15px * 1.35 * 2);
    text-decoration: none;
}

.abos-product-card__availability {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.abos-product-card__availability--in-stock {
    color: #009901;
}

.abos-product-card__availability--out-of-stock {
    color: #cb0000;
}

.abos-product-card__availability-amount {
    color: var(--abos-product-text-secondary);
    font-weight: 500;
}

.abos-product-card__bottom {
    margin-top: auto;
    padding-top: 4px;
}

.abos-product-card__price {
    font-size: 26px;
    font-weight: 800;
    color: var(--abos-product-text-primary);
    line-height: 1.1;
    margin-bottom: 10px;
    white-space: nowrap;
}

.abos-product-card__controls {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.abos-product-card__quantity {
    width: 55px;
    height: 42px;
    padding: 0 8px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--abos-product-text-primary);
    background: #ffffff;
    transition: border-color 0.2s ease;
}

.abos-product-card__quantity:focus {
    border-color: var(--abos-product-button-bg);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(17, 18, 19, 0.1);
}

.abos-product-card__button {
    flex-grow: 1;
    height: 42px;
    background: var(--abos-product-button-bg);
    color: var(--abos-product-button-text);
    border: none;
    border-radius: var(--abos-product-button-radius);
    padding: 0 18px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.abos-product-card__button:hover {
    background: var(--abos-product-accent);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(249, 5, 5, 0.3);
}

.abos-product-card__button:active {
    transform: translateY(0);
}

.abos-product-card__code {
    font-size: 10px;
    color: var(--abos-product-text-secondary);
    margin-top: 6px;
    line-height: 1.2;
}


/* Badges */
.abos-product-badge {
    position: absolute;
    top: 12px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.abos-product-badge--action {
    left: 12px;
    background: var(--abos-product-accent);
    color: #ffffff;
}

.abos-product-badge--discount {
    right: 12px;
    background: var(--abos-product-button-bg);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 12px;
    min-width: 68px;
    border-radius: 12px;
}

.abos-product-badge--discount__old {
    font-size: 11px;
    opacity: 0.85;
    text-decoration: line-through;
    line-height: 1.1;
    font-weight: 600;
}

.abos-product-badge--discount__save {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.1;
}



/* Hide quantity spinner */
.abos-product-card__quantity::-webkit-outer-spin-button,
.abos-product-card__quantity::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.abos-product-card__quantity[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Notification styling */
.custom-cart-notifier .msg {
    border-radius: 12px !important;
    padding: 16px 24px !important;
    font-weight: 600 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

.custom-cart-notifier .msg-success {
    background-color: #10b981 !important;
    color: #ffffff !important;
    border: none !important;
}

.custom-cart-notifier .msg-error {
    background-color: var(--abos-product-accent) !important;
    color: #ffffff !important;
    border: none !important;
}

/* Hide dividers between products - homepage only */
body.type-index .product,
body.type-index .product .p,
body.type-index .products .product {
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: none !important;
}

body.type-index .products-block .product::after,
body.type-index .products-block .product::before {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body.type-index .product .p .p-in {
        padding: 12px !important;
    }
    
    body.type-index .product .p .p-in .name span[data-micro="name"] {
        font-size: 14px !important;
        min-height: calc(14px * 1.35 * 2) !important;
    }
    
    body.type-index .product .p .price-final strong {
        font-size: 20px !important;
    }
    
    body.type-index .product .p .p-tools .quantity-cart-controls {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    body.type-index .product .p .p-tools .quantity-input {
        width: 100% !important;
    }
}

.abos-filters-enhanced .abos-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding: 8px 0;
    font-weight: 600;
}

.abos-filters-enhanced .abos-filter-header span {
    display: inline-block;
}

.abos-filters-enhanced .abos-filter-header::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--abos-product-text-secondary);
    border-bottom: 2px solid var(--abos-product-text-secondary);
    transform: rotate(45deg);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.abos-filters-enhanced .abos-filter-open > .abos-filter-header::after {
    transform: rotate(225deg);
    border-color: var(--abos-product-accent);
}

.abos-filters-enhanced .abos-filter-body {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease;
}

.abos-filters-enhanced .abos-filter-open .abos-filter-body {
    max-height: 1000px;
    opacity: 1;
}

.abos-filters-enhanced .abos-filter-collapsed .abos-filter-body {
    max-height: 0;
    opacity: 0;
}

.abos-filters-enhanced .abos-filter-body form fieldset > div {
    padding: 2px 0;
}

.abos-filters-enhanced .abos-filter-header:hover::after {
    border-color: var(--abos-product-accent);
}
