/**
 * BOGO Deals - Frontend Styles
 */

/* ================================
   BADGE STYLES
   ================================ */

.bogo-deal-badge {
    position: absolute;
    z-index: 10;
    padding: 0;
    border-radius: 0;
    animation: bogo-badge-pulse 2s ease-in-out infinite;
    pointer-events: none;
}

.bogo-deal-badge .bogo-badge-image {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Badge Positions */
.bogo-badge-top-right {
    top: 10px;
    right: 10px;
}

.bogo-badge-top-left {
    top: 10px;
    left: 10px;
}

.bogo-badge-bottom-right {
    bottom: 10px;
    right: 10px;
}

.bogo-badge-bottom-left {
    bottom: 10px;
    left: 10px;
}

/* Badge Animation */
@keyframes bogo-badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

/* Badge in loop - ensure parent has position relative */
.woocommerce ul.products li.product .bogo-deal-badge,
.woocommerce-page ul.products li.product .bogo-deal-badge {
    position: absolute;
}

ul.products li.product {
    position: relative;
}

/* Single product badge */
.bogo-badge-single {
    position: absolute;
    z-index: 100;
}

.woocommerce-product-gallery {
    position: relative;
}

/* ================================
   DEAL INFO BOX
   ================================ */

.bogo-deal-info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    margin: 15px 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #e74c3c;
    border-radius: 8px;
}

.bogo-deal-info-icon {
    font-size: 28px;
    line-height: 1;
}

.bogo-deal-info-content {
    flex: 1;
}

.bogo-deal-info-title {
    display: block;
    color: #e74c3c;
    font-size: 14px;
    margin-bottom: 4px;
}

.bogo-deal-info-name {
    display: block;
    color: #666;
    font-size: 12px;
}

/* ================================
   GIFT POPUP
   ================================ */

.bogo-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bogo-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.bogo-popup-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: bogo-popup-slide 0.3s ease-out;
}

@keyframes bogo-popup-slide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bogo-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f1f1f1;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.bogo-popup-close:hover {
    background: #e74c3c;
    color: #fff;
}

.bogo-popup-title {
    text-align: center;
    font-size: 24px;
    color: #333;
    margin: 0 0 8px 0;
}

.bogo-popup-subtitle {
    text-align: center;
    color: #666;
    margin: 0 0 25px 0;
}

/* Gift Options Grid */
.bogo-gift-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.bogo-gift-option {
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.bogo-gift-option:hover {
    border-color: #e74c3c;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.2);
}

.bogo-gift-option.selected {
    border-color: #e74c3c;
    background: #fff5f4;
}

.bogo-gift-option img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.bogo-gift-option-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.bogo-gift-option-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.bogo-gift-option-price .free-badge {
    display: inline-block;
    padding: 3px 8px;
    background: #27ae60;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Popup Actions */
.bogo-popup-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.bogo-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.bogo-btn-primary {
    background: #e74c3c;
    color: #fff;
}

.bogo-btn-primary:hover {
    background: #c0392b;
}

.bogo-btn-secondary {
    background: #f1f1f1;
    color: #666;
}

.bogo-btn-secondary:hover {
    background: #e1e1e1;
}

/* ================================
   GIFT NOTIFICATION
   ================================ */

.bogo-gift-notification {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 20px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    border-radius: 8px;
    color: #fff;
    animation: bogo-notification-bounce 0.5s ease-out;
}

@keyframes bogo-notification-bounce {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.bogo-notification-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.bogo-notification-icon {
    font-size: 28px;
}

.bogo-notification-text {
    font-size: 15px;
    font-weight: 500;
}

.bogo-choose-gift-btn {
    padding: 10px 20px;
    background: #fff;
    color: #27ae60;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.bogo-choose-gift-btn:hover {
    background: #f8f8f8;
    transform: scale(1.05);
}

/* ================================
   CART STYLES
   ================================ */

.bogo-cart-gift-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 8px;
    background: #27ae60;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    vertical-align: middle;
}

.bogo-cart-savings {
    display: block;
    margin-top: 5px;
    color: #27ae60;
    font-size: 12px;
    font-weight: 600;
}

.bogo-gift-quantity {
    display: inline-block;
    padding: 5px 12px;
    background: #f1f1f1;
    border-radius: 4px;
    font-weight: 600;
}

/* ================================
   LOADING STATE
   ================================ */

.bogo-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.bogo-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid #f1f1f1;
    border-top-color: #e74c3c;
    border-radius: 50%;
    animation: bogo-spin 0.8s linear infinite;
}

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

/* ================================
   RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    .bogo-popup-content {
        padding: 20px;
        margin: 15px;
        width: calc(100% - 30px);
    }
    
    .bogo-popup-title {
        font-size: 20px;
    }
    
    .bogo-gift-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .bogo-gift-option img {
        height: 80px;
    }
    
    .bogo-notification-content {
        flex-direction: column;
        text-align: center;
    }
    
    .bogo-deal-badge {
        padding: 4px 8px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .bogo-gift-options {
        grid-template-columns: 1fr;
    }
}
