/**
 * File: rma.css
 * Tema: astra-child
 * Versione: 4.2.0 (Fix: Submit Visibility + Dynamic Warranty Badge)
 */

.rma-wrapper { max-width: 900px; margin: 40px auto; padding: 35px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.06); font-family: system-ui, -apple-system, sans-serif; color: #2d3748; line-height: 1.5; }
.rma-title { color: #1a202c; border-bottom: 3px solid #0073aa; padding-bottom: 12px; margin-bottom: 30px; font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }

/* STEP */
.rma-step { display: none; margin-bottom: 25px; border-left: 5px solid #e2e8f0; padding: 20px; background: #f8fafc; border-radius: 8px; transition: all 0.3s ease; }
.rma-step[data-step="1"] { display: block; border-left-color: #0073aa; background: #fff; }
.rma-step.rma-step-active { display: block; border-left-color: #0073aa; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.05); animation: slideIn 0.4s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.step-title { font-size: 20px; font-weight: 700; color: #2d3748; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.step-number { background: #0073aa; color: #fff; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }

/* INPUT - FIX TESTO TAGLIATO */
.rma-label { display: block; font-weight: 700; margin-bottom: 8px; color: #4a5568; font-size: 15px; }
.rma-input, .rma-select, .rma-textarea, .dev-work-code, .dev-serial, .dev-fault, .dev-tests, .dev-history {
    width: 100%; padding: 14px; border: 2px solid #e2e8f0; border-radius: 8px; font-size: 16px;
    box-sizing: border-box; transition: border-color 0.2s, box-shadow 0.2s; line-height: 1.6; min-height: 48px; font-family: inherit;
}
.rma-input:focus, .rma-select:focus, .rma-textarea:focus { border-color: #0073aa; outline: none; box-shadow: 0 0 0 3px rgba(0,115,170,0.1); }
.rma-input.rma-valid, .rma-textarea.rma-valid { border-color: #48bb78; background: #f0fff4; }
.rma-input.rma-error, .rma-textarea.rma-error { border-color: #f56565; background: #fff5f5; }
.rma-feedback { font-size: 16px; margin-top: 8px; font-weight: 600; min-height: 20px; display: block; }

/* CLAUSOLE */
.rma-clause-box { background: #fffaf0; border-left: 5px solid #ed8936; padding: 18px; border-radius: 6px; }
.rma-clause-box h4 { margin: 0 0 8px 0; color: #c05621; font-size: 17px; }

/* CHECKBOX */
.rma-checkbox-label { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; font-weight: 600; font-size: 16px; padding: 14px; background: #f7fafc; border-radius: 8px; border: 2px solid #e2e8f0; transition: background 0.2s; }
.rma-checkbox-label:hover { background: #edf2f7; }
.rma-checkbox-label input { width: 22px; height: 22px; margin-top: 2px; accent-color: #0073aa; flex-shrink: 0; }

/* DISPOSITIVI */
#rma-devices-step { background: #f7fafc; border: 2px dashed #cbd5e0; padding: 25px; margin-top: 25px; border-radius: 10px; }
.rma-device-block { background: #fff; border: 2px solid #e2e8f0; border-left: 6px solid #a0aec0; padding: 22px; margin-bottom: 25px; border-radius: 8px; position: relative; transition: all 0.3s; }
.rma-device-block.rma-validated { border-left-color: #48bb78; border-color: #c6f6d5; background: #f0fff4; }
.rma-device-block.rma-error { border-left-color: #f56565; background: #fff5f5; border-color: #fed7d7; }
.rma-field-group { margin-bottom: 18px; }

/* AUTO-DESCRIZIONE + GARANZIA DINAMICA */
.dev-invoice-desc-group { margin-bottom: 20px; animation: fadeIn 0.5s ease; }

.dev-description-display { 
    background: #e8f5e9 !important; 
    border: 2px solid #48bb78 !important; 
    padding: 14px 16px !important; /* Margini identici sopra e sotto */
    border-radius: 6px; 
    font-size: 16px; 
    line-height: 1.5; /* Spaziatura ideale tra la prima e l'eventuale seconda riga */
    color: #22543d; 
    font-weight: 600; 
    width: 100%; 
    box-sizing: border-box; 
    cursor: not-allowed; 
    word-wrap: break-word; /* Permette al testo di andare a capo dolcemente */
}
.warranty-dynamic-badge { margin-top: 8px; padding: 6px 10px; background: #e8f5e9; border: 1px solid #48bb78; border-radius: 4px; font-size: 14px; color: #22543d; font-weight: 600; }

/* FEEDBACK VALIDAZIONE */
.serial-feedback, .workcode-feedback { margin-top: 10px; font-size: 18px; font-weight: 600; line-height: 1.5; padding: 12px; border-radius: 6px; background: #fff; border-left: 4px solid #cbd5e0; display: none; }
.serial-feedback.success, .workcode-feedback.success { background: #f0fff4; border-left-color: #48bb78; color: #22543d; display: block; }
.serial-feedback.warning, .workcode-feedback.warning { background: #fffaf0; border-left-color: #ed8936; color: #744210; display: block; }
.serial-feedback.error, .workcode-feedback.error { background: #fff5f5; border-left-color: #f56565; color: #742a2a; display: block; }

.rma-validation-badge { display: none; background: #48bb78; color: #fff; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; margin-left: 10px; vertical-align: middle; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }

.rma-remove-btn { position: absolute; top: 15px; right: 15px; background: #fff; border: 1px solid #e2e8f0; color: #e53e3e; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; line-height: 1; transition: all 0.2s; }
.rma-remove-btn:hover { background: #fff5f5; border-color: #f56565; transform: scale(1.1); }

/* PULSANTI */
.rma-btn { padding: 14px 28px; border: none; border-radius: 8px; cursor: pointer; font-size: 16px; font-weight: 700; transition: all 0.2s; text-align: center; }
.rma-btn:disabled { background: #e2e8f0; color: #a0aec0; cursor: not-allowed; box-shadow: none; }
.rma-btn-primary { background: #0073aa; color: #fff; width: 100%; box-shadow: 0 4px 6px rgba(0,115,170,0.3); }
.rma-btn-primary:hover:not(:disabled) { background: #005a87; transform: translateY(-1px); box-shadow: 0 6px 8px rgba(0,115,170,0.4); }
.rma-btn-secondary { background: #fff; color: #0073aa; border: 2px solid #0073aa; }
.rma-btn-secondary:hover { background: #ebf8ff; }

/* SUBMIT AREA */
#rma-submit-area { 
    display: none;
    margin-top: 30px; 
    padding-top: 25px; 
    border-top: 3px solid #e2e8f0; 
}
#rma-submit-area.ready { 
    animation: fadeIn 0.5s ease; 
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* RESPONSIVE */
@media (max-width: 768px) {
    .rma-wrapper { padding: 20px; margin: 20px auto; }
    .rma-title { font-size: 22px; }
    .step-title { font-size: 18px; }
    .rma-input, .rma-select, .rma-textarea { font-size: 16px; padding: 12px; }
    .rma-device-block > div:first-child { grid-template-columns: 1fr !important; gap: 10px !important; }
    .serial-feedback, .workcode-feedback { font-size: 16px; }
}
