/**
 * Product Card Styles for Dack Products
 * 
 * Custom design for tire product cards in the tab products grid
 * 
 * @package Blocksy_Child
 */

/* Main Product Card Container */
.autohjul-product-card--dack,
.autohjul-product-card--falgar {
    margin: 0;
    padding: 0;
    list-style: none;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    max-width: 100%;
}

.autohjul-product-card--falgar {
    border-color: rgba(33, 150, 243, 0.25);
}

.autohjul-product-card--dack:hover,
.autohjul-product-card--falgar:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.autohjul-product-card--falgar:hover {
    border-color: rgba(33, 150, 243, 0.5);
    box-shadow: 0 4px 14px rgba(33, 150, 243, 0.15);
}

.autohjul-product-card__inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 1. Featured Picture with Hover Effect */
.autohjul-product-card__image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 85%; /* Taller aspect so full tire image visible in grid */
    overflow: hidden;
    background: #f5f5f5;
}

.autohjul-product-card__image-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    text-decoration: none;
}

.autohjul-product-card__image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.autohjul-product-card__image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    transform: translateY(0) scale(1);
}

.autohjul-product-card--dack:hover .autohjul-product-card__image,
.autohjul-product-card--falgar:hover .autohjul-product-card__image {
    transform: translateY(-10px) scale(1.05);
    opacity: 0.95;
}

/* Free Shipping Badge */
.autohjul-product-card__badge--shipping {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f5f5f0;
    border: 1px solid #d0d0d0;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.autohjul-product-card__badge-icon {
    width: 14px;
    height: 14px;
    color: #333;
    margin-bottom: 3px;
    flex-shrink: 0;
}

.autohjul-product-card__badge-text {
    font-size: 8px;
    line-height: 1.1;
    text-align: center;
    color: #333;
    font-weight: 500;
    padding: 0;
    word-wrap: break-word;
    max-width: 100%;
}

/* Utförsäljning badge – 3+ years DotYear, inside image above attribute row */
.autohjul-product-card__badge--utforsaljning {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    z-index: 10;
    background: linear-gradient(180deg, rgba(185, 28, 28, 0.95) 0%, #b91c1c 100%);
    color: #fff;
    box-shadow: 0 3px 8px rgba(185, 28, 28, 0.5), 0 2px 4px rgba(0, 0, 0, 0.15);
    border-radius: 4px 4px 0 0;
}

.autohjul-product-card__badge--utforsaljning .autohjul-product-card__badge-text {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* 2. Attributes Row */
.autohjul-product-card__attributes {
    background: #e8f4f8;
    padding: 12px 16px;
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.autohjul-product-card__attributes-inner {
    display: flex;
    gap: 6px;
    align-items: center;
    width: 100%;
    justify-content: center;
    max-width: 100%;
    flex-wrap: nowrap;
}

.autohjul-product-card__attributes-empty {
    width: 100%;
    text-align: center;
    color: #666;
    font-size: 13px;
    font-weight: 500;
}

.autohjul-product-card__attribute {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    position: relative;
    flex: 0 0 auto;
    justify-content: center;
    min-width: 0;
}

.autohjul-product-card__attribute-tooltip {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    background: rgba(150, 150, 150, 0.35);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
}

.autohjul-product-card__tooltip-icon {
    font-size: 10px;
    font-weight: 600;
    font-style: italic;
    color: rgba(80, 80, 80, 0.9);
    line-height: 1;
}


/* Inline popup span – hidden, used only as content source for body-level popup */
.autohjul-product-card__tooltip-popup {
    display: none !important;
}

/* Body-level popup – floats outside card, never clipped, full readable */
#autohjul-attribute-popup.autohjul-attribute-popup {
    display: none;
    position: fixed;
    z-index: 999999;
    min-width: 240px;
    max-width: 380px;
    width: max-content;
    padding: 14px 18px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
    text-align: left;
    white-space: normal;
    pointer-events: none;
}

#autohjul-attribute-popup.autohjul-attribute-popup.is-open {
    display: block;
}

/* Yellow arrow – right edge when popup is to the left of icon */
.autohjul-attribute-popup::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 100%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-right-color: #fef08a;
}

/* Arrow on left when popup is to the right of icon */
.autohjul-attribute-popup--left::before {
    right: auto;
    left: 100%;
    border-right-color: transparent;
    border-left-color: #fef08a;
}

/* Mobile: popup full width below trigger, arrow up */
@media (max-width: 480px) {
    #autohjul-attribute-popup.autohjul-attribute-popup {
        max-width: calc(100vw - 24px) !important;
        width: calc(100vw - 24px) !important;
    }
    .autohjul-attribute-popup--below::before {
        top: 0;
        left: 24px;
        right: auto;
        transform: translateY(-100%);
        border-right-color: transparent;
        border-left-color: transparent;
        border-bottom-color: #fef08a;
    }
}

.autohjul-product-card__attribute-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.autohjul-product-card__attribute-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.autohjul-product-card__attribute-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.autohjul-product-card__attribute-icon svg {
    width: 100%;
    height: 100%;
}

.autohjul-product-card__attribute-value {
    font-size: 15px;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 0;
    min-width: 28px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    clip-path: polygon(20% 0%, 0% 50%, 20% 100%, 100% 100%, 100% 0%);
}

/* Fuel: A=green, B=blue, C=yellow/orange, D=orange, E=red */
.autohjul-product-card__attribute-value--fuel {
    background: #f5a623;
    color: #000;
}

.autohjul-product-card__attribute-value--fuel[data-grade="A"] {
    background: #1e7e34;
    color: #fff;
}

.autohjul-product-card__attribute-value--fuel[data-grade="B"] {
    background: #0066cc;
    color: #fff;
}

/* Wet: A=green, B=blue, C=yellow, D=orange, E=red */
.autohjul-product-card__attribute-value--wet {
    background: #0066cc;
    color: #ffffff;
}

.autohjul-product-card__attribute-value--wet[data-grade="A"] {
    background: #1e7e34;
}

.autohjul-product-card__attribute-value--wet[data-grade="C"],
.autohjul-product-card__attribute-value--wet[data-grade="D"] {
    background: #f5a623;
    color: #000;
}

.autohjul-product-card__attribute-value-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Sound: dB value (plain) + class in green box */
.autohjul-product-card__attribute-sound-db {
    font-size: 14px;
    font-weight: bold;
    color: #000;
    flex-shrink: 0;
}

.autohjul-product-card__attribute-value--sound {
    background: #4caf50;
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 0;
}

/* Falgar 3-box attributes (Width×Dimension, ET, CB) – logo blue (#2196F3) color grading */
.autohjul-product-card__attributes--falgar {
    background: rgba(33, 150, 243, 0.08);
}

.autohjul-product-card__attribute--falgar-box {
    flex-direction: column;
    gap: 0;
}

.autohjul-product-card__attribute--falgar-box .autohjul-product-card__attribute-value--falgar {
    background: #2196F3;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 4px;
    clip-path: none;
    min-width: 0;
}

/* 3. Brand Name and Product Title */
.autohjul-product-card__title-section {
    padding: 12px 16px 8px;
    text-align: center;
}

.autohjul-product-card__brand {
    font-size: 16px;
    font-weight: 700;
    color: #000;
    margin-bottom: 4px;
    line-height: 1.3;
}

.autohjul-product-card__title {
    font-size: 14px;
    font-weight: 600;
    color: #000;
    margin: 0;
    line-height: 1.4;
    text-align: center;
}

.autohjul-product-card__title a {
    color: #000;
    text-decoration: none;
    transition: color 0.3s ease;
}

.autohjul-product-card__title a:hover {
    color: #0066cc;
}

/* 4. Price – black by default; red when 3+ years (DOT) via .autohjul-price-old */
.autohjul-product-card__price {
    padding: 0 16px 8px;
    font-size: 22px;
    font-weight: bold;
    color: #000;
    line-height: 1.2;
    text-align: center;
}

.autohjul-product-card__price-amount {
    color: inherit;
}

.autohjul-product-card__price-currency {
    font-size: 16px;
    font-weight: 400;
    color: inherit;
}

/* 5. Stock Information – centered */
.autohjul-product-card__stock {
    padding: 0 16px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    color: #000;
}

.autohjul-product-card__stock-label {
    font-weight: 500;
}

.autohjul-product-card__stock-quantity {
    font-weight: 600;
}

.autohjul-product-card__stock-info {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
}

.autohjul-product-card__stock-info i {
    font-style: italic;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    color: #fff;
}

.autohjul-product-card__stock-info--green {
    background: #4caf50;
    color: #ffffff;
}

.autohjul-product-card__stock-info--orange {
    background: #ff9800;
    color: #ffffff;
}

/* 6. Delivery Information – centered */
.autohjul-product-card__delivery {
    padding: 0 16px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    color: #000;
}

.autohjul-product-card__delivery-icon {
    width: 18px;
    height: 18px;
    color: #0066cc !important;
    flex-shrink: 0;
}

.autohjul-product-card__delivery-icon--black {
    color: #000 !important;
}

.autohjul-product-card__delivery-text {
    font-weight: 500;
    color: #0066cc;
    display: block;
}

.autohjul-product-card__delivery-text--black {
    color: #000 !important;
    display: block !important;
}

/* 7. Quantity and Add to Cart */
.autohjul-product-card__actions {
    padding: 0 16px 10px;
    display: flex;
    gap: 0;
    align-items: stretch;
    justify-content: center;
}

.autohjul-product-card__quantity-wrapper {
    flex: 0 0 auto;
}

.autohjul-product-card__quantity {
    width: 50px;
    height: 36px;
    padding: 0 6px;
    text-align: center;
    border: 1px solid #e0e0e0;
    border-radius: 6px 0 0 6px;
    background: #f0f4f8;
    font-size: 14px;
    font-weight: 600;
    color: #000;
    -moz-appearance: textfield;
}

.autohjul-product-card__quantity::-webkit-outer-spin-button,
.autohjul-product-card__quantity::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.autohjul-product-card__quantity:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.autohjul-product-card__quantity:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

.autohjul-product-card__add-to-cart {
    flex: 0 0 auto;
    height: 36px;
    padding: 0 16px;
    background: #0066cc;
    color: #ffffff;
    border: none;
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.autohjul-product-card__add-to-cart:hover:not(:disabled) {
    background: #0052a3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
}

.autohjul-product-card__add-to-cart:active:not(:disabled) {
    transform: translateY(0);
}

.autohjul-product-card__add-to-cart:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.autohjul-product-card__add-to-cart svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* 8. Quick View Link */
.autohjul-product-card__quick-view {
    padding: 0 16px 16px;
    text-align: center;
}

.autohjul-product-card__quick-view-link {
    display: inline-block;
    color: #0066cc;
    text-decoration: underline;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.3s ease;
    background: none;
    border: none;
    padding: 0;
}

.autohjul-product-card__quick-view-link:hover {
    color: #0052a3;
    text-decoration: underline;
}

/* Hide view cart buttons */
.added_to_cart,
.wc-forward,
.view-cart,
[data-cart-url] {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Smaller "Fri frakt till monteringsverkstad" badge on tablet/mobile */
    .autohjul-product-card__badge--shipping {
        width: 52px;
        height: 52px;
        top: 8px;
        right: 8px;
        padding: 3px;
    }
    .autohjul-product-card__badge-icon {
        width: 10px;
        height: 10px;
        margin-bottom: 2px;
    }
    .autohjul-product-card__badge-text {
        font-size: 5px;
        line-height: 1.05;
    }
    .autohjul-product-card__badge--utforsaljning {
        padding: 6px 10px;
    }
    .autohjul-product-card__badge--utforsaljning .autohjul-product-card__badge-text {
        font-size: 10px;
    }

    .autohjul-product-card__attributes {
        padding: 10px 12px;
        min-height: 48px;
    }
    
    .autohjul-product-card__attributes-inner {
        gap: 4px;
        flex-wrap: nowrap;
    }
    
    .autohjul-product-card__attribute {
        gap: 3px;
    }
    
    .autohjul-product-card__attribute-icon {
        width: 24px;
        height: 24px;
    }
    
    .autohjul-product-card__attribute-value {
        font-size: 12px;
        padding: 2px 6px;
        min-width: 24px;
    }
    
    .autohjul-product-card__attribute-sound-db {
        font-size: 12px;
    }
    
    .autohjul-product-card__attribute-value--sound {
        font-size: 12px;
        padding: 2px 5px;
    }
    
    .autohjul-product-card__title-section {
        padding: 10px 12px 6px;
    }
    
    .autohjul-product-card__brand {
        font-size: 15px;
    }
    
    .autohjul-product-card__title {
        font-size: 13px;
    }
    
    .autohjul-product-card__price {
        font-size: 20px;
        padding: 0 12px 6px;
    }
    
    .autohjul-product-card__stock,
    .autohjul-product-card__delivery {
        padding: 0 12px 6px;
    }
    
    .autohjul-product-card__actions {
        flex-direction: column;
        padding: 0 12px 8px;
    }
    
    .autohjul-product-card__quantity {
        width: 100%;
        border-radius: 8px;
        margin-bottom: 8px;
    }
    
    .autohjul-product-card__add-to-cart {
        width: 100%;
        border-radius: 8px;
    }
    
    .autohjul-product-card__quick-view {
        padding: 0 12px 12px;
    }
}

/* Mobile: smaller badge, slightly taller card, smaller attributes */
@media (max-width: 576px) {
    .autohjul-product-card--dack,
    .autohjul-product-card--falgar {
        min-width: 0;
        overflow: hidden;
        min-height: 420px;
    }
    .autohjul-product-card__inner {
        min-height: 420px;
    }
    .autohjul-product-card__badge--utforsaljning {
        padding: 5px 8px;
    }
    .autohjul-product-card__badge--utforsaljning .autohjul-product-card__badge-text {
        font-size: 9px;
    }

    /* Even smaller "Fri frakt" logo on mobile */
    .autohjul-product-card__badge--shipping {
        width: 44px;
        height: 44px;
        top: 6px;
        right: 6px;
        padding: 2px;
    }
    .autohjul-product-card__badge-icon {
        width: 8px;
        height: 8px;
        margin-bottom: 1px;
    }
    .autohjul-product-card__badge-text {
        font-size: 4px;
        line-height: 1;
    }
    .autohjul-product-card__image-wrapper {
        padding-top: 90%;
    }
    
    .autohjul-product-card__attributes {
        padding: 6px 0px;
        min-height: 40px;
    }
    
    .autohjul-product-card__attributes-inner {
        gap: 2px;
        flex-wrap: nowrap;
        justify-content: center;
    }
    
    .autohjul-product-card__attribute {
        gap: 1px;
        flex: 0 1 auto;
        min-width: 0;
    }
    
    .autohjul-product-card__attribute-icon {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }
    
    .autohjul-product-card__attribute-value {
        font-size: 10px;
        padding: 1px 4px;
        min-width: 18px;
    }
    
    .autohjul-product-card__attribute-sound-db {
        font-size: 10px;
    }
    
    .autohjul-product-card__attribute-value--sound {
        font-size: 10px;
        padding: 1px 3px;
    }
    
    .autohjul-product-card__attribute-tooltip {
        width: 12px;
        height: 12px;
        top: -4px;
    }
    
    .autohjul-product-card__tooltip-icon {
        font-size: 8px;
    }
    
    .autohjul-product-card__attributes-empty {
        font-size: 13px;
    }
    
    .autohjul-product-card__title-section {
        padding: 12px 14px 8px;
    }
    
    .autohjul-product-card__brand {
        font-size: 14px;
    }
    
    .autohjul-product-card__title {
        font-size: 12px;
    }
    
    .autohjul-product-card__price {
        font-size: 18px;
        padding: 0 14px 8px;
    }
    
    .autohjul-product-card__stock,
    .autohjul-product-card__delivery {
        padding: 0 14px 8px;
        font-size: 12px;
    }
    
    .autohjul-product-card__actions {
        padding: 0 14px 12px;
    }
    
    .autohjul-product-card__quick-view {
        padding: 0 14px 14px;
    }
    
    .autohjul-product-card__quick-view-link {
        font-size: 12px;
    }
}

/* Stock popup hidden content (source for click popup) */
.autohjul-stock-popup__hidden {
    display: none !important;
}

/* Body-level stock popup – I lager (huvudlager), Externt lager, Leveranstid + info */
#autohjul-stock-popup.autohjul-stock-popup {
    display: none;
    position: fixed;
    z-index: 999999;
    min-width: 280px;
    max-width: 360px;
    padding: 16px 18px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
    text-align: left;
    pointer-events: auto;
}
#autohjul-stock-popup.autohjul-stock-popup.is-open {
    display: block;
}
.autohjul-stock-popup__content {
    margin: 0;
}
.autohjul-stock-popup__row {
    margin-bottom: 8px;
}
.autohjul-stock-popup__row:last-of-type {
    margin-bottom: 0;
}
.autohjul-stock-popup__label--green {
    color: #27ae60;
    font-weight: 600;
}
.autohjul-stock-popup__info {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}
.autohjul-stock-popup__info-head {
    font-weight: 600;
    margin-bottom: 6px;
    color: #111;
}
.autohjul-stock-popup__info p {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #6b7280;
}
.autohjul-stock-popup__info p:last-child {
    margin-bottom: 0;
}
