/* 
 * WLP Frontend Styles - Modern Redesign
 * ===================================================================
 */

/* CSS Variables - Modern Color Palette */
:root {
    /* Brand Colors */
    --wlp-primary: #2c4e81;       /* Deep Blue */
    --wlp-primary-hover: #1e3a63;
    --wlp-primary-light: #eef2f6; /* Very light blue background */
    
    --wlp-accent: #e8461c;        /* Vibrant Orange */
    --wlp-accent-hover: #d63a12;
    --wlp-accent-light: #fff1ee;

    --wlp-secondary-color: #70afe1; /* Light Blue */

    /* Functional Colors */
    --wlp-success: #10b981;
    --wlp-success-bg: #d1fae5;
    --wlp-success-text: #065f46;
    
    --wlp-warning: #f59e0b;
    --wlp-warning-bg: #fef3c7;
    --wlp-warning-text: #92400e;
    
    --wlp-error: #ef4444;
    --wlp-error-bg: #fee2e2;
    --wlp-error-text: #b91c1c;

    /* Neutrals */
    --wlp-white: #ffffff;
    --wlp-gray-50: #f9fafb;
    --wlp-gray-100: #f3f4f6;
    --wlp-gray-200: #e5e7eb;
    --wlp-gray-300: #d1d5db;
    --wlp-gray-500: #6b7280;
    --wlp-gray-700: #374151;
    --wlp-gray-900: #111827;

    /* UI Elements */
    --wlp-radius: 12px;
    --wlp-radius-sm: 8px;
    --wlp-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --wlp-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --wlp-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --wlp-transition: all 0.2s ease-in-out;
}

/*
 * ===================================================================
 * Product Page: Points + Sales Info
 * ===================================================================
 */

.wlp-product-points-sales {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin: 10px 0;
}

.wlp-product-points-sales .wlp-info-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--wlp-radius-sm);
    border: 1px solid var(--wlp-gray-200);
    background: var(--wlp-gray-50);
    color: var(--wlp-gray-700);
    font-size: 14px;
    line-height: 1.2;
}

.wlp-product-points-sales .wlp-info-icon {
    color: var(--wlp-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 16px;
}

/* Dashicons rendering safety (themes sometimes break pseudo-elements in flex) */
.wlp-product-points-sales .wlp-info-icon.dashicons {
    display: inline-block;
    width: 20px;
    height: 20px;
}

.wlp-product-points-sales .wlp-info-icon.dashicons::before {
    font-size: 16px;
    line-height: 20px;
}

.wlp-product-points-sales .wlp-info-text {
    font-weight: 600;
}

/* Requested styling overrides */
.wlp-product-points-sales .wlp-info-item.wlp-earn-on-product {
    color: var(--wlp-accent);
    border: 1px solid var(--wlp-accent);
    margin-bottom: 10px;
}

.wlp-product-points-sales .wlp-info-item.wlp-earn-on-product .wlp-info-icon {
    color: var(--wlp-accent);
}

.wlp-product-points-sales .wlp-info-item.wlp-sales-counter {
    color: var(--wlp-accent);
    border: 1px solid var(--wlp-accent);
    margin-bottom: 10px;
}

.wlp-product-points-sales .wlp-info-item.wlp-sales-counter .wlp-info-icon {
    color: var(--wlp-accent);
}

/* Tighter spacing inside WooCommerce product grids/cards */
.woocommerce ul.products li.product .wlp-product-points-sales {
    margin: 8px 0 0;
}

.woocommerce ul.products li.product .wlp-product-points-sales .wlp-info-item {
    font-size: 12px;
    padding: 6px 8px;
}

/*
 * ===================================================================
 * Points Earned Popup
 * ===================================================================
 */

.wlp-points-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 99999;
}

.wlp-points-popup {
    width: min(520px, 100%);
    background: var(--wlp-white);
    border-radius: var(--wlp-radius);
    box-shadow: var(--wlp-shadow-lg);
    border: 1px solid var(--wlp-gray-200);
    padding: 18px 18px 16px;
    position: relative;
}

.wlp-points-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: var(--wlp-radius-sm);
    border: 1px solid var(--wlp-gray-200);
    background: var(--wlp-gray-50);
    color: var(--wlp-gray-700);
    font-size: 20px;
    line-height: 30px;
    cursor: pointer;
}

.wlp-points-popup-title {
    font-weight: 800;
    color: var(--wlp-gray-900);
    font-size: 18px;
    margin-bottom: 8px;
}

.wlp-points-popup-message {
    color: var(--wlp-gray-700);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 14px;
}

.wlp-points-popup-ok {
    border: 1px solid var(--wlp-primary);
    background: var(--wlp-primary);
    color: var(--wlp-white);
    border-radius: var(--wlp-radius-sm);
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
}

/*
 * ===================================================================
 * Layout & Grid
 * ===================================================================
 */

.wlp-my-account-points {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
        "header"
        "sidebar"
        "main";
    gap: 30px;
    max-width: 1200px;
    margin: 40px auto;
    font-family: inherit;
    color: var(--wlp-gray-700);
}

/* WooCommerce My Account: adapt to theme/container */
.woocommerce-account .woocommerce-MyAccount-content .wlp-my-account-points {
    max-width: none;
    margin: 0;
    color: inherit;
}

.wlp-points-header { grid-area: header; }
.wlp-points-history { grid-area: main; }
.wlp-sidebar { grid-area: sidebar; }
.wlp-no-points-message { grid-area: main; }

/*
 * ===================================================================
 * Header Section
 * ===================================================================
 */

.wlp-points-header {
    background: var(--wlp-white);
    border-radius: var(--wlp-radius);
    padding: 30px;
    box-shadow: var(--wlp-shadow);
    border: 1px solid var(--wlp-gray-100);
    position: relative;
    overflow: hidden;
}

/* Decorative top bar */
.wlp-points-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--wlp-primary), var(--wlp-secondary-color));
}

.wlp-points-title {
    margin: 0 0 10px 0;
    color: var(--wlp-gray-900);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.wlp-points-subtitle {
    margin: 0 0 25px 0;
    color: var(--wlp-gray-500);
    font-size: 16px;
    line-height: 1.5;
}

.wlp-header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid var(--wlp-gray-200);
}

/*
 * ===================================================================
 * Summary Cards
 * ===================================================================
 */

.wlp-points-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.wlp-points-card {
    background: var(--wlp-white);
    border: 1px solid var(--wlp-gray-200);
    border-radius: var(--wlp-radius);
    padding: 25px 20px;
    text-align: center;
    transition: var(--wlp-transition);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.wlp-points-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--wlp-shadow-lg);
    border-color: var(--wlp-primary-light);
}

.wlp-points-icon {
    font-size: 24px;
    margin-bottom: 15px;
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--wlp-gray-50);
    color: var(--wlp-gray-500);
    transition: var(--wlp-transition);
}

.wlp-points-card:hover .wlp-points-icon {
    transform: scale(1.1);
}

/* Card Variants */
.wlp-points-card.wlp-available .wlp-points-icon {
    background: var(--wlp-primary-light);
    color: var(--wlp-primary);
}
.wlp-points-card.wlp-available {
    border-bottom: 4px solid var(--wlp-primary);
}

.wlp-points-card.wlp-used .wlp-points-icon {
    background: var(--wlp-warning-bg);
    color: var(--wlp-warning-text);
}

.wlp-points-card.wlp-donated .wlp-points-icon {
    background: #f3e8ff;
    color: #7e22ce;
}

.wlp-points-card .wlp-points-info h3 {
    font-size: 32px;
    margin: 0;
    color: var(--wlp-gray-900);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
}

.wlp-points-card .wlp-points-info p {
    margin: 8px 0 0 0;
    font-weight: 600;
    color: var(--wlp-gray-500);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wlp-points-card .wlp-points-info small {
    font-size: 13px;
    color: var(--wlp-accent);
    font-weight: 600;
    display: block;
    margin-top: 6px;
    background: var(--wlp-accent-light);
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

/*
 * ===================================================================
 * Sidebar & Widgets
 * ===================================================================
 */

.wlp-redemption-info,
.wlp-earn-percent-info,
.wlp-dashboard-points-widget,
.wlp-no-points-message {
    background: var(--wlp-white);
    border: 1px solid var(--wlp-gray-200);
    border-radius: var(--wlp-radius);
    padding: 25px;
    box-shadow: var(--wlp-shadow-sm);
    margin-bottom: 25px;
}

.wlp-redemption-info h3,
.wlp-earn-percent-info h3,
.wlp-dashboard-points-widget h3 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--wlp-gray-100);
    color: var(--wlp-gray-900);
    font-size: 18px;
    font-weight: 700;
}

/* Progress Bar */
.wlp-progress {
    height: 8px;
    background: var(--wlp-gray-100);
    border-radius: 99px;
    overflow: hidden;
    margin: 15px 0 8px;
}

.wlp-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--wlp-secondary-color), var(--wlp-primary));
    border-radius: 99px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.wlp-progress-success .wlp-progress-bar {
    background: linear-gradient(90deg, #34d399, #10b981);
}

.wlp-progress-label {
    font-size: 12px;
    color: var(--wlp-gray-500);
    text-align: right;
    font-weight: 500;
}

/* Earning Rules List */
.wlp-earning-rules ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wlp-earning-rules li {
    padding: 12px 15px;
    margin-bottom: 10px;
    background: var(--wlp-gray-50);
    border-radius: var(--wlp-radius-sm);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--wlp-gray-700);
    border: 1px solid transparent;
    transition: var(--wlp-transition);
}

.wlp-earning-rules li:hover {
    background: var(--wlp-white);
    border-color: var(--wlp-gray-200);
    box-shadow: var(--wlp-shadow-sm);
}

.wlp-earning-rules .dashicons {
    color: var(--wlp-primary);
    background: var(--wlp-primary-light);
    padding: 6px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/*
 * ===================================================================
 * History Table
 * ===================================================================
 */

.wlp-history-table-container {
    background: var(--wlp-white);
    border: 1px solid var(--wlp-gray-200);
    border-radius: var(--wlp-radius);
    padding: 0; /* Padding handled by table */
    box-shadow: var(--wlp-shadow-sm);
    overflow: hidden;
}

.wlp-history-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.wlp-history-table th {
    background: var(--wlp-gray-50);
    padding: 18px 24px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--wlp-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--wlp-gray-200);
}

.wlp-history-table td {
    padding: 18px 24px;
    border-bottom: 1px solid var(--wlp-gray-100);
    color: var(--wlp-gray-700);
    font-size: 14px;
}

.wlp-history-table tr:last-child td {
    border-bottom: none;
}

.wlp-history-table tbody tr:hover {
    background-color: var(--wlp-gray-50);
}

/* Badges */
.wlp-points-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.wlp-points-badge.wlp-positive {
    background: var(--wlp-success-bg);
    color: var(--wlp-success-text);
}

.wlp-points-badge.wlp-negative {
    background: var(--wlp-error-bg);
    color: var(--wlp-error-text);
}

.wlp-transaction-type {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.wlp-transaction-type.wlp-type-earned { background: var(--wlp-success-bg); color: var(--wlp-success-text); }
.wlp-transaction-type.wlp-type-redeemed { background: var(--wlp-warning-bg); color: var(--wlp-warning-text); }
.wlp-transaction-type.wlp-type-donation { background: #f3e8ff; color: #7e22ce; }

/*
 * ===================================================================
 * Buttons
 * ===================================================================
 */

.wlp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--wlp-radius-sm);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: var(--wlp-transition);
    border: 1px solid transparent;
    line-height: 1.4;
}

.wlp-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--wlp-shadow);
    text-decoration: none;
}

.wlp-btn:active {
    transform: translateY(0);
}

/* Primary Button */
.wlp-btn-primary {
    background: var(--wlp-accent);
    color: white;
    border-color: var(--wlp-accent);
}
.wlp-btn-primary:hover {
    background: var(--wlp-accent-hover);
    color: white;
}

/* Secondary Button */
.wlp-btn-secondary {
    background: var(--wlp-white);
    color: var(--wlp-gray-700);
    border-color: var(--wlp-gray-300);
}
.wlp-btn-secondary:hover {
    border-color: var(--wlp-gray-500);
    background: var(--wlp-gray-50);
    color: var(--wlp-gray-900);
}

/* Outline Button */
.wlp-btn-outline {
    background: transparent;
    color: var(--wlp-primary);
    border-color: var(--wlp-primary);
}
.wlp-btn-outline:hover {
    background: var(--wlp-primary-light);
    color: var(--wlp-primary-hover);
}

/* Share Buttons */
.wlp-share, .wlp-copy-link {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--wlp-white);
    border: 1px solid var(--wlp-gray-300);
    color: var(--wlp-gray-500);
    transition: var(--wlp-transition);
}

.wlp-share:hover, .wlp-copy-link:hover {
    background: var(--wlp-gray-50);
    color: var(--wlp-primary);
    border-color: var(--wlp-primary);
    transform: translateY(-2px);
}

/*
 * ===================================================================
 * Modal
 * ===================================================================
 */

.wlp-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(17, 24, 39, 0.7); /* Darker backdrop */
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    animation: wlp-fade-in 0.2s forwards;
}

.wlp-modal {
    background: var(--wlp-white);
    border-radius: 16px;
    padding: 30px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95);
    opacity: 0;
    animation: wlp-scale-in 0.3s 0.1s forwards cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

@keyframes wlp-fade-in { to { opacity: 1; } }
@keyframes wlp-scale-in { to { transform: scale(1); opacity: 1; } }

.wlp-modal-close {
    position: absolute;
    top: 15px; right: 15px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--wlp-gray-300);
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}
.wlp-modal-close:hover { color: var(--wlp-gray-700); }

.wlp-modal h3 {
    margin-top: 0;
    color: var(--wlp-gray-900);
    font-size: 22px;
    text-align: center;
}

.wlp-modal p {
    color: var(--wlp-gray-500);
    text-align: center;
    margin-bottom: 20px;
}

.wlp-modal-donation-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--wlp-gray-200);
    border-radius: 8px;
    font-size: 18px;
    text-align: center;
    margin-bottom: 20px;
    transition: var(--wlp-transition);
}

.wlp-modal-donation-input:focus {
    border-color: var(--wlp-primary);
    outline: none;
}

.wlp-modal-actions {
    display: flex;
    gap: 10px;
}

.wlp-modal-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--wlp-transition);
}

.wlp-donation-modal-confirm {
    background: var(--wlp-primary);
    color: white;
}
.wlp-donation-modal-confirm:hover { background: var(--wlp-primary-hover); }

.wlp-donation-modal-cancel {
    background: var(--wlp-gray-100);
    color: var(--wlp-gray-700);
}
.wlp-donation-modal-cancel:hover { background: var(--wlp-gray-200); }

.wlp-donation-feedback {
    margin-top: 10px;
    font-size: 14px;
    text-align: center;
}

/*
 * ===================================================================
 * Responsive
 * ===================================================================
 */

@media (max-width: 960px) {
    .wlp-my-account-points {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "sidebar"
            "main";
    }
}

@media (max-width: 600px) {
    .wlp-points-header { padding: 20px; }
    .wlp-points-title { font-size: 24px; }
    .wlp-header-actions { flex-direction: column; }
    .wlp-btn { width: 100%; }
    
    .wlp-history-table thead { display: none; }
    .wlp-history-table tr {
        display: block;
        border: 1px solid var(--wlp-gray-200);
        margin-bottom: 15px;
        border-radius: 8px;
        padding: 15px;
    }
    .wlp-history-table td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border: none;
        font-size: 13px;
    }
    .wlp-history-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--wlp-gray-500);
    }
}

/*
 * ===================================================================
 * Restrictions & Category Progress
 * ===================================================================
 */
.wlp-restrictions-wrapper {
    background: var(--wlp-white);
    border: 1px solid var(--wlp-gray-200);
    border-radius: var(--wlp-radius);
    padding: 25px;
    box-shadow: var(--wlp-shadow-sm);
    position: relative;
    overflow: hidden;
}

/* Optional accent for category box */
#wlp-category-progress.wlp-restrictions-wrapper {
    border-left: 4px solid var(--wlp-primary);
}

.wlp-restrictions-header {
    font-size: 16px;
    font-weight: 700;
    color: var(--wlp-gray-900);
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wlp-category-current-name {
    background: var(--wlp-primary-light);
    color: var(--wlp-primary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wlp-restrictions-progress {
    height: 12px;
    background: var(--wlp-gray-100);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 8px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.wlp-restrictions-progress-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Shimmer effect for progress bar */
.wlp-restrictions-progress-bar::after {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.3) 50%,
        rgba(255,255,255,0) 100%
    );
    transform: translateX(-100%);
    animation: wlp-shimmer 2s infinite;
}

@keyframes wlp-shimmer {
    100% { transform: translateX(100%); }
}

.wlp-restrictions-bar-gray { background: var(--wlp-gray-300); }
.wlp-restrictions-bar-yellow { background: var(--wlp-warning); }
.wlp-restrictions-bar-green { background: var(--wlp-success); }

/* Category specific gradient */
.wlp-category-progress-bar {
    background: linear-gradient(90deg, var(--wlp-secondary-color), var(--wlp-primary));
}

.wlp-restrictions-progress-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--wlp-gray-500);
    text-align: right;
}

.wlp-category-progress-text {
    margin-top: 12px;
    font-size: 14px;
    color: var(--wlp-gray-600);
    background: var(--wlp-gray-50);
    padding: 10px 15px;
    border-radius: var(--wlp-radius-sm);
    border: 1px solid var(--wlp-gray-100);
    display: flex;
    align-items: center;
    gap: 8px;
}

.wlp-category-progress-text::before {
    content: '\f119'; /* dashicons-chart-line equivalent or similar */
    font-family: dashicons;
    color: var(--wlp-primary);
    font-size: 18px;
}

.wlp-category-disabled {
    background: var(--wlp-error-bg);
    color: var(--wlp-error-text);
    padding: 10px 15px;
    border-radius: var(--wlp-radius-sm);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.wlp-category-disabled::before {
    content: '\f534'; /* dashicons-warning */
    font-family: dashicons;
    font-size: 18px;
}

.wlp-restrictions-messages {
    list-style: none;
    padding: 0;
    margin: 15px 0 0 0;
}

.wlp-restrictions-messages li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 8px;
    color: var(--wlp-gray-700);
    font-size: 14px;
    line-height: 1.5;
}

.wlp-restrictions-messages li::before {
    content: '•';
    position: absolute;
    left: 6px;
    color: var(--wlp-primary);
    font-weight: bold;
    font-size: 18px;
    line-height: 1;
    top: -2px;
}
