/*
 * Frontend-specific stylesheet for Better Loyalty plugin.
 *
 * @link       https://www.akabaka.co
 * @since      1.0.0
 *
 * @package    Better_Loyalty
 * @subpackage Better_Loyalty/public/css
 */

/* General Frontend Styles (e.g., My Account Page, Checkout) */
.better-loyalty-my-account-section {
    font-family: 'Inter', sans-serif;
    color: #333;
    margin-top: 20px;
}

.better-loyalty-my-account-section h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.better-loyalty-my-account-section h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #34495e;
}

/* Loyalty Summary Box */
.better-loyalty-summary-box {
    background-color: #e3f2fd; /* Light blue background */
    border: 1px solid #bbdefb; /* Blue border */
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.better-loyalty-summary-box .bl-icon {
    color: #1976d2; /* Darker blue icon */
    margin-right: 15px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.better-loyalty-summary-box .bl-content {
    flex-grow: 1;
}

.better-loyalty-summary-box .bl-label {
    font-size: 1.1em;
    font-weight: 600;
    color: #1a237e; /* Even darker blue for text */
}

.better-loyalty-summary-box .bl-points {
    font-size: 2.2em;
    font-weight: 700;
    color: #0d47a1; /* Deep blue for points count */
    text-align: right;
}

/* Offers Section */
.better-loyalty-offers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.better-loyalty-offer-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.better-loyalty-offer-card.unlocked {
    background-color: #e8f5e9; /* Light green for unlocked */
    border-color: #a5d6a7; /* Green border */
}

.better-loyalty-offer-card.locked {
    background-color: #fffde7; /* Light yellow for locked */
    border-color: #ffe082; /* Yellow border */
}

.better-loyalty-offer-card .bl-offer-text {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 5px;
}

.better-loyalty-offer-card .bl-discount-value {
    font-size: 1.5em;
    font-weight: 700;
    color: #2e7d32; /* Green for discount value */
    margin-bottom: 15px;
}

.better-loyalty-offer-card.locked .bl-discount-value {
    color: #fbc02d; /* Yellow for locked discount value */
}

/* Redeem Button Styles */
.better-loyalty-offer-card .bl-action-area {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Align content to the start (left) */
}

.better-loyalty-offer-card .bl-redeem-button {
    background-color: #4caf50; /* Green button */
    color: #fff;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.better-loyalty-offer-card .bl-redeem-button:hover {
    background-color: #388e3c;
}

.better-loyalty-offer-card .bl-redeem-button.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Coupon Display Styles */
.bl-coupon-display {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Align contents to start */
    background-color: #f0f8ff; /* Light blue background */
    border: 1px dashed #a0d4ff; /* Dashed blue border */
    border-radius: 5px;
    padding: 10px;
    width: 100%; /* Take full width of card */
    box-sizing: border-box; /* Include padding in width */
}

.bl-coupon-code {
    font-weight: bold;
    font-size: 1.1em;
    color: #0073aa; /* WordPress blue */
    margin-bottom: 5px;
    word-break: break-all; /* Break long coupon codes */
}

.bl-copy-coupon-button {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.bl-copy-coupon-button:hover {
    background-color: #005a8b;
}

.bl-coupon-message {
    font-size: 0.85em;
    color: #555;
    margin-top: 5px;
    text-align: left;
}

.bl-redemption-message {
    font-size: 0.9em;
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.bl-redemption-message.error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.better-loyalty-offer-card.locked .bl-points-needed {
    font-size: 0.85em;
    color: #777;
    margin-top: 10px;
    margin-bottom: 5px;
}

/* Progress Bar for Locked Offers */
.bl-progress-bar-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 5px;
    height: 8px;
    overflow: hidden; /* Ensure progress bar doesn't overflow rounded corners */
}

.bl-progress-bar {
    height: 100%;
    background-color: #fdd835; /* Yellow for progress */
    border-radius: 5px;
    transition: width 0.3s ease-out;
}

/* Single Product Page points display */
.better-loyalty-product-points-wrapper {
    margin-bottom: 15px; /* Wrapper to hold the message */
}

.better-loyalty-product-points {
    background-color: #f0f8ff;
    border: 1px dashed #bbdefb;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 0.95em;
    color: #1a237e;
    font-weight: 500;
}
.better-loyalty-product-points strong {
    color: #0d47a1;
}

/* Order Thank You Page message */
.better-loyalty-thank-you-message {
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
    background-color: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
    font-weight: 500;
}
.better-loyalty-thank-you-message strong {
    color: #1b5e20;
}
.better-loyalty-thank-you-message a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 600;
}
.better-loyalty-thank-you-message a:hover {
    text-decoration: underline;
}

/* Customer My Account Order Details Page */
.woocommerce-order-points {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    background-color: #f9f9f9;
}
.woocommerce-order-points h2 {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: #34495e;
    border-bottom: none; /* Override default h2 border in WooCommerce */
    padding-bottom: 0;
}
.woocommerce-order-points p {
    font-size: 1em;
    margin-bottom: 0;
}
.woocommerce-order-points strong {
    color: #2e7d32;
}


/* Admin Order Details Page */
.better-loyalty-admin-order-meta {
    border: 1px dashed #dcdcdc;
    padding: 15px;
    margin-top: 20px;
    border-radius: 5px;
    background-color: #fcfcfc;
}
.better-loyalty-admin-order-meta h4 {
    font-size: 1em;
    margin: 0 0 10px 0;
    color: #34495e;
}
.better-loyalty-admin-order-meta strong {
    color: #0073aa;
}
.better-loyalty-admin-order-meta p {
    margin: 0;
    font-size: 0.95em;
}
.better-loyalty-admin-order-meta em {
    color: #777;
}


/* Point History Table */
.better-loyalty-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.better-loyalty-history-table thead th {
    background-color: #f8f8f8;
    padding: 12px 15px;
    text-align: left;
    font-size: 0.9em;
    color: #555;
    border-bottom: 2px solid #ddd;
}

.better-loyalty-history-table tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.better-loyalty-history-table tbody tr:nth-child(even) {
    background-color: #fdfdfd;
}

.better-loyalty-history-table tbody tr:hover {
    background-color: #f5f5f5;
}

.better-loyalty-history-table .order-link {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.better-loyalty-history-table .order-link:hover {
    text-decoration: underline;
}

.better-loyalty-history-table .points-earned {
    font-weight: 600;
    color: #2e7d32; /* Green for earned points */
}

.better-loyalty-history-table .points-used {
    font-weight: 600;
    color: #d32f2f; /* Red for used points */
}

/* Redemption Reports Table */
.better-loyalty-redemption-report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.better-loyalty-redemption-report-table thead th {
    background-color: #f8f8f8;
    padding: 12px 15px;
    text-align: left;
    font-size: 0.9em;
    color: #555;
    border-bottom: 2px solid #ddd;
}

.better-loyalty-redemption-report-table tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    font-size: 0.9em;
}

.better-loyalty-redemption-report-table tbody tr:nth-child(even) {
    background-color: #fdfdfd;
}

.better-loyalty-redemption-report-table tbody tr:hover {
    background-color: #f5f5f5;
}


/* Frontend messages (e.g., success/error popups) */
.bl-frontend-message {
    padding: 12px 18px;
    border-radius: 5px;
    font-size: 0.95em;
    color: #fff;
    margin-bottom: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: none; /* Hidden by default, faded in by JS */
}

.bl-success-message {
    background-color: #4CAF50; /* Green */
}

.bl-error-message {
    background-color: #f44336; /* Red */
}


/* Responsive Adjustments */
@media (max-width: 768px) {
    .better-loyalty-summary-box {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
    }

    .better-loyalty-summary-box .bl-icon {
        margin-right: 0;
        margin-bottom: 10px;
    }

    .better-loyalty-summary-box .bl-points {
        text-align: left;
        width: 100%; /* Full width for points count */
    }

    .better-loyalty-offers-grid {
        grid-template-columns: 1fr; /* Stack on mobile */
    }

    /* Responsive table for history and reports */
    .better-loyalty-history-table,
    .better-loyalty-redemption-report-table,
    .better-loyalty-history-table thead,
    .better-loyalty-redemption-report-table thead,
    .better-loyalty-history-table tbody,
    .better-loyalty-redemption-report-table tbody,
    .better-loyalty-history-table th,
    .better-loyalty-redemption-report-table th,
    .better-loyalty-history-table td,
    .better-loyalty-redemption-report-table td,
    .better-loyalty-history-table tr,
    .better-loyalty-redemption-report-table tr {
        display: block;
    }

    .better-loyalty-history-table thead tr,
    .better-loyalty-redemption-report-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .better-loyalty-history-table tr,
    .better-loyalty-redemption-report-table tr {
        margin-bottom: 10px;
        border: 1px solid #ddd;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    }

    .better-loyalty-history-table td,
    .better-loyalty-redemption-report-table td {
        border: none;
        position: relative;
        padding-left: 50%;
        text-align: right;
    }

    .better-loyalty-history-table td:before,
    .better-loyalty-redemption-report-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-left: 15px;
        font-weight: bold;
        text-align: left;
    }
}
