/**
 * Frontend styles for WP Lifetime Loyalty
 * Minimal styling that works with any theme
 */

/* General loyalty notices */

.woocommerce-MyAccount-navigation ul li.woocommerce-MyAccount-navigation-link--loyalty a:before {
	mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtZ2lmdC1pY29uIGx1Y2lkZS1naWZ0Ij48cmVjdCB4PSIzIiB5PSI4IiB3aWR0aD0iMTgiIGhlaWdodD0iNCIgcng9IjEiLz48cGF0aCBkPSJNMTIgOHYxMyIvPjxwYXRoIGQ9Ik0xOSAxMnY3YTIgMiAwIDAgMS0yIDJIN2EyIDIgMCAwIDEtMi0ydi03Ii8+PHBhdGggZD0iTTcuNSA4YTIuNSAyLjUgMCAwIDEgMC01QTQuOCA4IDAgMCAxIDEyIDhhNC44IDggMCAwIDEgNC41LTUgMi41IDIuNSAwIDAgMSAwIDUiLz48L3N2Zz4=)
}

tr.fee {
    text-wrap: nowrap;
}

.loyalty-notice {
    background: #f0f0f0;
    padding: 10px 15px;
    margin: 10px 0;
    border-left: 3px solid #2ea2cc;
    border-radius: 3px;
    font-size: 14px;
}

.loyalty-guest-notice {
    border-left-color: #2ea2cc;
    background: #f0fbff;
}

.loyalty-guest-notice p {
    margin: 0;
}

.loyalty-member-notice {
    border-left-color: #28a745;
    background: #f0fff4;
}

.loyalty-member-notice p {
    margin: 0;
}

/* Cart loyalty elements */

.loyalty-prompt {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px;
    background: #fff;
    border: 1px solid #ddd;
    padding: 15px;
    margin: 15px 0;
    border-radius: 5px;
    text-align: left;
}

.loyalty-prompt strong {
    margin-bottom: 8px;
}

.loyalty-progress {
    background: #fff;
    border: 1px solid #ddd;
    padding: 15px;
    margin: 15px 0;
}

/* Legacy Progress bar - keep for backwards compatibility */
.progress-bar {
    background: #f0f0f0;
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    background: linear-gradient(90deg, #2ea2cc 0%, #28a745 100%);
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* New Enhanced Progress Bar Design */
.loyalty-progress-container {
    margin: 15px 0;
    padding: 12px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.loyalty-progress-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
}

.current-amount {
    color: #2ea2cc;
    font-weight: 700;
}

.target-amount {
    color: #666;
}

.loyalty-progress-bar {
    position: relative;
    background: #e9ecef;
    height: 24px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.loyalty-progress-fill {
    background: linear-gradient(90deg, #42939f 0%, #2196F3 100%);
    height: 100%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.loyalty-progress-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    z-index: 2;
}

.loyalty-progress-info {
    text-align: center;
}

.remaining-amount {
    font-size: 11px;
    color: #666;
    font-weight: 600;
}

/* Compact Cart Progress Bar */
.loyalty-cart-progress {
    margin-top: 16px;
    font-size: 16px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-weight: 600;
}

.current-spend {
    color: #2ea2cc;
}

.target-spend {
    color: #666;
}

.progress-bar-compact {
    position: relative;
    background: #e9ecef;
    height: 20px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-fill-compact {
    background: linear-gradient(90deg, #42939f 0%, #2196F3 100%);
    height: 100%;
    transition: width 0.6s ease;
    border-radius: 8px;
}

.progress-text-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    z-index: 2;
}

.remaining-info {
    text-align: center;
}

.remaining-text {
    font-size: 12px;
    color: #666;
    font-weight: 600;
}

.loyalty-max-tier-compact {
    margin-top: 8px;
    text-align: center;
    padding: 8px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 8px;
    border: 1px solid #e0a800;
}

.max-tier-text {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Checkout notice */
.loyalty-checkout-notice {
    background: #e7f5ff;
    border: 1px solid #bee5eb;
    padding: 10px 15px;
    margin: 15px 0;
    border-radius: 5px;
    color: #0c5460;
}

/* Tier badges */
.tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    box-shadow: 0 0 0px 1px #cccccc !important;
    color: #000;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    letter-spacing: -0.02em;
    margin: 5px 0;
}

/* Icon-specific badge styles */
.tier-badge__icon {
    height: 75px; /* Default M size */
    width: auto;
    object-fit: cover;
}

.tier-badge--s .tier-badge__icon {
    height: 35px;
}

.tier-badge--m .tier-badge__icon {
    height: 50px;
}

.tier-badge--l .tier-badge__icon {
    height: 75px;
}

.tier-badge__label {
    flex: 1;
    color: #000;
}

/* Text-only badges (fallback) */
.tier-badge--text-only {
    gap: 4px;
}

/* Tier breakdown with small icons */
.tier-breakdown .tier-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    gap: 15px;
    padding: 10px 15px;
    border-radius: 5px;
    align-items: center;
}

.tier-breakdown .tier-icon {
    height: 25px;
    width: auto;
    object-fit: cover;
}

.tier-breakdown .tier-item.current-tier {
    background: #e7f5ff;
    border: 2px solid #2ea2cc;
}

.tier-breakdown .tier-item.achieved-tier {
    background: #f0fff4;
    border: 1px solid #28a745;
}

.tier-breakdown .tier-item.future-tier {
    background: #f9f9f9;
    border: 1px solid #ddd;
    opacity: 0.7;
}

/* Loyalty current status with icon */
.loyalty-current-status .tier-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 10px 0;
    justify-content: center;
    flex-direction: column;
}

.loyalty-current-status .tier-icon {
    order: 1;
    height: 100px;
    width: auto;
    object-fit: cover;
}

/* Loyalty progress with icon */
.loyalty-progress strong {
    display: flex;
    align-items: center;
    gap: 8px;
}

.loyalty-progress .tier-icon {
    height: 20px;
    width: auto;
    object-fit: cover;
}

/* Product page notice with icon aligned right */
.loyalty-member-notice {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.loyalty-member-notice .tier-badge--s {
    margin-left: auto;
}

.loyalty-member-notice .tier-badge--s .tier-badge__icon {
    height: 30px;
}

/* My Account loyalty info */
.woocommerce-loyalty-info {
    background: #fff;
    border: 1px solid #ddd;
    padding: 20px;
    margin: 20px 0;
    border-radius: 5px;
}

.loyalty-tier-display {
    text-align: left;
    margin: 20px 0;
}

.loyalty-tier-display .tier-badge {
    font-size: 20px;
    padding: 12px;
}

.woocommerce-loyalty-info h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.woocommerce-loyalty-info ul {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.woocommerce-loyalty-info li {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.woocommerce-loyalty-info li:last-child {
    border-bottom: none;
}

/* Cart discount amount styling */
.loyalty-discount-amount {
    color: #28a745;
    font-weight: bold;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .loyalty-notice,
    .loyalty-prompt,
    .loyalty-progress {
        margin: 10px 0;
        padding: 10px;
    }
    
    .tier-badge {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Admin user profile styles */
.loyalty-admin-info {
    background: #f9f9f9;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-top: 10px;
}

.loyalty-admin-info .form-table th {
    width: 150px;
}

/* Animation for progress bar */
@keyframes progress-fill {
    from { width: 0; }
    to { width: var(--progress-width); }
}

.progress-fill.animate {
    animation: progress-fill 1s ease-out;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .loyalty-notice {
        border-width: 2px;
    }
    
    .tier-badge {
        border: 2px solid currentColor;
    }
    
    .progress-bar {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .progress-fill,
    .loyalty-progress-fill,
    .progress-fill-compact {
        transition: none;
    }
    
    .progress-fill.animate {
        animation: none;
    }
}

/* Mobile responsive adjustments for progress bars */
@media (max-width: 480px) {
    .loyalty-progress-container {
        padding: 8px;
        margin: 10px 0;
    }
    
    .loyalty-progress-labels {
        font-size: 10px;
        margin-bottom: 6px;
    }
    
    .loyalty-progress-bar {
        height: 20px;
    }
    
    .loyalty-progress-percentage {
        font-size: 9px;
    }
    
    .remaining-amount {
        font-size: 9px;
    }
    
    .loyalty-cart-progress {
        font-size: 10px;
    }
    
    .progress-info {
        margin-bottom: 3px;
    }
    
    .progress-bar-compact {
        height: 14px;
    }
    
    .progress-text-overlay {
        font-size: 8px;
    }
    
    .remaining-text {
        font-size: 9px;
    }
}
