/* WooCommerce Upsell Gift Plugin Styles */

.discounted-gift-label {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    margin-left: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 2px rgba(220, 53, 69, 0.3);
    display: block;
    white-space: nowrap;
    width: fit-content;
    margin-top: 4px;
}

.wc-upsell-gift-container {
    margin: 15px 0;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.wc-upsell-message {
    margin-bottom: 15px;
    text-align: center;
}

.progress-text,
.congratulations-text,
.no-gifts-text {
    font-size: 14px;
    margin: 8px 0;
    font-weight: 500;
}

.congratulations-text {
    color: #28a745;
    font-weight: 700;
    font-size: 16px;
}

.no-gifts-text {
    color: #6c757d;
}

.gift-progress-container {
    position: relative;
    width: 100%;
    margin-bottom: 12px;
    background: white;
    padding: 3px;
    border-radius: 12px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.gift-progress-bar {
    width: 100%;
    height: 18px;
    background: #e9ecef;
    border-radius: 9px;
    overflow: hidden;
    position: relative;
}

.gift-progress {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997, #17a2b8);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 9px;
    position: relative;
    overflow: hidden;
}

.gift-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.wc-upsell-gift-selection {
    padding: 15px 0;
}

.wc-upsell-gift-selection h3 {
    color: #1e1e1e;
    font-size: 16px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.gift-options-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gift-option {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0;
    transition: all 0.2s ease;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.gift-option:hover {
    border-color: #007cba;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.1);
    transform: translateY(-1px);
}

.gift-option-unavailable {
    opacity: 0.6;
    pointer-events: none;
    filter: grayscale(30%);
}

.gift-content {
    display: flex;
    align-items: center;
    padding: 12px;
    gap: 12px;
}

.gift-image {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
}

.gift-image img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    margin: 0 !important;
}

.gift-details {
    flex: 1;
    min-width: 0;
}

.gift-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e1e1e;
    margin: 0 0 6px 0;
    line-height: 1.2;
}

.gift-pricing {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.original-price {
    text-decoration: line-through;
    color: #999;
    font-size: 12px;
}

.discounted-price {
    color: #28a745;
    font-weight: 600;
    font-size: 14px;
}

.discount-badge {
    background: #dc3545;
    color: white;
    padding: 2px 5px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.gift-threshold {
    font-size: 11px;
    color: #666;
    font-style: italic;
}

.gift-action {
    flex-shrink: 0;
    margin-left: auto;
}

.gift-add-to-cart-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.gift-add-to-cart-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.gift-unavailable-message {
    color: #721c24;
    background: #f8d7da;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #f5c6cb;
}

/* Mini cart modifications */
.shoptimizer-custom-quantity-mini-cart_container.discounted-gift-item {
    pointer-events: none;
    opacity: 0.8;
}

.shoptimizer-custom-quantity-mini-cart_container.discounted-gift-item .discounted-gift-quantity {
    display: inline-block;
    padding: 3px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f8f9fa;
    font-size: 11px;
    font-weight: 600;
}

/* Mobile Responsive Design - Optimized */
@media (max-width: 768px) {
    .wc-upsell-gift-container {
        margin: 8px 0;
        padding: 10px;
        border-radius: 6px;
    }
    
    .wc-upsell-gift-selection {
        padding: 8px 0;
    }
    
    .wc-upsell-gift-selection h3 {
        font-size: 14px;
        padding: 8px 10px;
        margin-bottom: 10px;
    }
    
    .gift-content {
        padding: 10px;
        gap: 10px;
    }
    
    .gift-image {
        width: 60px;
        height: 60px;
    }
    
    .gift-image img {
        width: 60px;
        height: 60px;
    }
    
    .gift-name {
        font-size: 13px;
        line-height: 1.3;
        margin-bottom: 4px;
    }
    
    .gift-add-to-cart-btn {
        padding: 8px 12px;
        font-size: 11px;
        min-width: 70px;
    }
    
    .progress-text,
    .congratulations-text,
    .no-gifts-text {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .gift-pricing {
        gap: 6px;
        margin-bottom: 3px;
    }
    
    .original-price {
        font-size: 11px;
    }
    
    .discounted-price {
        font-size: 13px;
    }
    
    .discount-badge {
        font-size: 9px;
        padding: 1px 4px;
    }
    
    .gift-threshold {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .wc-upsell-gift-container {
        margin: 6px 0;
        padding: 8px;
    }
    
    .wc-upsell-gift-selection {
        padding: 6px 0;
    }
    
    .wc-upsell-gift-selection h3 {
        font-size: 13px;
        padding: 6px 8px;
        margin-bottom: 8px;
    }
    
    .gift-content {
        padding: 8px;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .gift-image {
        width: 55px;
        height: 55px;
    }
    
    .gift-image img {
        width: 55px;
        height: 55px;
    }
    
    .gift-details {
        flex: 1;
        min-width: 150px;
    }
    
    .gift-name {
        font-size: 12px;
        margin-bottom: 3px;
    }
    
    .gift-pricing {
        flex-direction: row;
        gap: 4px;
        align-items: center;
        margin-bottom: 2px;
    }
    
    .original-price {
        font-size: 10px;
    }
    
    .discounted-price {
        font-size: 12px;
    }
    
    .discount-badge {
        font-size: 8px;
        padding: 1px 3px;
    }
    
    .gift-threshold {
        font-size: 9px;
        margin-bottom: 4px;
    }
    
    .gift-action {
        margin-left: 0;
        margin-top: 4px;
        width: 100%;
    }
    
    .gift-add-to-cart-btn {
        width: 100%;
        padding: 6px 8px;
        font-size: 10px;
        min-height: 32px;
    }
    
    .progress-text,
    .congratulations-text,
    .no-gifts-text {
        font-size: 12px;
        padding: 0 4px;
    }
    
    .gift-progress-bar {
        height: 16px;
    }
    
    .gift-options-container {
        gap: 6px;
    }
}

@media (max-width: 360px) {
    .wc-upsell-gift-container {
        margin: 4px 0;
        padding: 6px;
    }
    
    .wc-upsell-gift-selection h3 {
        font-size: 12px;
        padding: 5px 6px;
    }
    
    .gift-content {
        padding: 6px;
        gap: 6px;
    }
    
    .gift-image {
        width: 50px;
        height: 50px;
    }
    
    .gift-image img {
        width: 50px;
        height: 50px;
    }
    
    .gift-name {
        font-size: 11px;
        line-height: 1.2;
    }
    
    .gift-pricing {
        gap: 3px;
    }
    
    .original-price {
        font-size: 9px;
    }
    
    .discounted-price {
        font-size: 11px;
    }
    
    .discount-badge {
        font-size: 7px;
        padding: 1px 2px;
    }
    
    .gift-threshold {
        font-size: 8px;
    }
    
    .gift-add-to-cart-btn {
        font-size: 9px;
        padding: 5px 6px;
        min-height: 28px;
    }
    
    .progress-text,
    .congratulations-text,
    .no-gifts-text {
        font-size: 11px;
    }
}

/* Animation for gift loading */
.gift-option {
    animation: fadeInUp 0.4s ease forwards;
}

.gift-option:nth-child(2) {
    animation-delay: 0.05s;
}

.gift-option:nth-child(3) {
    animation-delay: 0.1s;
}

.gift-option:nth-child(4) {
    animation-delay: 0.15s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state styles */
.gift-loading {
    opacity: 0.6;
    pointer-events: none;
}

.gift-loading .gift-add-to-cart-btn {
    background: #6c757d;
    cursor: not-allowed;
}

.gift-loading .gift-add-to-cart-btn::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-left: 6px;
}

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

.underlined-number {
    position: relative;
    display: inline-block;
}

.underlined-number::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, #007cba, #0056b3);
    border-radius: 1px;
}

@media (max-width: 768px) {
    .underlined-number::after {
        bottom: -4px;
    }
}

@media (max-width: 480px) {
    .underlined-number::after {
        bottom: -3px;
    }
}

@media (max-width: 360px) {
    .underlined-number::after {
        bottom: -2px;
    }
}