/**
 * WooCommerce Gift Products - Frontend Styles
 * Version 1.0.5
 */

/* Popup Overlay */
.wcgp-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.wcgp-popup-overlay.wcgp-visible {
    opacity: 1;
    visibility: visible;
}

/* Popup Container */
.wcgp-popup {
    background: #fff;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    border: 2px solid #fcc52c;
}

.wcgp-popup-overlay.wcgp-visible .wcgp-popup {
    transform: translateY(0) scale(1);
}

/* Close Button */
.wcgp-popup-close {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    z-index: 10;
}

[dir="rtl"] .wcgp-popup-close {
    left: auto;
    right: 15px;
}

.wcgp-popup-close:hover {
    background: rgba(255,255,255,0.5);
    color: #000;
}

/* Popup Header */
.wcgp-popup-header {
    position: relative;
    text-align: center;
    padding: 30px 20px 20px;
    background: linear-gradient(135deg, #fcc52c 0%, #d4a520 100%);
    color: #000;
}

.wcgp-popup-icon {
    font-size: 48px;
    margin-bottom: 10px;
    animation: wcgp-bounce 1s ease infinite;
}

@keyframes wcgp-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.wcgp-popup-title {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 700;
    color: #000;
}

.wcgp-popup-description {
    margin: 0;
    opacity: 0.8;
    font-size: 15px;
    color: #333;
}

/* Popup Content */
.wcgp-popup-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Section Titles */
.wcgp-section-title {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wcgp-section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #fcc52c 0%, #d4a520 100%);
    border-radius: 2px;
}

/* Available Gifts Section */
.wcgp-available-gifts-section {
    margin-bottom: 25px;
}

/* Upcoming Gifts Section */
.wcgp-upcoming-gifts-section {
    padding-top: 20px;
    border-top: 1px dashed #ddd;
}

.wcgp-upcoming-gifts-section .wcgp-section-title::before {
    background: #ccc;
}

/* Gifts Grid */
.wcgp-gifts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

/* Gift Card */
.wcgp-gift-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.wcgp-gift-card.wcgp-available {
    border-color: #fcc52c;
}

.wcgp-gift-card.wcgp-available:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(252, 197, 44, 0.25);
}

.wcgp-gift-card.wcgp-locked {
    opacity: 0.7;
}

/* Gift Image */
.wcgp-gift-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%;
    background: #f5f5f5;
    overflow: hidden;
}

.wcgp-gift-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wcgp-gift-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    opacity: 0.5;
}

.wcgp-gift-locked-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcgp-lock-icon {
    font-size: 32px;
    filter: grayscale(1);
}

/* Gift Info */
.wcgp-gift-info {
    padding: 15px;
}

.wcgp-gift-name {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.wcgp-gift-description {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

/* Free Badge */
.wcgp-gift-free-badge {
    display: inline-block;
    background: linear-gradient(135deg, #fcc52c 0%, #d4a520 100%);
    color: #000;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
}

/* Need More Message */
.wcgp-gift-need-more {
    background: #fff3e0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    color: #e65100;
    text-align: center;
}

.wcgp-gift-need-more strong {
    display: block;
    font-size: 14px;
    margin: 4px 0;
}

/* Buttons */
.wcgp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.wcgp-btn-primary {
    background: linear-gradient(135deg, #fcc52c 0%, #d4a520 100%);
    color: #000;
    font-weight: 700;
}

.wcgp-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(252, 197, 44, 0.4);
}

.wcgp-btn-primary:active {
    transform: translateY(0);
}

.wcgp-btn-secondary {
    background: #333;
    color: #fff;
}

.wcgp-btn-secondary:hover {
    background: #000;
}

.wcgp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Popup Footer */
.wcgp-popup-footer {
    padding: 15px 20px;
    background: #f5f5f5;
    border-top: 1px solid #eee;
    text-align: center;
}

.wcgp-popup-footer .wcgp-btn {
    width: auto;
    min-width: 120px;
}

/* Success Animation */
.wcgp-success-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000000;
    background: #fff;
    padding: 30px 50px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: wcgp-pop-in 0.3s ease;
}

@keyframes wcgp-pop-in {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.wcgp-success-icon {
    font-size: 64px;
    margin-bottom: 15px;
    color: #4caf50;
}

.wcgp-success-message {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* Cart Gift Badge */
.wcgp-cart-gift-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #fcc52c 0%, #d4a520 100%);
    color: #000;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Loading Spinner */
.wcgp-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 50%;
    border-top-color: #000;
    animation: wcgp-spin 0.8s linear infinite;
}

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

/* ==================== */
/* Cart Gift Button     */
/* ==================== */

.wcgp-cart-gift-button-wrapper {
    margin: 15px 0;
    text-align: center;
}

.wcgp-cart-gift-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    background: linear-gradient(135deg, #fcc52c 0%, #d4a520 100%);
    color: #000;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(252, 197, 44, 0.4);
}

.wcgp-cart-gift-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(252, 197, 44, 0.5);
}

.wcgp-cart-gift-button .wcgp-gift-icon {
    font-size: 24px;
    animation: wcgp-shake 0.5s ease-in-out infinite;
}

/* Pulse Animation */
.wcgp-cart-gift-button.wcgp-pulse {
    animation: wcgp-pulse-animation 2s ease-in-out infinite;
}

@keyframes wcgp-pulse-animation {
    0% {
        box-shadow: 0 0 0 0 rgba(252, 197, 44, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(252, 197, 44, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(252, 197, 44, 0);
    }
}

@keyframes wcgp-shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* Responsive */
@media (max-width: 600px) {
    .wcgp-popup {
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .wcgp-popup-overlay {
        padding: 0;
    }
    
    .wcgp-gifts-grid {
        grid-template-columns: 1fr;
    }
    
    .wcgp-popup-header {
        padding: 20px 15px 15px;
    }
    
    .wcgp-popup-icon {
        font-size: 36px;
    }
    
    .wcgp-popup-title {
        font-size: 20px;
    }
    
    .wcgp-cart-gift-button {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .wcgp-cart-gift-button .wcgp-gift-icon {
        font-size: 20px;
    }
}

/* RTL Support */
[dir="rtl"] .wcgp-section-title::before {
    margin-left: 8px;
    margin-right: 0;
}

[dir="rtl"] .wcgp-popup-content {
    text-align: right;
}

[dir="rtl"] .wcgp-gift-info {
    text-align: right;
}
