/* WooCommerce Store Credit - Frontend Styles */

/* My Account - Balance Card */
.store-credit-balance-card {
    background: #333;
    /* Fallback */
    background: var(--wp--preset--color--primary, #333);
    /* Try Gutenberg var */
    background: linear-gradient(135deg, rgba(50, 50, 50, 1) 0%, rgba(20, 20, 20, 1) 100%);
    color: #fff;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.store-credit-balance-card .balance-info {
    z-index: 2;
    text-align: center;
}

.store-credit-balance-card .balance-actions {
    margin-left: auto;
    z-index: 2;
}

.store-credit-balance-card .store-credit-buy-button {
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    padding: 10px 20px !important;
    border-radius: 15px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.store-credit-balance-card .store-credit-buy-button:hover {
    background-color: #fff !important;
    color: #333 !important;
}

.store-credit-balance-card h3 {
    margin: 0;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.store-credit-balance-card .balance-amount {
    font-size: 2.5rem;
    font-weight: 700;
    margin-top: 5px;
}


/* Buy Credit Packages */
.store-credit-packages-section {
    margin-bottom: 40px;
}

.store-credit-packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.store-credit-package-card {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.store-credit-package-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-color: #d1d1d1;
}

.store-credit-package-card .package-header {
    margin-bottom: 15px;
}

.store-credit-package-card .credit-amount {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

.store-credit-package-card .credit-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 1px;
}

.store-credit-package-card .package-body {
    margin-bottom: 15px;
    flex-grow: 1;
}

.store-credit-package-card .package-title {
    font-size: 0.9rem;
    margin: 0 0 5px;
    color: #555;
}

.store-credit-package-card .package-price {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.store-credit-package-card .package-action .button {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 0;
    display: block;
    text-align: center;
    background-color: var(--wp--preset--color--primary, #333);
    color: #fff;
    padding: 8px 10px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    transition: opacity 0.2s;
    line-height: 1.2;
    white-space: normal;
    height: auto;
}

.store-credit-package-card .package-action .button:hover {
    opacity: 0.9;
    color: #fff;
}

/* My Account - Transaction Table */
.store-credit-history table.shop_table {
    border-collapse: separate;
    border-spacing: 0;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.store-credit-history table.shop_table th {
    background-color: #f8f9fa;
    color: #333;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    padding: 15px 20px;
    border-bottom: 2px solid #e9ecef;
}

.store-credit-history table.shop_table td {
    border-top: 1px solid #f1f1f1;
    padding: 15px 20px;
    color: #555;
    background: #fff;
}

.store-credit-history table.shop_table tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.credit-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.credit-badge.type-purchase {
    background-color: #d4edda;
    color: #155724;
}

/* Green */
.credit-badge.type-redemption {
    background-color: #f8d7da;
    color: #721c24;
}

/* Red */
.credit-badge.type-manual {
    background-color: #fff3cd;
    color: #856404;
}

/* Yellow */
.credit-badge.type-refund {
    background-color: #cce5ff;
    color: #004085;
}

/* Checkout - Credit Box */
.checkout-store-credit-box {
    background-color: #f8f9fa;
    border: 2px dashed #667eea;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.checkout-store-credit-box:hover {
    background-color: #fff;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.15);
}

.checkout-store-credit-box input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #667eea;
    margin: 0;
}

.checkout-store-credit-box label {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    flex-grow: 1;
}

.checkout-store-credit-box .credit-available {
    font-size: 0.9rem;
    color: #764ba2;
    font-weight: 700;
    white-space: nowrap;
}

/* Responsiveness */
@media screen and (max-width: 768px) {
    .store-credit-balance-card {
        justify-content: center;
        padding: 25px 20px;
    }

    .store-credit-balance-card .balance-info {
        margin-bottom: 5px;
        width: 100%;
    }

    .store-credit-balance-card .balance-actions {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }

    .store-credit-balance-card .store-credit-buy-button {
        display: block;
        width: 100%;
    }

    .store-credit-balance-card .balance-amount {
        font-size: 2rem;
    }

    .store-credit-packages-grid {
        grid-template-columns: 1fr;
    }
}

/* Fix for WooCommerce Shop Table on Mobile */
@media screen and (max-width: 600px) {
    .store-credit-history table.shop_table_responsive thead {
        display: none;
    }

    .store-credit-history table.shop_table_responsive tr {
        display: block;
        margin-bottom: 20px;
        border: 1px solid #e1e1e1;
        border-radius: 8px;
        padding: 10px;
    }

    .store-credit-history table.shop_table_responsive td {
        display: block;
        text-align: right !important;
        padding: 8px 10px;
        border: none;
        border-bottom: 1px solid #f1f1f1;
    }

    .store-credit-history table.shop_table_responsive td:last-child {
        border-bottom: none;
    }

    .store-credit-history table.shop_table_responsive td::before {
        content: attr(data-title) ": ";
        font-weight: 700;
        float: left;
        text-transform: uppercase;
        font-size: 0.75rem;
        color: #888;
    }
}