/* ==========================================
   Modal de Troca / Devolução - Layout Aprimorado
   ========================================== */

/* Overlay */
.return-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999999;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 4vh;
    overflow-y: auto;
    backdrop-filter: blur(4px);
}

/* Content */
.return-modal-content {
    background-color: #ffffff;
    padding: 0;
    border-radius: 16px;
    max-width: 640px;
    width: 92%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    position: relative;
    display: flex;
    flex-direction: column;
}

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

.return-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

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

/* Header */
.return-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 20px;
    background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

.return-modal-header h3 {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.return-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    cursor: pointer;
    font-size: 22px;
    color: #ffffff;
    line-height: 1;
    padding: 4px 10px;
    border-radius: 8px;
    transition: background 0.2s;
}

.return-modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Corpo do modal */
.return-modal-body {
    padding: 24px 28px;
    flex: 1;
    overflow-y: auto;
}

/* Form errors */
.return-form-errors {
    background: #fef2f2;
    border: 1px solid #ef4444;
    color: #991b1b;
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.5;
}

.return-form-errors strong {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #dc2626;
}

.return-form-errors ul {
    margin: 0;
    padding-left: 20px;
}

.return-form-errors li {
    margin-bottom: 3px;
}

/* Seções */
.return-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 18px;
}

.return-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.return-section-title svg {
    width: 16px;
    height: 16px;
    color: #2e7d32;
}

/* Form labels */
.return-form-label {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 10px;
    display: block;
}

.return-form-label.required span {
    color: #ef4444;
}

.return-form-select,
.return-form-textarea,
.return-form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background-color: #ffffff;
    color: #374151;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.return-form-select:focus,
.return-form-textarea:focus,
.return-form-input:focus {
    outline: none;
    border-color: #2e7d32;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.return-form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Product list */
.return-product-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.return-product-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    background: #ffffff;
    transition: all 0.2s ease;
}

.return-product-item:hover {
    border-color: #86efac;
    background: #f0fdf4;
}

.return-product-item.selected {
    border-color: #2e7d32;
    background-color: #f0fdf4;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.08);
}

.return-product-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #2e7d32;
}

.return-product-image {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
}

.return-product-info {
    flex: 1;
    min-width: 0;
}

.return-product-info p {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.return-product-info span {
    font-size: 13px;
    color: #64748b;
    display: block;
}

/* Type selection */
.return-type-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.return-type-label {
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    background-color: #ffffff;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.return-type-label:hover {
    border-color: #86efac;
    background: #f0fdf4;
}

.return-type-label.selected {
    border-color: #2e7d32;
    background-color: #f0fdf4;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.08);
}

.return-type-input {
    display: none;
}

.return-type-icon {
    width: 32px;
    height: 32px;
    color: #64748b;
}

.return-type-label.selected .return-type-icon {
    color: #2e7d32;
}

.return-type-text {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
}

.return-type-label.selected .return-type-text {
    color: #1b5e20;
}

/* Alerts */
.return-alert {
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.return-alert svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.return-alert.success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}

.return-alert.success svg {
    color: #22c55e;
}

.return-alert.warning {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
}

.return-alert.warning svg {
    color: #f59e0b;
}

.return-alert.info {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    color: #1e40af;
}

.return-alert.info svg {
    color: #3b82f6;
}

.return-alert.neutral {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.return-alert.neutral svg {
    color: #64748b;
}

/* Image upload */
.return-image-upload {
    margin-top: 4px;
}

.return-image-hint {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 12px;
    margin-top: 4px;
}

.return-image-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.return-image-preview {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
}

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

.return-image-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    line-height: 24px;
    text-align: center;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.return-image-remove:hover {
    background: #dc2626;
}

.return-image-add {
    width: 96px;
    height: 96px;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #94a3b8;
    font-size: 28px;
    transition: all 0.2s;
    background: #f8fafc;
}

.return-image-add:hover {
    border-color: #2e7d32;
    color: #2e7d32;
    background: #f0fdf4;
}

.return-image-add input {
    display: none;
}

.return-image-loading {
    margin-top: 8px;
    font-size: 13px;
    color: #2e7d32;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Item config */
.return-item-config {
    padding: 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 10px;
    background: #ffffff;
}

.return-item-name {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 10px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.return-item-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.return-item-field {
    flex: 1;
}

.return-item-field.narrow {
    width: 100px;
    flex: none;
}

.return-field-label {
    font-size: 12px;
    color: #64748b;
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

/* Inline summary */
.return-summary-inline {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1.5px solid #2e7d32;
    color: #166534;
    padding: 16px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.6;
}

.return-summary-inline .summary-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #166534;
}

.return-summary-inline p {
    margin: 0 0 6px;
}

.return-summary-inline ul {
    margin: 0 0 8px;
    padding-left: 18px;
}

.return-summary-inline li {
    margin-bottom: 3px;
}

/* Divider */
.return-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 20px 0;
}

/* Actions */
.return-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 20px 28px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
}

.return-modal-actions.end {
    justify-content: space-between;
}

.return-btn-cancelar,
.return-btn-confirmar,
.return-btn-fechar,
.return-btn-ver {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.return-btn-cancelar:hover,
.return-btn-confirmar:hover,
.return-btn-fechar:hover,
.return-btn-ver:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.return-btn-cancelar {
    background-color: #ffffff;
    color: #64748b;
    border: 1.5px solid #d1d5db;
}

.return-btn-cancelar:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}

.return-btn-confirmar,
.return-btn-ver {
    background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
    color: white;
}

.return-btn-confirmar:hover,
.return-btn-ver:hover {
    background: linear-gradient(135deg, #276829 0%, #154a18 100%);
}

.return-btn-fechar {
    background-color: #64748b;
    color: white;
}

.return-btn-fechar:hover {
    background-color: #475569;
}

/* Success state */
.return-success {
    text-align: center;
    padding: 40px 28px;
}

.return-success-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 4px 20px rgba(46, 125, 50, 0.15);
}

.return-success-icon svg {
    width: 36px;
    height: 36px;
    color: #22c55e;
}

.return-success-title {
    color: #166534;
    font-size: 24px;
    margin-bottom: 12px;
    font-weight: 700;
}

.return-success-text {
    color: #334155;
    font-size: 15px;
    margin-bottom: 8px;
    line-height: 1.5;
}

.return-success-subtext {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 28px;
}

/* Responsive */
@media (max-width: 640px) {
    .return-modal-overlay {
        padding-top: 0;
        align-items: flex-end;
    }

    .return-modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.2);
    }

    .return-modal-header {
        padding: 18px 20px 16px;
        border-radius: 16px 16px 0 0;
    }

    .return-modal-body {
        padding: 18px 20px;
    }

    .return-modal-actions {
        padding: 16px 20px;
        border-radius: 0;
    }

    .return-type-group {
        grid-template-columns: 1fr 1fr;
    }

    .return-product-item {
        padding: 12px;
    }

    .return-product-image {
        width: 48px;
        height: 48px;
    }

    .return-item-row {
        flex-direction: column;
        gap: 10px;
    }

    .return-item-field.narrow {
        width: 100%;
    }
}
