/**
 * WooCommerce Reward Gifts – Frontend Styles
 *
 * @package WCRG
 */

/* ─── Body offset for sticky progress bar ─────────────────── */
body.wcrg-has-progress-bar {
    /* Handled by the bar's sticky positioning; no offset needed
       since sticky doesn't remove the element from flow. */
}

/* ─── Section Container ───────────────────────────────────── */
.wcrg-reward-section {
    margin: 32px 0;
}

/* ─── Progress Message ────────────────────────────────────── */
.wcrg-progress-message {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 14px 20px;
    margin-bottom: 24px;
    text-align: center;
}

.wcrg-progress-message p {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #92400e;
}

/* ─── Checkout Nudge ──────────────────────────────────────── */
.wcrg-checkout-nudge {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border: 2px solid #3b82f6;
    border-radius: 8px;
    padding: 14px 20px;
    margin-bottom: 20px;
    text-align: center;
    animation: wcrg-pulse 2s ease-in-out infinite;
}

.wcrg-checkout-nudge p {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #1e40af;
}

@keyframes wcrg-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3); }
    50%      { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
}

/* ─── Reward Grid Wrap ────────────────────────────────────── */
.wcrg-reward-grid-wrap {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
}

.wcrg-reward-title {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.wcrg-reward-subtitle {
    margin: 0 0 20px;
    font-size: 14px;
    color: #6b7280;
}

/* ─── Product Grid ────────────────────────────────────────── */
.wcrg-reward-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
}

/* ─── Product Card ────────────────────────────────────────── */
.wcrg-product-card {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    display: flex;
    flex-direction: column;
}

.wcrg-product-card:hover {
    border-color: #a5b4fc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.wcrg-product-card.wcrg-selected {
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* ─── Card Image ──────────────────────────────────────────── */
.wcrg-card-image {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f3f4f6;
}

.wcrg-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wcrg-selected-check {
    position: absolute;
    top: 8px;
    right: 8px;
    min-width: 28px;
    height: 28px;
    padding: 0 10px;
    background: #22c55e;
    color: #fff;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

/* ─── Card Info ───────────────────────────────────────────── */
.wcrg-card-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wcrg-card-title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
}

.wcrg-card-original-price {
    margin: 0 0 8px;
    font-size: 12px;
    color: #9ca3af;
}

.wcrg-card-original-price del {
    color: #d1d5db;
}

/* ─── Variation Dropdown ──────────────────────────────────── */
.wcrg-variation-select {
    margin-bottom: 8px;
}

.wcrg-variation-dropdown {
    width: 100%;
    padding: 6px 8px;
    font-size: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
}

/* ─── Card Actions ────────────────────────────────────────── */
.wcrg-card-actions {
    margin-top: auto;
}

.wcrg-card-actions-row {
    display: flex;
    gap: 6px;
}

.wcrg-card-actions-row .button {
    flex: 1;
}

.wcrg-card-actions .button {
    width: 100%;
    text-align: center;
    font-size: 12px;
    padding: 8px 8px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
    line-height: 1.3;
}

.wcrg-add-reward {
    background: #4f46e5 !important;
    color: #fff !important;
    border: none !important;
}

.wcrg-add-reward:hover {
    background: #4338ca !important;
}

.wcrg-add-reward:disabled,
.wcrg-add-reward[disabled] {
    background: #d1d5db !important;
    color: #9ca3af !important;
    cursor: not-allowed;
}

.wcrg-add-reward.wcrg-loading {
    opacity: 0.7;
    pointer-events: none;
}

.wcrg-remove-reward {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border: 1px solid #fca5a5 !important;
}

.wcrg-remove-reward:hover {
    background: #fca5a5 !important;
    color: #991b1b !important;
}

/* ─── Cart reward indicators ──────────────────────────────── */
.wcrg-free-badge {
    display: inline-block;
    background: #dcfce7;
    color: #166534;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.wcrg-reward-tag {
    display: inline-block;
    font-size: 11px;
    color: #9333ea;
    font-weight: 600;
    vertical-align: middle;
}

.wcrg-locked-qty {
    display: inline-block;
    padding: 4px 12px;
    background: #f3f4f6;
    border-radius: 4px;
    color: #6b7280;
    font-weight: 600;
}

.wcrg-no-rewards {
    color: #6b7280;
    font-style: italic;
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
    .wcrg-reward-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .wcrg-reward-grid-wrap {
        padding: 16px;
    }

    .wcrg-card-info {
        padding: 8px;
    }

    .wcrg-card-title {
        font-size: 13px;
    }

    .wcrg-card-actions-row {
        flex-direction: column;
    }
}
