/* ================================
   Product Variant Styles
   ================================ */

/* Size Items */
.size-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.size-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fff;
}

.size-item:hover:not(.out-of-stock):not(.disabled) {
    border-color: #000;
    background-color: #f8f8f8;
}

.size-item.active {
    border-color: #000;
    background-color: #000;
    color: #fff;
}

.size-item.out-of-stock,
.size-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    position: relative;
}

.size-item.out-of-stock::after,
.size-item.disabled::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #999;
    transform: rotate(-45deg);
}

/* Color Swatches */
.list-color-product {
    display: flex;
    gap: 8px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

.list-color-item {
    position: relative;
    cursor: pointer;
}

.list-color-item.active::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 2px solid #000;
    border-radius: 50%;
    pointer-events: none;
}

.list-color-item.out-of-stock {
    opacity: 0.4;
    cursor: not-allowed;
    position: relative;
}

.list-color-item.out-of-stock::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 32px;
    background-color: rgba(0, 0, 0, 0.5);
    transform: translate(-50%, -50%) rotate(45deg);
    z-index: 2;
}

.swatch-value {
    display: block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #e5e5e5;
}

/* Stock Indicators */
.stock-indicator {
    margin-top: 8px;
    font-size: 13px;
}

.stock-indicator .in-stock {
    color: #4caf50;
    font-weight: 500;
}

.stock-indicator .low-stock {
    color: #ff9800;
    font-weight: 500;
}

.stock-indicator .out-of-stock {
    color: #f44336;
    font-weight: 500;
}

/* Variant Messages */
.variant-required-message {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #f44336;
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    animation: slideInUp 0.3s ease;
    z-index: 10;
    margin-bottom: 8px;
}

.variant-required-message::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #f44336;
}

.add-to-cart-success {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4caf50;
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    animation: slideInUp 0.3s ease;
    z-index: 10;
    margin-bottom: 8px;
}

.add-to-cart-error {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #f44336;
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    animation: slideInUp 0.3s ease;
    z-index: 10;
    margin-bottom: 8px;
}

/* Loading State */
.quick-add.loading {
    pointer-events: none;
    opacity: 0.6;
}

.quick-add.loading .icon-bag::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Price Variant */
.price.variant-price {
    font-weight: 600;
    color: #000;
}

.old-price {
    text-decoration: line-through;
    color: #999;
    margin-right: 8px;
    font-size: 0.9em;
}

/* Image Transition */
.product-img img {
    transition: opacity 0.3s ease;
}

/* Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

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

/* Responsive Adjustments */
@media (max-width: 768px) {
    .size-item {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }

    .swatch-value {
        width: 26px;
        height: 26px;
    }

    .list-color-item.out-of-stock::before {
        height: 28px;
    }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    .size-item {
        border-color: #444;
        background-color: #1a1a1a;
        color: #fff;
    }

    .size-item:hover:not(.out-of-stock):not(.disabled) {
        background-color: #2a2a2a;
    }

    .size-item.active {
        background-color: #fff;
        color: #000;
    }

    .swatch-value {
        border-color: #444;
    }
}

/* ================================
   Discount Badge on Product Detail
   ================================ */
.tf-product-media-main {
    position: relative;
}

.discount-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
}

.discount-badge .badge {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.discount-badge .badge.bg-danger {
    background-color: #dc3545 !important;
    color: #fff !important;
}
