/**
 * Returns System - Frontend Styles
 */

/* Order Details Return Button */
.woocommerce-order-returns {
    border: 1px solid #e1e1e1;
    padding: 20px;
    margin-top: 20px;
    border-radius: 4px;
    background: #f9f9f9;
}

.woocommerce-order-returns h3 {
    margin-top: 0;
    color: #333;
    font-size: 18px;
}

.woocommerce-order-returns p {
    margin-bottom: 15px;
    color: #666;
}

#open-return-modal {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#open-return-modal:hover {
    background: #005a87;
    border-color: #005a87;
}

/* Orders List Return Button */
.woocommerce-account .woocommerce-orders-table .order-actions a[href*="javascript:void(0)"]:last-child,
.woocommerce-account .woocommerce-orders-table .order-actions .open-return-modal {
    background: #ff6b35 !important;
    color: #fff !important;
    border: 1px solid #ff6b35 !important;
    padding: 6px 12px;
    border-radius: 3px;
    font-size: 12px;
    text-decoration: none;
    display: inline-block;
    margin-left: 5px;
    transition: all 0.3s ease;
}

.woocommerce-account .woocommerce-orders-table .order-actions a[href*="javascript:void(0)"]:last-child:hover,
.woocommerce-account .woocommerce-orders-table .order-actions .open-return-modal:hover {
    background: #e55a2b !important;
    border-color: #e55a2b !important;
    color: #fff !important;
}

/* Modal Styles */
.modal-open {
    overflow: hidden !important;
}

.return-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.return-modal-content {
    background: #ffffff;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.return-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.return-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
    font-weight: 600;
}

.return-modal-close {
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.2s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.return-modal-close:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.return-modal-body {
    padding: 25px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-text {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

/* Image Upload Styles */
.image-upload-area {
    padding: 15px;
    border: 2px dashed #ddd;
    border-radius: 6px;
    text-align: center;
    transition: border-color 0.2s ease;
}

.image-upload-area:hover {
    border-color: #007cba;
}

.image-upload-area .button {
    margin-bottom: 10px;
}

.uploaded-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.uploaded-image {
    position: relative;
    display: inline-block;
}

.uploaded-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    transition: border-color 0.2s ease;
}

.uploaded-image:hover img {
    border-color: #007cba;
}

.remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.remove-image:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Refund Estimate Styles */
.refund-estimate {
    background: linear-gradient(135deg, #e7f3ff 0%, #f0f8ff 100%);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #007cba;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.refund-info {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.refund-info span {
    color: #007cba;
    font-size: 18px;
    font-weight: 700;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.form-actions .button {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.form-actions .button:not(.button-primary) {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
}

.form-actions .button:not(.button-primary):hover {
    background: #e9ecef;
    color: #495057;
}

.form-actions .button-primary {
    background: #007cba;
    color: white;
    border: 1px solid #007cba;
}

.form-actions .button-primary:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.form-actions .button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Notice Styles */
.notice {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 15px 0;
    border-left: 4px solid;
    font-weight: 500;
}

.notice-success {
    background: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.notice-error {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

/* Returns Section in Order View */
.returns-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid #e0e0e0;
}

.returns-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    font-size: 18px;
}

.returns-section p {
    margin-bottom: 15px;
    color: #666;
}

.returns-section .button {
    background: #007cba;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s ease;
}

.returns-section .button:hover {
    background: #0056b3;
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .return-modal-content {
        width: 95%;
        max-height: 95vh;
        margin: 2.5vh auto;
    }
    
    .return-modal-header {
        padding: 15px 20px;
    }
    
    .return-modal-body {
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }
    
    .form-actions .button {
        width: 100%;
        justify-content: center;
    }
    
    .uploaded-images {
        justify-content: center;
    }
    
    .refund-info {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .return-modal-header h3 {
        font-size: 18px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 12px;
    }
    
    .uploaded-image img {
        width: 60px;
        height: 60px;
    }
    
    .remove-image {
        width: 20px;
        height: 20px;
        font-size: 12px;
        top: -6px;
        right: -6px;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.uploading-image {
    display: inline-block;
    margin: 5px;
    padding: 20px;
    border: 2px dashed #ccc;
    text-align: center;
    width: 80px;
    height: 80px;
    line-height: 40px;
    font-size: 12px;
    color: #666;
    border-radius: 6px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Custom Scrollbar */
.return-modal-content::-webkit-scrollbar {
    width: 8px;
}

.return-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.return-modal-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.return-modal-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Product Selection Styles */
.products-selection {
    display: grid;
    gap: 16px;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    background: #fafafa;
}

.product-selection-item {
    background: white;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.product-selection-item:hover {
    border-color: #0073aa;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.1);
}

.product-selection-item.selected {
    border-color: #0073aa;
    background: #f0f8ff;
}

.product-checkbox-wrapper {
    position: relative;
}

.product-checkbox-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.product-selection-label {
    display: flex;
    align-items: center;
    padding: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.product-selection-label:hover {
    background: #f8f9fa;
}

.product-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    margin-right: 16px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e1e1e1;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    flex-grow: 1;
    margin-right: 16px;
}

.product-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.product-quantity,
.product-price {
    margin: 2px 0;
    font-size: 12px;
    color: #666;
}

.product-price {
    font-weight: 600;
    color: #0073aa;
}

.product-variations {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.variation-tag {
    background: #e1e1e1;
    color: #666;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
}

.selection-indicator {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: 2px solid #e1e1e1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: all 0.3s ease;
}

.product-selection-item.selected .selection-indicator {
    background: #0073aa;
    border-color: #0073aa;
    color: white;
}

.selection-indicator .checkmark {
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: bold;
}

.product-selection-item.selected .selection-indicator .checkmark {
    opacity: 1;
    transform: scale(1);
}

.quantity-selection {
    padding: 12px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e1e1e1;
}

.quantity-selection label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

.quantity-input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    margin-right: 8px;
}

.quantity-selection small {
    color: #666;
    font-size: 11px;
}

/* Image Upload Improvements */
.image-upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    background: #fafafa;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.image-upload-area:hover {
    border-color: #0073aa;
    background: #f0f8ff;
}

.image-upload-area.dragover {
    border-color: #0073aa;
    background: #e6f3ff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 32px;
    color: #0073aa;
    margin-bottom: 12px;
}

.upload-text {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.file-input {
    display: none;
}

.uploaded-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.uploaded-image {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e1e1e1;
}

.uploaded-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-image:hover {
    background: rgba(255, 0, 0, 1);
}
