/**
 * Loyalty Point — Public Stylesheet (Mobile-first)
 *
 * Covers: Points display, Scratch & Win card, Prize results, Claim trigger
 *
 * @package Loyalty_Point
 */

/* =====================================================
   Base / Loyalty Section
   ===================================================== */
.loyalty-point-section {
    margin-top: 20px;
    border-radius: 16px;
    overflow: hidden;
}

.loyalty-step {
    padding: 24px 16px;
    text-align: center;
}

/* =====================================================
   Step 1: Points Display
   ===================================================== */
.loyalty-point-result {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 32px 20px;
    color: #fff;
}

.loyalty-congrats h3 {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #fff;
}

.loyalty-congrats p {
    font-size: 14px;
    margin: 0 0 20px 0;
    opacity: 0.9;
    line-height: 1.5;
}

/* Point Badge */
.loyalty-point-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 20px 40px;
    margin: 12px 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.loyalty-point-earned {
    font-size: 40px;
    font-weight: 800;
    color: #ffd700;
    line-height: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.loyalty-point-label {
    font-size: 14px;
    font-weight: 500;
    margin-top: 6px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Total Points */
.loyalty-point-total {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.loyalty-total-label {
    font-size: 13px;
    opacity: 0.8;
    display: block;
    margin-bottom: 4px;
}

.loyalty-total-value {
    font-size: 22px;
    font-weight: 700;
}

/* No scratch message */
.loyalty-no-scratch {
    margin-top: 16px;
    font-size: 13px;
    opacity: 0.8;
    font-style: italic;
}

/* =====================================================
   Buttons
   ===================================================== */
.loyalty-btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    margin-top: 20px;
    outline: none;
}

.loyalty-btn:active {
    transform: scale(0.97);
}

.loyalty-btn-primary {
    background: #fff;
    color: #667eea;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.loyalty-btn-primary:hover {
    background: #f0f0ff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.loyalty-btn-success {
    background: linear-gradient(135deg, #00b09b 0%, #96c93d 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 176, 155, 0.3);
}

.loyalty-btn-success:hover {
    box-shadow: 0 6px 20px rgba(0, 176, 155, 0.4);
}

.loyalty-btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* =====================================================
   Step 2: Scratch & Win Card
   ===================================================== */
.loyalty-scratch-wrapper {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 16px;
    padding: 28px 20px;
    color: #fff;
}

.loyalty-scratch-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: #fff;
}

.loyalty-scratch-subtitle {
    font-size: 14px;
    margin: 0 0 24px 0;
    opacity: 0.9;
}

/* Scratch Card Container */
.loyalty-scratch-card-container {
    position: relative;
    width: 300px;
    height: 200px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    background: #fff;
}

.loyalty-scratch-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 2;
    border-radius: 12px;
}

/* Result underneath canvas */
.loyalty-scratch-result {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    background: #fff;
    border-radius: 12px;
}

.loyalty-result-content {
    text-align: center;
    padding: 16px;
    color: #333;
}

.loyalty-result-icon {
    font-size: 48px;
    margin-bottom: 8px;
    line-height: 1;
}

.loyalty-result-content h4 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: #333;
}

.loyalty-prize-name {
    font-size: 16px;
    font-weight: 600;
    color: #667eea;
    margin: 4px 0;
}

.loyalty-prize-desc {
    font-size: 13px;
    color: #666;
    margin: 4px 0 0 0;
}

/* Scratch result revealed state */
.loyalty-scratch-result.revealed {
    animation: loyaltyRevealPulse 0.6s ease-out;
}

@keyframes loyaltyRevealPulse {
    0% { transform: scale(0.9); opacity: 0.5; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* Progress Bar */
.loyalty-scratch-progress {
    width: 100%;
    max-width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 16px auto 0;
    overflow: hidden;
}

.loyalty-scratch-progress-bar {
    height: 100%;
    background: #ffd700;
    border-radius: 2px;
    width: 0;
    transition: width 0.3s ease;
}

/* =====================================================
   Step 3: After Reveal
   ===================================================== */

/* Winner */
.loyalty-win-celebration {
    background: linear-gradient(135deg, #00b09b 0%, #96c93d 100%);
    border-radius: 16px;
    padding: 32px 20px;
    color: #fff;
    text-align: center;
}

.loyalty-result-icon-lg {
    font-size: 64px;
    margin-bottom: 12px;
    line-height: 1;
}

.loyalty-win-celebration h3 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #fff;
}

.loyalty-prize-name-lg {
    font-size: 20px;
    font-weight: 600;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.2);
    display: inline-block;
    padding: 8px 24px;
    border-radius: 8px;
}

.loyalty-win-instruction {
    font-size: 14px;
    opacity: 0.9;
    margin: 12px 0 0 0;
}

/* Loser */
.loyalty-lose-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 32px 20px;
    color: #fff;
    text-align: center;
}

.loyalty-lose-info h3 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: #fff;
}

.loyalty-lose-info p {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.loyalty-point-summary {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* =====================================================
   Animations
   ===================================================== */
@keyframes loyaltyFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loyalty-step {
    animation: loyaltyFadeInUp 0.4s ease-out;
}

/* Sparkle animation for point badge */
@keyframes loyaltySparkle {
    0%, 100% { text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
    50% { text-shadow: 0 2px 20px rgba(255, 215, 0, 0.6), 0 0 40px rgba(255, 215, 0, 0.3); }
}

.loyalty-point-earned {
    animation: loyaltySparkle 2s ease-in-out infinite;
}

/* =====================================================
   Responsive — Small screens (< 360px)
   ===================================================== */
@media (max-width: 359px) {
    .loyalty-scratch-card-container {
        width: 260px;
        height: 173px;
    }

    .loyalty-scratch-progress {
        max-width: 260px;
    }

    .loyalty-point-badge {
        padding: 16px 28px;
    }

    .loyalty-point-earned {
        font-size: 32px;
    }

    .loyalty-btn {
        padding: 12px 24px;
        font-size: 14px;
    }

    .loyalty-claim-actions {
        flex-direction: column;
    }

    .loyalty-claim-form-wrapper {
        padding: 20px 16px;
    }

    .loyalty-checkout-input-row {
        flex-direction: column;
    }
}

/* =====================================================
   Responsive — Medium phones (360px - 479px)
   ===================================================== */
@media (min-width: 360px) and (max-width: 479px) {
    .loyalty-step {
        padding: 20px 14px;
    }

    .loyalty-claim-actions {
        flex-wrap: wrap;
    }
}

/* =====================================================
   Step 4: Claim Form
   ===================================================== */
.loyalty-claim-form-section {
    margin-top: 20px;
    animation: loyaltyFadeInUp 0.4s ease-out;
}

.loyalty-claim-form-wrapper {
    background: #fff;
    border-radius: 16px;
    padding: 28px 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.loyalty-claim-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: #333;
    text-align: center;
}

.loyalty-claim-subtitle {
    font-size: 14px;
    color: #666;
    text-align: center;
    margin: 0 0 20px 0;
}

.loyalty-claim-prize-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
}

.loyalty-claim-prize-info strong {
    font-size: 16px;
}

.loyalty-claim-prize-info small {
    display: block;
    margin-top: 4px;
    opacity: 0.9;
}

.loyalty-form-group {
    margin-bottom: 16px;
}

.loyalty-form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 6px;
}

.loyalty-form-group label .required {
    color: #d63638;
}

.loyalty-form-group input[type="text"],
.loyalty-form-group input[type="email"],
.loyalty-form-group input[type="tel"],
.loyalty-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.loyalty-form-group input:focus,
.loyalty-form-group textarea:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.loyalty-form-group input[type="file"] {
    font-size: 13px;
}

.loyalty-form-hint {
    font-size: 12px;
    color: #888;
    margin: 4px 0 0 0;
}

.loyalty-claim-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.loyalty-btn-secondary {
    background: #f0f0f1;
    color: #50575e;
}

.loyalty-btn-secondary:hover {
    background: #e0e0e1;
}

/* Claim Success */
.loyalty-claim-success {
    text-align: center;
    padding: 32px 20px;
}

.loyalty-claim-success h3 {
    font-size: 22px;
    font-weight: 700;
    color: #00a32a;
    margin: 12px 0 8px 0;
}

.loyalty-claim-success p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

/* =====================================================
   WooCommerce Checkout — Redeem Points
   ===================================================== */
.loyalty-checkout-redeem {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    color: #fff;
}

.loyalty-checkout-redeem h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.loyalty-checkout-balance {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 12px;
}

.loyalty-checkout-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.loyalty-checkout-input-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 14px;
}

.loyalty-checkout-input-row input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.loyalty-checkout-input-row button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.loyalty-checkout-apply {
    background: #fff;
    color: #667eea;
}

.loyalty-checkout-apply:hover {
    background: #f0f0ff;
}

.loyalty-checkout-remove {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.loyalty-checkout-remove:hover {
    background: rgba(255, 255, 255, 0.3);
}

#loyalty-discount-preview {
    margin-top: 8px;
    font-size: 13px;
    min-height: 18px;
}

.loyalty-preview-success {
    color: #90ee90;
}

.loyalty-preview-error {
    color: #ffb3b3;
}

/* =====================================================
   Responsive — Tablet+
   ===================================================== */
@media (min-width: 768px) {
    .loyalty-point-section {
        max-width: 480px;
        margin-left: auto;
        margin-right: auto;
    }

    .loyalty-point-result,
    .loyalty-scratch-wrapper,
    .loyalty-win-celebration,
    .loyalty-lose-info {
        padding: 36px 28px;
    }

    .loyalty-congrats h3,
    .loyalty-scratch-title,
    .loyalty-win-celebration h3,
    .loyalty-lose-info h3 {
        font-size: 28px;
    }

    .loyalty-point-earned {
        font-size: 48px;
    }
}
