/**
 * RMA (Returns & Exchanges) - Styles
 *
 * @package TUH_Account
 * @since 4.0.0
 */

/* Container */
.tuh-rma {
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
.tuh-rma-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.tuh-rma-title h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 4px 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--tuh-text-primary, #1a1a1a);
}

.tuh-rma-title h2 svg {
    color: var(--tuh-primary, #7c3aed);
}

.tuh-rma-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--tuh-text-muted, #6b7280);
}

/* Info Box */
.tuh-rma-info {
    display: flex;
    gap: 12px;
    padding: 16px;
    margin-bottom: 24px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
}

.tuh-rma-info svg {
    flex-shrink: 0;
    color: #3b82f6;
}

.tuh-rma-info strong {
    display: block;
    margin-bottom: 4px;
    color: #1e40af;
}

.tuh-rma-info p {
    margin: 0;
    font-size: 0.875rem;
    color: #1e40af;
}

/* Section */
.tuh-rma-section {
    margin-bottom: 32px;
}

.tuh-rma-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--tuh-text-primary, #1a1a1a);
}

.tuh-rma-section-title svg {
    color: var(--tuh-primary, #7c3aed);
}

.tuh-section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: var(--tuh-primary, #7c3aed);
    border-radius: 11px;
}

/* Request List */
.tuh-rma-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Request Card */
.tuh-rma-card {
    background: var(--tuh-card-bg, var(--surface, #fff));
    border: 1px solid var(--tuh-card-border, var(--border, #e5e7eb));
    border-radius: 12px;
    overflow: hidden;
}

.tuh-rma-card.cancelled,
.tuh-rma-card.rejected {
    opacity: 0.7;
}

.tuh-rma-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--tuh-bg-secondary, var(--bg-subtle, #f9fafb));
    border-bottom: 1px solid var(--tuh-card-border, var(--border, #e5e7eb));
}

.tuh-rma-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tuh-rma-type {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
}

.tuh-type-return {
    color: #b45309;
    background: #fef3c7;
}

.tuh-type-exchange {
    color: #047857;
    background: #d1fae5;
}

.tuh-rma-order {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--tuh-text-primary, #1a1a1a);
}

.tuh-rma-status {
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 20px;
}

.tuh-status-pending {
    color: #b45309;
    background: #fef3c7;
}

.tuh-status-approved {
    color: #047857;
    background: #d1fae5;
}

.tuh-status-rejected {
    color: #b91c1c;
    background: #fee2e2;
}

.tuh-status-shipped {
    color: #1d4ed8;
    background: #dbeafe;
}

.tuh-status-received {
    color: #6d28d9;
    background: #ede9fe;
}

.tuh-status-completed {
    color: #047857;
    background: #d1fae5;
}

.tuh-status-cancelled {
    color: var(--tuh-text-muted, #6b7280);
    background: var(--tuh-bg-secondary, var(--bg-subtle, #f3f4f6));
}

/* Card Body */
.tuh-rma-card-body {
    padding: 16px;
}

.tuh-rma-items-preview {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.tuh-rma-item-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--tuh-bg-secondary, var(--bg-subtle, #f3f4f6));
}

.tuh-rma-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tuh-rma-item-more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--tuh-text-muted, #6b7280);
    background: var(--tuh-bg-secondary, var(--bg-subtle, #f3f4f6));
    border-radius: 8px;
}

.tuh-rma-details {
    font-size: 0.9rem;
}

.tuh-rma-reason {
    margin: 0 0 4px 0;
    color: var(--tuh-text-primary, #1a1a1a);
}

.tuh-rma-notes {
    margin: 0;
    color: var(--tuh-text-muted, #6b7280);
    font-style: italic;
}

/* Card Footer */
.tuh-rma-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--tuh-bg-secondary, var(--bg-subtle, #f9fafb));
    border-top: 1px solid var(--tuh-card-border, var(--border, #e5e7eb));
}

.tuh-rma-meta {
    display: flex;
    gap: 16px;
}

.tuh-rma-date,
.tuh-rma-tracking {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--tuh-text-muted, #6b7280);
}

.tuh-rma-actions {
    display: flex;
    gap: 8px;
}

/* Empty State */
.tuh-rma-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    background: var(--tuh-bg-secondary, var(--bg-subtle, #f9fafb));
    border: 2px dashed var(--tuh-card-border, var(--border, #e5e7eb));
    border-radius: 12px;
}

.tuh-rma-empty svg {
    color: var(--tuh-text-muted, #6b7280);
    opacity: 0.5;
    margin-bottom: 16px;
}

.tuh-rma-empty p {
    margin: 0;
    font-size: 1rem;
    color: var(--tuh-text-secondary, #4b5563);
}

.tuh-rma-empty-hint {
    margin-top: 8px !important;
    font-size: 0.875rem !important;
    color: var(--tuh-text-muted, #6b7280) !important;
}

/* Modal */
.tuh-rma-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    align-items: center;
    justify-content: center;
}

.tuh-rma-modal[aria-hidden="false"] {
    display: flex;
}

.tuh-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.tuh-modal-container {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    margin: 20px;
    background: var(--tuh-card-bg, var(--surface, #fff));
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: tuh-modal-in 0.3s ease;
}

@keyframes tuh-modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tuh-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--tuh-border, #e5e7eb);
    flex-shrink: 0;
}

.tuh-modal-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.tuh-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--tuh-text-muted, #6b7280);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tuh-modal-close:hover {
    background: var(--tuh-bg-secondary, var(--bg-subtle, #f3f4f6));
    color: var(--tuh-text-primary, #1a1a1a);
}

.tuh-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Form Groups */
.tuh-form-group {
    margin-bottom: 16px;
}

.tuh-form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tuh-text-primary, #1a1a1a);
}

.tuh-form-group select,
.tuh-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.9rem;
    border: 1px solid var(--tuh-border, #e5e7eb);
    border-radius: 8px;
    transition: border-color 0.2s ease;
}

.tuh-form-group select:focus,
.tuh-form-group textarea:focus {
    outline: none;
    border-color: var(--tuh-primary, #7c3aed);
}

/* Radio Group */
.tuh-radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tuh-radio {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--tuh-bg-secondary, var(--bg-subtle, #f9fafb));
    border: 1px solid var(--tuh-card-border, var(--border, #e5e7eb));
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tuh-radio:hover {
    border-color: var(--tuh-primary, #7c3aed);
}

.tuh-radio input {
    display: none;
}

.tuh-radio-mark {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    border: 2px solid var(--tuh-border, #d1d5db);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.tuh-radio input:checked ~ .tuh-radio-mark {
    border-color: var(--tuh-primary, #7c3aed);
    background: var(--tuh-primary, #7c3aed);
    box-shadow: inset 0 0 0 4px #fff;
}

.tuh-radio-label strong {
    display: block;
    font-size: 0.9rem;
    color: var(--tuh-text-primary, #1a1a1a);
}

.tuh-radio-label small {
    font-size: 0.8rem;
    color: var(--tuh-text-muted, #6b7280);
}

/* Items Selection */
.tuh-rma-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
}

.tuh-rma-item-check {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--tuh-bg-secondary, var(--bg-subtle, #f9fafb));
    border: 1px solid var(--tuh-card-border, var(--border, #e5e7eb));
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tuh-rma-item-check:hover {
    border-color: var(--tuh-primary, #7c3aed);
}

.tuh-rma-item-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--tuh-primary, #7c3aed);
}

.tuh-rma-item-check img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
}

.tuh-rma-item-check span {
    flex: 1;
    font-size: 0.875rem;
    color: var(--tuh-text-primary, #1a1a1a);
}

.tuh-rma-item-check small {
    font-size: 0.75rem;
    color: var(--tuh-text-muted, #6b7280);
}

/* Modal Footer */
.tuh-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--tuh-border, #e5e7eb);
}

/* Buttons — SPA selector (.tuh-section prefix) beats spa-classic reset:
   html body .tuh-spa-wrapper .tuh-async-dashboard button (0,2,3)
   .tuh-section .tuh-rma .tuh-btn → 0,3,0
   Classic selector (.tuh-rma only) works because SPA reset doesn't apply */
.tuh-rma .tuh-btn,
.tuh-section .tuh-rma .tuh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tuh-rma .tuh-btn-small,
.tuh-section .tuh-rma .tuh-btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.tuh-rma .tuh-btn-primary,
.tuh-section .tuh-rma .tuh-btn-primary {
    color: #fff;
    background: var(--tuh-primary, #7c3aed);
    background-color: var(--tuh-primary, #7c3aed);
}

.tuh-rma .tuh-btn-primary:hover,
.tuh-section .tuh-rma .tuh-btn-primary:hover {
    background: var(--tuh-primary-dark, #6d28d9);
    background-color: var(--tuh-primary-dark, #6d28d9);
}

.tuh-rma .tuh-btn-secondary,
.tuh-section .tuh-rma .tuh-btn-secondary {
    color: var(--tuh-text-secondary, #4b5563);
    background: var(--tuh-bg-secondary, var(--bg-subtle, #f3f4f6));
    background-color: var(--tuh-bg-secondary, var(--bg-subtle, #f3f4f6));
}

.tuh-rma .tuh-btn-secondary:hover,
.tuh-section .tuh-rma .tuh-btn-secondary:hover {
    background: var(--tuh-card-border, var(--border, #e5e7eb));
    background-color: var(--tuh-card-border, var(--border, #e5e7eb));
}

.tuh-rma .tuh-btn-danger,
.tuh-section .tuh-rma .tuh-btn-danger {
    color: #fff;
    background: var(--tuh-error, #ef4444);
    background-color: var(--tuh-error, #ef4444);
}

.tuh-rma .tuh-btn-danger:hover,
.tuh-section .tuh-rma .tuh-btn-danger:hover {
    background: #dc2626;
    background-color: #dc2626;
}

.tuh-rma .tuh-btn:disabled,
.tuh-section .tuh-rma .tuh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Toast */
.tuh-rma-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 1100;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    background: #1f2937;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tuh-rma-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

.tuh-rma-toast.success {
    background: var(--tuh-success, #10b981);
}

.tuh-rma-toast.error {
    background: var(--tuh-error, #ef4444);
}

/* Responsive */
@media (max-width: 900px) {
    .tuh-rma {
        max-width: 100%;
    }

    .tuh-rma-header {
        align-items: flex-start;
    }

    #tuh-rma-new-btn {
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }

    .tuh-rma-info {
        align-items: flex-start;
    }

    .tuh-rma-info p {
        overflow-wrap: anywhere;
    }

    .tuh-rma-section-title {
        flex-wrap: wrap;
    }

    .tuh-rma-card-header {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 10px;
    }

    .tuh-rma-card-title {
        flex-wrap: wrap;
        min-width: 0;
    }

    .tuh-rma-order {
        overflow-wrap: anywhere;
    }

    .tuh-rma-card-footer {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 10px 12px;
    }

    .tuh-rma-meta {
        flex: 1 1 180px;
        min-width: 120px;
        flex-wrap: wrap;
        gap: 6px 12px;
    }

    .tuh-rma-date,
    .tuh-rma-tracking {
        overflow-wrap: anywhere;
    }

    .tuh-rma-actions {
        flex: 1 1 100%;
        width: 100%;
        flex-wrap: wrap;
    }

    .tuh-rma-actions .tuh-btn,
    .tuh-section .tuh-rma-actions .tuh-btn {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    .tuh-rma-item-check {
        align-items: flex-start;
    }

    .tuh-rma-item-check span {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .tuh-modal-container {
        width: calc(100% - 24px);
        margin: 12px;
    }
}

@media (max-width: 640px) {
    .tuh-rma-header {
        flex-direction: column;
        align-items: stretch;
    }

    .tuh-rma-card-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .tuh-rma-card-footer {
        flex-direction: column;
        gap: 12px;
    }

    .tuh-rma-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .tuh-rma-actions .tuh-btn,
    .tuh-section .tuh-rma-actions .tuh-btn {
        flex: 1 1 100%;
        min-height: 44px;
    }

    .tuh-modal-container {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }

    .tuh-modal-footer {
        flex-direction: column;
    }

    .tuh-modal-footer .tuh-btn,
    .tuh-section .tuh-modal-footer .tuh-btn {
        width: 100%;
    }

    .tuh-radio-group {
        gap: 8px;
    }
}
