/* Popup modal styles */
.exchange-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    padding-top: 80px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.exchange-modal-content {
    background: #fff;
    margin: auto;
    padding: 20px;
    border-radius: 8px;
    width: 70%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.exchange-close {
    float: right;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.exchange-close:hover {
    color: #000;
}

.exchange-error {
    color: red;
    font-size: 13px;
    margin-top: 5px;
}

/* Loading Spinner */
.exchange-loading {
    display: none;
    text-align: center;
    margin-top: 15px;
}

.exchange-loading .spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Price difference styles */
.price-difference {
    font-size: 14px;
    margin-top: 8px;
}

.extra-payment {
    color: #d63638;
    font-weight: bold;
}

.refund-amount {
    color: #00a32a;
    font-weight: bold;
}

.no-difference {
    color: #666;
    font-style: italic;
}

/* Exchange summary box */
#total-difference {
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    margin: 20px 0;
    padding: 15px;
    border-radius: 4px;
}

#total-difference h4 {
    margin-top: 0;
    color: #0073aa;
}

#total-amount-display {
    font-size: 16px;
    margin-top: 10px;
}

/* Payment section styles */
#payment-section {
    background: #fffbf0;
    border-left: 4px solid #f0b849;
    margin: 20px 0;
    padding: 15px;
    border-radius: 4px;
}

#payment-section h4 {
    margin-top: 0;
    color: #f0b849;
}

#payment-methods label {
    display: block;
    margin-bottom: 8px;
    font-weight: normal;
}

#payment-methods input[type="radio"] {
    margin-right: 8px;
}

/* Exchange item styles */
.exchange-item {
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    background: #fafafa;
}

.exchange-check {
    font-weight: bold;
    margin-bottom: 10px;
}

.exchange-check input[type="checkbox"] {
    margin-right: 8px;
}

.size-dropdown {
    margin-top: 10px;
    padding: 10px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.size-dropdown select {
    width: 100%;
    max-width: 300px;
    padding: 5px;
    margin-left: 10px;
}

/* Submit button styles */
#exchange-submit-btn {
    background: #0073aa;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    margin-top: 20px;
    min-width: 200px;
    transition: background-color 0.3s ease;
}

#exchange-submit-btn:hover {
    background: #005a87;
}

#exchange-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Form element styles */
.exchange-reason {
    width: 100%;
    max-width: 250px;
    padding: 5px;
    margin-top: 5px;
}

.exchange-item label {
    display: block;
    margin-bottom: 8px;
}

.exchange-item label:last-child {
    margin-bottom: 0;
}

/* Highlight selected items */
.exchange-item:has(.exchange-unit-checkbox:checked) {
    background: #f0f8ff;
    border-color: #0073aa;
}

/* Exchange Order Details Section */
.exchange-order-details {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.exchange-order-details h3 {
    margin-top: 0;
    color: #0073aa;
    font-size: 20px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.exchange-order-details h4 {
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 16px;
}

/* Exchange Summary Cases Styling */
.exchange-summary-case-a {
    text-align: center;
    padding: 20px;
    background: #f0f8ff;
    border-radius: 4px;
    margin: 15px 0;
    border: 2px solid #0073aa;
}

.exchange-summary-case-b {
    text-align: center;
    padding: 20px;
    background: #fff8dc;
    border-radius: 4px;
    margin: 15px 0;
    border: 2px solid #f0b849;
}

.exchange-summary-case-c {
    text-align: center;
    padding: 20px;
    background: #f0fff0;
    border-radius: 4px;
    margin: 15px 0;
    border: 2px solid #00a32a;
}

/* Enhanced Admin Panel Styles */
.exchange-admin-table {
    border-collapse: collapse;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.exchange-admin-table th {
    background: #f8f9fa !important;
    color: #333 !important;
    font-weight: bold;
    text-align: left;
    padding: 12px 8px;
    border-bottom: 2px solid #dee2e6;
}

.exchange-admin-table td {
    padding: 12px 8px;
    vertical-align: top;
    border-bottom: 1px solid #eee;
}

.exchange-admin-table tr:hover {
    background-color: #f8f9ff;
}

.order-link {
    font-weight: bold;
    text-decoration: none;
    color: #0073aa;
}

.order-link:hover {
    text-decoration: underline;
}

.order-status {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    margin-top: 2px;
}

.product-item {
    border-left: 3px solid #0073aa;
    padding: 8px;
    margin-bottom: 8px;
    background: #f9f9f9;
    border-radius: 4px;
}

.reason-badge {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
}

.defective-reason {
    background: #d63638;
    color: white;
}

.size-reason {
    background: #f56e28;
    color: white;
}

.quick-actions .button {
    font-size: 11px;
    padding: 2px 6px;
    height: auto;
    line-height: 1.2;
}

.exchange-stats-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stats-card {
    padding: 15px;
    border-radius: 8px;
    min-width: 150px;
    text-align: center;
    flex: 1;
}

.stats-card h3 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
}

.stats-card p {
    margin: 5px 0 0 0;
    font-size: 14px;
}

/* Replacement badge styling */
.replacement-badge {
    background: #999999 !important;
    color: black !important;
    padding: 2px 6px !important;
    font-size: 13px !important;
    border-radius: 12px !important;
    font-weight: bold !important;
}

/* Desktop view - show desktop badges, hide mobile badges */
@media (min-width: 769px) {
    .replacement-badge.desktop-badge {
        display: inline !important;
        vertical-align: middle;
        margin-left: 5px;
    }
    
    .replacement-badge.mobile-badge {
        display: none !important;
    }
}

/* Mobile view - hide desktop badges, show mobile badges */
@media (max-width: 768px) {
    .replacement-badge.desktop-badge {
        display: none !important;
    }
    
    .replacement-badge.mobile-badge {
        display: inline !important;
        margin-right: 8px;
    }
    
    .woocommerce-account .woocommerce-orders-table .order-status {
        display: flex;
        align-items: center;
    }
    
    .exchange-modal-content {
        width: 95%;
        padding: 15px;
        margin-top: 20px;
    }
    
    .size-dropdown select {
        width: 100%;
        margin-left: 0;
        margin-top: 5px;
    }
    
    #exchange-submit-btn {
        width: 100%;
        min-width: auto;
    }
    
    .exchange-item {
        padding: 10px;
    }
    
    .exchange-order-details {
        padding: 15px;
        margin-top: 15px;
    }
    
    .exchange-admin-table th,
    .exchange-admin-table td {
        padding: 6px 4px;
        font-size: 11px;
    }
    
    .product-item {
        padding: 6px;
        margin-bottom: 6px;
    }
}

/* Responsive design */
@media (max-width: 1200px) {
    .exchange-admin-table {
        font-size: 12px;
    }
    
    .exchange-stats-row {
        flex-direction: column;
    }
    
    .stats-card {
        min-width: auto;
    }
}

/* Exchange order styling */
.woocommerce-order-details .woocommerce-order-items-table tbody tr td:first-child {
    font-weight: 500;
}

.woocommerce-order-details .woocommerce-order-items-table tbody tr:has([class*="Credit"]) td:first-child {
    font-style: italic;
    color: #666;
}

.woocommerce-order-details .woocommerce-order-items-table tfoot tr td {
    text-align: right;
    font-weight: bold;
}

.woocommerce-order-details tr:has(td:contains("Credit:")) {
    background-color: #f9f9f9;
}
