/**
 * Web Product Card Styles
 * Enterprise-grade product card component for frontend
 */

/* ===== PRODUCT CARD BASE ===== */
.web-product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #f0f0f0;
}

.web-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    border-color: #e0e0e0;
}

.web-product-card--out-of-stock {
    opacity: 0.7;
}

/* ===== BADGES ===== */
.web-product-card__badges {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.web-product-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.web-product-badge--discount {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #fff;
}

.web-product-badge--new {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #fff;
}

.web-product-badge--out {
    background: #6b7280;
    color: #fff;
}

.web-product-badge--moq {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
}

/* ===== QUICK ACTIONS ===== */
.web-product-card__quick-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.3s ease;
    z-index: 10;
}

/* Desktop: show on hover */
.web-product-card:hover .web-product-card__quick-actions {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Mobile: show when card is touched/tapped (via JS class) */
.web-product-card.is-touched .web-product-card__quick-actions {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.web-product-card__action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: all 0.2s ease;
}

.web-product-card__action-btn svg {
    width: 18px;
    height: 18px;
}

.web-product-card__action-btn:hover {
    background: #0d4f3c;
    color: #fff;
    transform: scale(1.1);
}

.web-product-card__action-btn.active {
    background: #dc2626;
    color: #fff;
}

.web-product-card__action-btn.active svg {
    fill: currentColor;
}

/* ===== MEDIA/IMAGE ===== */
.web-product-card__media {
    position: relative;
    background: #f8f8f8;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border-radius: 16px 16px 0 0;
}

.web-product-card__media a {
    display: block;
    margin: 0;
    padding: 0;
}

.web-product-card__image {
    width: 100%;
    height: auto;
    display: block;
    margin: 0;
    padding: 0;
    transition: transform 0.4s ease;
}

.web-product-card:hover .web-product-card__image {
    transform: scale(1.05);
}

/* Stock Badge */
.web-product-card__stock {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    padding: 4px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #16a34a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.web-stock-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.web-stock-dot--in-stock {
    background: #16a34a;
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.web-stock-dot--low-stock {
    background: #f59e0b;
}

.web-stock-dot--out-of-stock {
    background: #dc2626;
}

/* ===== BODY ===== */
.web-product-card__body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

/* Mobile: reduce body padding */
@media (max-width: 767.98px) {
    .web-product-card__body {
        padding: 8px;
        gap: 4px;
    }
}

/* Category */
.web-product-card__category {
    font-size: 11px;
    color: #16a34a;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Title */
.web-product-card__title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.3;
}

.web-product-card__title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.web-product-card__title a:hover {
    color: #0d4f3c;
}

/* Rating */
.web-product-card__rating {
    display: flex;
    align-items: center;
    gap: 6px;
}

.web-product-card__stars {
    display: flex;
    gap: 2px;
}

.web-product-card__stars svg {
    width: 14px;
    height: 14px;
    fill: #e5e7eb;
    stroke: none;
}

.web-product-card__stars svg.filled {
    fill: #fbbf24;
}

.web-product-card__review-count {
    font-size: 12px;
    color: #9ca3af;
}

/* Pricing */
.web-product-card__pricing {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 4px;
}

.web-product-card__price {
    font-size: 15px;
    font-weight: 700;
    color: #16a34a;
}

.web-product-card__price-original {
    font-size: 13px;
    color: #9ca3af;
    text-decoration: line-through;
}

/* ===== FOOTER ===== */
.web-product-card__footer {
    margin-top: 6px;
}

/* Add to Cart Button */
.web-btn-add-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.web-btn-add-cart svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Direct Add to Cart (Green Button) */
.web-btn-add-cart--direct {
    background: linear-gradient(135deg, #0d4f3c 0%, #145a4a 100%);
    color: #fff;
}

.web-btn-add-cart--direct:hover {
    background: linear-gradient(135deg, #0a3d2e 0%, #0d4f3c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 79, 60, 0.3);
}

.web-btn-add-cart--direct:active {
    transform: translateY(0);
}

/* Options Button (Outline) */
.web-btn-add-cart--options {
    background: #fff;
    color: #0d4f3c;
    border: 2px solid #0d4f3c;
}

.web-btn-add-cart--options:hover {
    background: #0d4f3c;
    color: #fff;
}

/* Disabled Button */
.web-btn-add-cart--disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Loading State */
.web-btn-add-cart.loading .web-btn-text {
    opacity: 0;
}

.web-btn-add-cart.loading .web-btn-spinner {
    opacity: 1;
}

.web-btn-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s ease;
}

.web-btn-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.web-btn-spinner svg {
    width: 18px;
    height: 18px;
    animation: web-btn-spin 0.8s linear infinite;
}

/* Spinner in circle button */
.web-product-card__qty-row .web-btn-add-cart--direct .web-btn-spinner svg {
    width: 16px;
    height: 16px;
}

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

/* ===== QUANTITY PICKER ===== */
.web-product-card__qty-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    flex-wrap: nowrap;
    overflow: visible;
}

.web-qty-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    flex: 1;
    height: 40px;
    overflow: hidden;
}

.web-qty-picker__btn {
    width: 36px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    color: #0d4f3c;
    transition: all 0.15s ease;
}

.web-qty-picker__btn--minus {
    border-right: 1px solid #e0e0e0;
}

.web-qty-picker__btn--plus {
    border-left: 1px solid #e0e0e0;
}

.web-qty-picker__btn:hover {
    background: #0d4f3c;
    color: #fff;
}

.web-qty-picker__btn:active {
    background: #0a3d2e;
    color: #fff;
}

.web-qty-picker__btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

.web-qty-picker__input {
    flex: 1;
    min-width: 36px;
    max-width: 50px;
    height: 38px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #0d4f3c;
    border: none;
    background: transparent;
    padding: 0;
    -moz-appearance: textfield;
    cursor: text;
}

.web-qty-picker__input:focus {
    outline: none;
    background: #f0fdf4;
}

.web-qty-picker__input::selection {
    background: rgba(13, 79, 60, 0.15);
}

.web-qty-picker__input::-webkit-outer-spin-button,
.web-qty-picker__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Add to cart button in qty row - mobile: circle icon only */
.web-product-card__qty-row .web-btn-add-cart--direct {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

/* Hide text on mobile */
.web-product-card__qty-row .web-btn-add-cart--direct .web-btn-add-cart__text {
    display: none;
}

/* Desktop: show text, expand button to fit icon + text */
@media (min-width: 992px) {
    .web-product-card__qty-row {
        gap: 8px;
    }
    
    .web-product-card__qty-row .web-btn-add-cart--direct {
        flex: 1 1 auto;
        width: auto;
        min-width: 140px;
        height: 38px;
        padding: 0 18px;
        border-radius: 10px;
        gap: 8px;
    }
    
    .web-product-card__qty-row .web-btn-add-cart--direct .web-btn-add-cart__text {
        display: inline;
        font-size: 13px;
        font-weight: 600;
        white-space: nowrap;
    }
}

@media (max-width: 767.98px) {
    .web-product-card {
        overflow: hidden !important;
    }
    
    .web-product-card__body {
        padding: 10px !important;
        overflow: hidden !important;
    }
    
    .web-product-card__qty-row {
        gap: 4px !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        overflow: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .web-product-card__qty-row .web-qty-picker {
        flex: 1 1 auto !important;
        max-width: calc(100% - 40px) !important;
        height: 32px !important;
        min-width: 0 !important;
    }
    
    .web-product-card__qty-row .web-qty-picker__btn {
        width: 26px !important;
        height: 30px !important;
        flex-shrink: 0 !important;
        padding: 0 !important;
    }
    
    .web-product-card__qty-row .web-qty-picker__btn svg {
        width: 12px !important;
        height: 12px !important;
    }

    .web-product-card__qty-row .web-qty-picker__input {
        flex: 1 !important;
        min-width: 24px !important;
        max-width: 32px !important;
        font-size: 13px !important;
        height: 30px !important;
    }
    
    .web-product-card__qty-row .web-btn-add-cart--direct {
        flex: 0 0 32px !important;
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        flex-shrink: 0 !important;
        border-radius: 8px !important;
        padding: 0 !important;
    }
    
    .web-product-card__qty-row .web-btn-add-cart--direct svg {
        width: 14px !important;
        height: 14px !important;
    }
    
    .web-product-card__footer {
        margin-top: 8px !important;
        overflow: hidden !important;
    }
}

/* ===== PRODUCT GRID ===== */
.web-product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (min-width: 480px) {
    .web-product-grid {
        gap: 12px;
    }
}

@media (min-width: 576px) {
    .web-product-grid {
        gap: 16px;
    }
}

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

@media (min-width: 992px) {
    .web-product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }
}

/* ===== SECTION HEADER ===== */
.web-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 0;
}

.web-section-header__left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.web-section-header__title {
    font-size: 24px;
    font-weight: 700;
    color: #0d4f3c;
    margin: 0;
    letter-spacing: -0.3px;
}

.web-section-header__subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.web-section-header__link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #0d4f3c;
    text-decoration: none;
    transition: gap 0.2s ease;
}

.web-section-header__link:hover {
    gap: 10px;
    color: #16a34a;
}

.web-section-header__link svg {
    width: 18px;
    height: 18px;
}

/* ===== FEATURED SECTION ===== */
.web-featured-section {
    padding: 48px 0;
    background: linear-gradient(180deg, #fafafa 0%, #fff 100%);
}

.web-featured-section > .container {
    padding-left: 15px;
    padding-right: 15px;
}

@media (max-width: 767px) {
    .web-featured-section {
        padding: 24px 0;
    }
    
    .web-featured-section > .container {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* ===== CART COUNT ANIMATION ===== */
.navbar-tool-label.cart-updated {
    animation: cartBadgePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background-color: #28a745 !important;
}

@keyframes cartBadgePop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.4);
    }
    100% {
        transform: scale(1);
    }
}

@media (max-width: 767px) {
    .web-section-header {
        margin-bottom: 16px;
        padding: 0;
    }
    
    .web-section-header__title {
        font-size: 18px;
    }
    
    .web-section-header__subtitle {
        font-size: 12px;
    }
    
    .web-section-header__link {
        font-size: 13px;
    }
    
    .web-section-header__link svg {
        width: 16px;
        height: 16px;
    }
    
    .web-product-card__title {
        font-size: 13px;
        min-height: 36px;
    }
    
    .web-product-card__price {
        font-size: 15px;
    }
    
    .web-product-card__price-original {
        font-size: 11px;
    }
    
    .web-btn-add-cart {
        padding: 10px 12px;
        font-size: 12px;
    }
}

/* ===== HEADER CART ICON STYLING ===== */
.navbar-tool.dropdown .navbar-tool-icon-box.bg-secondary {
    background: linear-gradient(135deg, #0d4f3c 0%, #145a4a 100%) !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(13, 79, 60, 0.25);
    transition: all 0.2s ease;
}

.navbar-tool.dropdown .navbar-tool-icon-box.bg-secondary:hover {
    background: linear-gradient(135deg, #0a3d2e 0%, #0d4f3c 100%) !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(13, 79, 60, 0.35);
}

.navbar-tool.dropdown .navbar-tool-icon-box .navbar-tool-icon.czi-cart {
    color: #fff !important;
}

/* Cart counter - red badge */
.navbar-tool.dropdown .navbar-tool-label {
    background: #dc2626 !important;
    color: #fff !important;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: 11px;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

/* Cart dropdown improvements */
.navbar-tool.dropdown .dropdown-menu.cart-dropdown {
    min-width: 320px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    overflow: hidden;
}

/* Mobile: Touch to show dropdown - same as desktop hover */
@media (max-width: 991.98px) {
    .navbar-tool.dropdown.cart-touch-open > .dropdown-menu.cart-dropdown {
        display: block;
    }
}
