/* Card Solidali — Frontend CSS */

.cs-personalizza-wrap {
    margin: 24px 0 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.cs-personalizza-header {
    padding: 16px 20px 12px;
    background: #f9f9f9;
    border-bottom: 1px solid #e8e8e8;
}

.cs-personalizza-header h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: #222; }
.cs-personalizza-sub       { margin: 0; font-size: 13px; color: #666; line-height: 1.5; }

.cs-fields { padding: 20px; }

/* Campi generici */
.cs-field-row      { margin-bottom: 16px; }
.cs-field-row:last-child { margin-bottom: 0; }

.cs-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}

.cs-required { color: #c0392b; }

.cs-input,
.cs-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 5px;
    font-size: 14px;
    color: #333;
    background: #fafafa;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}

.cs-input:focus,
.cs-textarea:focus {
    outline: none;
    border-color: #2e7d32;
    box-shadow: 0 0 0 2px rgba(46,125,50,.12);
    background: #fff;
}

.cs-input-date  { max-width: 200px; }
.cs-textarea    { resize: vertical; min-height: 80px; }
.cs-field-hint  { display: block; font-size: 12px; color: #999; margin-top: 4px; }
.cs-char-counter { font-size: 12px; color: #aaa; font-weight: 400; }

/* Radio tipo card */
.cs-radio-group { display: flex; gap: 10px; flex-wrap: wrap; }

.cs-radio-option { flex: 1; min-width: 140px; cursor: pointer; }

.cs-radio-option input[type="radio"] {
    position: absolute; opacity: 0; width: 0; height: 0;
}

.cs-radio-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid #ddd;
    border-radius: 7px;
    background: #fafafa;
    transition: border-color .15s, background .15s;
    cursor: pointer;
}

.cs-radio-option input[type="radio"]:checked + .cs-radio-box {
    border-color: #2e7d32;
    background: #f0f7f0;
}

.cs-radio-icon { font-size: 20px; line-height: 1; }

.cs-radio-text { display: flex; flex-direction: column; }
.cs-radio-text strong { font-size: 13px; color: #333; line-height: 1.3; }
.cs-radio-text small  { font-size: 11px; color: #888; margin-top: 2px; }

/* Sezione destinatari */
.cs-destinatari-section { margin-top: 20px; }

.cs-destinatari-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 12px;
}

.cs-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #2e7d32;
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

/* Blocco singolo destinatario */
.cs-dest-block {
    border: 1px solid #e4e4e4;
    border-radius: 7px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow .15s;
}

.cs-dest-block:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }

.cs-dest-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f5f5f5;
    border-bottom: 1px solid #e4e4e4;
}

.cs-dest-label { font-size: 13px; font-weight: 600; color: #333; }

.cs-btn-remove {
    background: none;
    border: none;
    color: #c0392b;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background .15s;
}

.cs-btn-remove:hover { background: #fdf0f0; }

.cs-dest-inner { padding: 14px; }

/* Bottone aggiungi destinatario */
.cs-btn-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    background: transparent;
    border: 1px dashed #2e7d32;
    border-radius: 6px;
    color: #2e7d32;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    margin-top: 4px;
    transition: background .15s;
}

.cs-btn-add:hover { background: #f0f7f0; }

/* Bottone anteprima */
.cs-btn-preview {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: transparent;
    border: 1px solid #2e7d32;
    border-radius: 5px;
    color: #2e7d32;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.cs-btn-preview:hover { background: #2e7d32; color: #fff; }

/* Modal anteprima */
.cs-modal { position: fixed; inset: 0; z-index: 99999; }

.cs-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.6);
}

.cs-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #f0f0f0;
    border-radius: 10px;
    width: 95%;
    max-width: 860px;
    max-height: 90vh;
    overflow-y: auto;
}

.cs-modal-close {
    position: sticky;
    top: 0;
    float: right;
    background: #fff;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 10px 14px;
    color: #666;
    z-index: 1;
}

.cs-modal-close:hover { color: #000; }
#cs-preview-body { clear: both; padding: 20px}
#cs-preview-body iframe { width: 100%; border: none; min-height: 500px; }

.cs-preview-loading {
    padding: 40px;
    text-align: center;
    color: #888;
    font-size: 14px;
}