/* Credit System Styles */

/* Card Enhancements */
.credit-balance-card,
.credit-management-card,
.credit-transactions-card,
.credit-stat-card {
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.credit-balance-card:hover,
.credit-management-card:hover,
.credit-transactions-card:hover,
.credit-stat-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Credit Balance Display */
.credit-balance-display {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 6px;
    position: relative;
}

.balance-amount {
    display: block;
    font-size: 3em;
    font-weight: 700;
    color: #0073aa;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

.balance-label {
    display: block;
    font-size: 1.1em;
    color: #495057;
    font-weight: 500;
}

.credit-amount {
    display: block;
    font-size: 3em;
    font-weight: 700;
    color: #0073aa;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.credit-label {
    display: block;
    font-size: 1.2em;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    margin-bottom: 10px;
}

.credit-balance-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.credit-balance-info small {
    color: #6c757d;
    font-size: 0.9em;
    font-style: italic;
}

/* Card Labels with Icons */
.bcf-card-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #2c3e50;
    justify-content: space-between;
}

.bcf-card-label .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #0073aa;
}

/* Credit Statistics Cards */
.credit-stat-card .bcf-card-data {
    text-align: center;
    padding: 20px 15px;
}

/* Credit Balance Card */
.credit-balance-card .bcf-card-data {
    padding: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .credit-balance-display {
        padding: 20px 15px;
    }
    
    .balance-amount {
        font-size: 2.5em;
    }
    
    .credit-stat-amount,
    .credit-stat-count {
        font-size: 1.5em;
    }
    
    .transaction-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .transaction-amount {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .balance-amount {
        font-size: 2em;
    }
    
    .credit-stat-amount,
    .credit-stat-count {
        font-size: 1.3em;
    }
    
    .transaction-item {
        padding: 12px;
    }
}

.credit-stat-amount {
    display: block;
    font-size: 1.8em;
    font-weight: 700;
    margin-bottom: 5px;
}

.credit-stat-count {
    display: block;
    font-size: 1.8em;
    font-weight: 700;
    color: #0073aa;
    margin-bottom: 5px;
}

.credit-stat-date {
    display: block;
    font-size: 1.2em;
    font-weight: 600;
    color: #666;
    margin-bottom: 5px;
}

/* Credit Type Badges */
.credit-type-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.credit-type-badge.warranty_claim {
    background: #e7f5ff;
    color: #0066cc;
}

.credit-type-badge.return_claim {
    background: #fff3cd;
    color: #856404;
}

.credit-type-badge.admin_adjustment {
    background: #d4edda;
    color: #155724;
}

.credit-type-badge.order_earned {
    background: #e8f5e8;
    color: #2e7d2e;
}

.credit-type-badge.order_applied {
    background: #ffebee;
    color: #c62828;
}

.credit-type-badge.refund {
    background: #fff8e1;
    color: #e65100;
}

.credit-type-badge.bonus {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* Recent Transactions Preview */
.recent-transactions-list {
    margin-top: 15px;
}

.transaction-item {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    margin-bottom: 12px;
    padding: 15px;
    transition: all 0.2s ease;
}

.transaction-item:hover {
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    border-color: #0073aa;
}

.transaction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.transaction-date {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 13px;
    font-weight: 500;
}

.transaction-date .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: #999;
}

.transaction-amount {
    font-weight: 600;
    font-size: 16px;
}

.transaction-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.transaction-type {
    margin-bottom: 5px;
}

.transaction-order,
.transaction-description {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
}

.transaction-order .dashicons,
.transaction-description .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
    color: #999;
}

.transaction-order a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.transaction-order a:hover {
    text-decoration: underline;
}

.transaction-description {
    font-style: italic;
    line-height: 1.3;
    color: #555;
}

/* Credit Management Form */
.credit-adjustment-form {
    padding: 20px 0;
}

.credit-adjustment-form .form-row {
    margin-bottom: 20px;
}

.credit-adjustment-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95em;
}

.credit-adjustment-form label .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #0073aa;
}

/* Input Group with Currency Symbol */
.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 12px;
    color: #6c757d;
    font-weight: 600;
    z-index: 2;
}

/* Form Inputs */
.credit-adjustment-form input[type="number"],
.credit-adjustment-form select,
.credit-adjustment-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fff;
}

.credit-adjustment-form input[type="number"]:focus,
.credit-adjustment-form select:focus,
.credit-adjustment-form textarea:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
    outline: none;
    transform: translateY(-1px);
}

.credit-adjustment-form input[type="number"]:hover,
.credit-adjustment-form select:hover,
.credit-adjustment-form textarea:hover {
    border-color: #005a87;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.credit-submit-btn,
.credit-reset-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.credit-submit-btn {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.3);
}

.credit-submit-btn:hover {
    background: linear-gradient(135deg, #005a87 0%, #004a73 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 115, 170, 0.4);
}

.credit-reset-btn {
    background: #6c757d;
    color: white;
}

.credit-reset-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.credit-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.credit-spinner {
    margin-left: 15px;
    vertical-align: middle;
}



/* DataTables Styling */
.dataTables_wrapper .dataTables_processing {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Top row: Length and Filter in one row */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    display: inline-block;
    margin: 10px 0;
    vertical-align: middle;
}

.dataTables_wrapper .dataTables_length {
    float: left;
}

.dataTables_wrapper .dataTables_filter {
    float: right;
}

/* Bottom row: Info and Pagination in one row */
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    display: inline-block;
    margin: 10px 0;
    vertical-align: middle;
}

.dataTables_wrapper .dataTables_info {
    float: left;
}

.dataTables_wrapper .dataTables_paginate {
    float: right;
}

/* Clear floats */
.dataTables_wrapper::after {
    content: "";
    display: table;
    clear: both;
}

/* Small font size for search and length dropdown */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 4px 6px;
    margin: 0 5px;
    font-size: 12px;
}

.dataTables_wrapper .dataTables_filter input {
    width: 180px;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    font-size: 12px;
    color: #666;
}

/* Pagination buttons */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 4px 8px;
    margin: 0 2px;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    background: #fff;
    color: #333;
    font-size: 12px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f5f5f5;
    border-color: #0073aa;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #999;
    cursor: not-allowed;
    background: #f9f9f9;
}

/* Info text styling */
.dataTables_wrapper .dataTables_info {
    font-size: 12px;
    color: #666;
}

/* Table Styling - Matching Product Analytics Style */
#credit-transactions-datatable {
    margin-top: 0;
}

#credit-transactions-datatable th {
    background: #f1f1f1;
    padding: 12px 8px;
    font-weight: 600;
    border-bottom: 2px solid #ddd;
}

#credit-transactions-datatable td {
    padding: 12px 8px;
    vertical-align: middle;
}

#credit-transactions-datatable tbody tr:hover {
    background-color: #f9f9f9;
}

/* Date Column Styling */
#credit-transactions-datatable td:first-child .dashicons {
    margin-right: 8px;
    color: #666;
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Order Link Styling */
#credit-transactions-datatable td:nth-child(4) a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

#credit-transactions-datatable td:nth-child(4) a:hover {
    text-decoration: underline;
}

/* No Data Placeholders */
.no-order,
.no-description {
    color: #999;
    font-style: italic;
}

/* View Button Styling */
.view-transaction-btn {
    padding: 4px 8px !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
}

.view-transaction-btn .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
    margin-right: 4px;
}





.credit-stat-amount {
    display: block;
    font-weight: 700;
    margin-top: 10px;
}

.credit-stat-count {
    display: block;
    font-weight: 700;
    color: #0073aa;
    margin-top: 10px;
}

/* Credit Amount Colors */
.credit-positive {
    color: #28a745;
    font-weight: 600;
}

.credit-negative {
    color: #dc3545;
    font-weight: 600;
}

/* Notification Styles */
.credit-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    word-wrap: break-word;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.credit-notification.show {
    transform: translateX(0);
}

.credit-notification.credit-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.credit-notification.credit-error {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%);
}

.credit-notification.credit-warning {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
}

.credit-notification.credit-info {
    background: linear-gradient(135deg, #0073aa 0%, #17a2b8 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .credit-amount {
        font-size: 2.5em;
    }
    
    .credit-adjustment-form .form-row {
        margin-bottom: 25px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .credit-submit-btn,
    .credit-reset-btn {
        width: 100%;
        justify-content: center;
    }
    
    .credit-transactions-table {
        overflow-x: auto;
    }
    
    .credit-transactions-table table {
        min-width: 700px;
    }
    
    .credit-stat-amount,
    .credit-stat-count {
        font-size: 1.8em;
    }
}

@media (max-width: 480px) {
    .credit-amount {
        font-size: 2em;
    }
    
    .credit-label {
        font-size: 1em;
    }
    
    .bcf-card-label {
        font-size: 0.9em;
    }
    
    .credit-adjustment-form {
        padding: 15px 0;
    }
}

/* Loading States */
.credit-loading {
    opacity: 0.6;
    pointer-events: none;
}

.credit-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: credit-spin 1s linear infinite;
}

@keyframes credit-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}



/* Action Buttons in Table */
.credit-action-btn {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
}

.credit-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Type Badges */
.credit-type-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.credit-type-badge.admin_adjustment { background: #e3f2fd; color: #1976d2; }
.credit-type-badge.order_earned { background: #e8f5e8; color: #388e3c; }
.credit-type-badge.order_applied { background: #fff3e0; color: #f57c00; }
.credit-type-badge.refund { background: #fce4ec; color: #c2185b; }
.credit-type-badge.expired { background: #f3e5f5; color: #7b1fa2; }
.credit-type-badge.bonus { background: #e0f2f1; color: #00796b; }
.credit-type-badge.manual { background: #f1f8e9; color: #689f38; }


.credit-info-message {
    background: #fff;
    padding: 15px;
    border-radius: 3px;
    border-left: 4px solid #0073aa;
}

.credit-info-message p {
    margin: 0;
    color: #555;
    font-weight: 500;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row.full-width {
    grid-template-columns: 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
}

.input-group {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
}

.currency-symbol {
    background: #f1f1f1;
    padding: 8px 12px;
    border-right: 1px solid #ddd;
    color: #555;
    font-weight: 600;
}

.input-group input,
.input-group select {
    border: none;
    padding: 8px 12px;
    flex: 1;
    outline: none;
}

.input-group input:focus,
.input-group select:focus {
    box-shadow: 0 0 0 1px #0073aa;
}

.form-help {
    color: #666;
    font-size: 12px;
    margin-top: 3px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.credit-submit-btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

.credit-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* New minimal transaction display styles */
.credit-transactions-list {
    margin-top: 10px;
}

.credit-transaction-item {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    margin-bottom: 8px;
    padding: 12px;
    transition: box-shadow 0.2s ease;
}

.credit-transaction-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.transaction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.transaction-date {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 13px;
}

.transaction-date .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: #999;
}

.transaction-amount {
    font-weight: 600;
    font-size: 16px;
}

.transaction-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.transaction-type {
    margin-bottom: 4px;
}

.transaction-order,
.transaction-description {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
}

.transaction-order .dashicons,
.transaction-description .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
    color: #999;
}

.transaction-order a {
    color: #0073aa;
    text-decoration: none;
}

.transaction-order a:hover {
    text-decoration: underline;
}

.transaction-description {
    font-style: italic;
    line-height: 1.3;
}

.credit-type-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.credit-type-badge.warranty_claim {
    background: #e7f5ff;
    color: #0066cc;
}

.credit-type-badge.return_claim {
    background: #fff3cd;
    color: #856404;
}

.credit-type-badge.admin_adjustment {
    background: #d4edda;
    color: #155724;
}

.credit-positive {
    color: #46b450;
    font-weight: 600;
}

.credit-negative {
    color: #dc3232;
    font-weight: 600;
}

.no-transactions {
    text-align: center;
    padding: 20px;
    color: #666;
}

.no-transactions .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #999;
    margin-bottom: 10px;
}

.no-transactions p {
    margin: 0;
}

.view-all-transactions {
    margin-top: 15px;
    text-align: center;
}

.view-all-transactions .button {
    text-decoration: none;
}

/* Users table credit column styling */
.column-store_credits {
    width: 120px;
    text-align: center;
}

.column-store_credits .credit-positive {
    color: #28a745;
    font-weight: 600;
}

.column-store_credits .credit-negative {
    color: #dc3545;
    font-weight: 600;
}