/* Shiprocket Vendor Returns Management Styles */

.shiprocket-vendor-returns {
    margin: 20px 0;
}

/* Modal Styles */
.shiprocket-modal,
.shiprocket-vendor-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    overflow-y: auto;
    padding: 20px;
}

.shiprocket-modal .modal-content,
.shiprocket-vendor-modal .modal-content {
    position: relative;
    background: white;
    max-width: 600px;
    margin: 50px auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.3s ease-out;
}

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

.shiprocket-modal .modal-header,
.shiprocket-vendor-modal .modal-header {
    padding: 20px;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.shiprocket-modal .modal-header h3,
.shiprocket-vendor-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.shiprocket-modal .close-modal,
.shiprocket-vendor-modal .close-modal {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    transition: color 0.2s ease;
}

.shiprocket-modal .close-modal:hover,
.shiprocket-vendor-modal .close-modal:hover {
    color: #333;
}

.shiprocket-modal .modal-body,
.shiprocket-vendor-modal .modal-body {
    padding: 20px;
}

.shiprocket-modal textarea,
.shiprocket-vendor-modal textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.shiprocket-modal .form-actions,
.shiprocket-vendor-modal .form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Returns Summary Cards */
.returns-summary {
    margin-bottom: 30px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: box-shadow 0.2s ease;
}

.summary-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.summary-card .card-icon {
    font-size: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.summary-card.total .card-icon {
    background-color: #f8f9fa;
    color: #6c757d;
}

.summary-card.pending .card-icon {
    background-color: #fff3cd;
    color: #856404;
}

.summary-card.approved .card-icon {
    background-color: #d1ecf1;
    color: #0c5460;
}

.summary-card.rejected .card-icon {
    background-color: #f8d7da;
    color: #721c24;
}

.summary-card.amount .card-icon {
    background-color: #d4edda;
    color: #155724;
}

.summary-card .card-content h3 {
    margin: 0 0 5px 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.summary-card .card-content p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* Status Filter */
.returns-filter {
    margin-bottom: 20px;
}

.status-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.status-filter a {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #666;
    font-size: 14px;
    transition: all 0.2s ease;
}

.status-filter a:hover {
    background-color: #f8f9fa;
    color: #333;
}

.status-filter a.active {
    background-color: #007cba;
    color: white;
    border-color: #007cba;
}

/* Returns Table */
.returns-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.returns-table th {
    background-color: #f8f9fa;
    color: #333;
    font-weight: 600;
    padding: 15px 12px;
    text-align: left;
    border-bottom: 2px solid #e1e5e9;
}

.returns-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e1e5e9;
    vertical-align: middle;
}

.returns-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Customer Info */
.customer-info strong {
    color: #333;
    font-size: 14px;
}

.customer-info small {
    color: #666;
    font-size: 12px;
}

/* Return Reason */
.return-reason .reason-text {
    color: #333;
    font-weight: 500;
}

.return-reason .view-details {
    color: #007cba;
    text-decoration: none;
    font-size: 12px;
}

.return-reason .view-details:hover {
    text-decoration: underline;
}

/* Status Badges */
.status-badge,
.shiprocket-status-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Table layout for proper column sizing */
.dokan-table,
.returns-table {
    table-layout: auto;
    width: 100%;
}

/* Prevent content overflow in all cells */
.dokan-table td,
.returns-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    vertical-align: middle;
}

/* Allow wrapping for customer info and reason columns */
.dokan-table td:nth-child(3),
.dokan-table td:nth-child(4),
.returns-table td:nth-child(3),
.returns-table td:nth-child(4) {
    white-space: normal;
    word-wrap: break-word;
}

/* Amount column - no wrap, right align */
.dokan-table td:nth-child(5),
.returns-table td:nth-child(5) {
    white-space: nowrap;
}

/* Status column - no wrap */
.dokan-table td:nth-child(6),
.returns-table td:nth-child(6) {
    white-space: nowrap;
}

/* Ensure badges don't overflow their cell */
.dokan-table td .shiprocket-status-badge,
.dokan-table td .status-badge,
.returns-table td .shiprocket-status-badge,
.returns-table td .status-badge {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

/* Amount column - right align */
.dokan-table th:nth-child(5),
.dokan-table td:nth-child(5),
.returns-table th:nth-child(5),
.returns-table td:nth-child(5) {
    text-align: right;
    min-width: 80px;
}

/* Status column - constrained width */
.dokan-table td:nth-child(6),
.dokan-table th:nth-child(6),
.returns-table td:nth-child(6),
.returns-table th:nth-child(6) {
    min-width: 140px;
    max-width: 200px;
}

/* Actions column */
.dokan-table th:nth-child(8),
.dokan-table td:nth-child(8),
.returns-table th:nth-child(8),
.returns-table td:nth-child(8) {
    min-width: 150px;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-approved {
    background-color: #d1ecf1;
    color: #0c5460;
}

.status-rejected {
    background-color: #f8d7da;
    color: #721c24;
}

.status-completed {
    background-color: #fff3cd;
    color: #856404;
}

.status-processing {
    background-color: #cce5ff;
    color: #0056b3;
}

.status-refund_approved {
    background-color: #d4edda;
    color: #155724;
}

.status-refund_rejected {
    background-color: #f8d7da;
    color: #721c24;
}

.status-error {
    background-color: #f5c6cb;
    color: #721c24;
}

/* Return Actions */
.return-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.return-actions .dokan-btn {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.return-actions .dokan-btn-success {
    background-color: #28a745;
    color: white;
    border: none;
}

.return-actions .dokan-btn-success:hover {
    background-color: #218838;
}

.return-actions .dokan-btn-danger {
    background-color: #dc3545;
    color: white;
    border: none;
}

.return-actions .dokan-btn-danger:hover {
    background-color: #c82333;
}

.return-actions .text-muted {
    color: #6c757d;
    font-style: italic;
    font-size: 12px;
}

/* Modal Styles */
.shiprocket-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.shiprocket-modal .modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.shiprocket-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e1e5e9;
}

.shiprocket-modal .modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.shiprocket-modal .close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.shiprocket-modal .close-modal:hover {
    color: #333;
}

.shiprocket-modal .modal-body {
    padding: 20px;
}

/* Return Details */
.return-details .detail-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.return-details .detail-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.return-details .detail-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 14px;
}

.return-details .detail-group span {
    color: #666;
    font-size: 14px;
}

.return-details .detail-group p {
    color: #666;
    margin: 5px 0 0 0;
    line-height: 1.5;
}

.return-details .rejection-reason {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 15px;
}

.return-details .rejection-reason label {
    color: #721c24;
}

.return-details .rejection-reason p {
    color: #721c24;
    margin: 5px 0;
}

.return-details .rejection-reason small {
    color: #721c24;
    opacity: 0.8;
}

/* Return Images */
.return-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.return-image {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.return-image:hover {
    transform: scale(1.05);
}

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

.dokan-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Pagination */
.dokan-pagination-container {
    margin-top: 30px;
    text-align: center;
}

.dokan-pagination {
    display: inline-flex;
    gap: 5px;
}

.dokan-pagination a {
    padding: 8px 12px;
    border: 1px solid #ddd;
    color: #007cba;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.dokan-pagination a:hover {
    background-color: #f8f9fa;
}

.dokan-pagination .current {
    background-color: #007cba;
    color: white;
    border-color: #007cba;
}

/* Responsive Design */
@media (max-width: 768px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .status-filter {
        flex-wrap: wrap;
    }
    
    .returns-table {
        font-size: 12px;
    }
    
    .returns-table th,
    .returns-table td {
        padding: 10px 8px;
    }
    
    .return-actions {
        flex-direction: column;
    }
    
    .return-actions .dokan-btn {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .shiprocket-modal .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .return-images {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .return-image {
        height: 80px;
    }
}

/* Dokan Integration */
.dokan-dashboard-wrap .shiprocket-vendor-returns {
    background: transparent;
}

.dokan-dashboard-content .shiprocket-vendor-returns .returns-table {
    margin-top: 0;
}