/* ============================================================
   Note NG – assets/note-ng.css  |  Version 1.6.8
   ============================================================ */

/* ── Wrapper ─────────────────────────────────────────────── */
#note-ng-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #1e293b;
    max-width: 1000px;
    margin: 0 auto;
}

/* ── Card contenitore form ───────────────────────────────── */
#note-ng-form-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 24px 28px 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

/* ── Header form (titolo + data pill) ────────────────────── */
.nng-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}
.nng-form-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

/* ── Data pill (top right) ───────────────────────────────── */
.nng-date-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.nng-date-pill {
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 20px !important;
    padding: 5px 14px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #374151 !important;
    background: #f8fafc !important;
    width: auto !important;
    cursor: pointer;
}
.nng-date-pill:disabled,
.nng-date-pill.locked {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
}

/* ── Griglia 2 colonne ───────────────────────────────────── */
.nng-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 18px;
}
.nng-field-full {
    margin-bottom: 18px;
}

/* ── Gruppo campo ────────────────────────────────────────── */
.nng-field-group {
    display: flex;
    flex-direction: column;
}
.nng-field-header {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 7px;
}

/* ── Checkbox ────────────────────────────────────────────── */
.nng-chk,
.nng-chk-label input[type="checkbox"],
.note-ng-unlock-chk {
    width: 15px;
    height: 15px;
    accent-color: #3b82f6;
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Etichette ───────────────────────────────────────────── */
.nng-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: #64748b;
    cursor: pointer;
}
.nng-req { color: #ef4444; }

/* ── Wrapper input (per badge) ───────────────────────────── */
.nng-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nng-input-wrap .note-ng-field {
    flex: 1;
    min-width: 0;
}

/* ── Campi ───────────────────────────────────────────────── */
.note-ng-field {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    background: #ffffff;
    box-sizing: border-box;
    transition: border-color .18s, box-shadow .18s;
    font-family: inherit;
}
.note-ng-field:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
textarea.note-ng-field {
    resize: vertical;
    min-height: 100px;
}

/* ── Campi BLOCCATI ──────────────────────────────────────── */
.note-ng-field:disabled,
.note-ng-field.locked {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
    border-color: #e2e8f0 !important;
}

/* ── Badge conteggio note (arancio, dentro campo tel) ─────── */
.nng-count-badge {
    display: inline-block;
    background: #fff3cd;
    color: #92400e;
    border: 1px solid #fbbf24;
    border-radius: 20px;
    padding: 3px 11px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Pulsanti form ───────────────────────────────────────── */
.nng-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.nng-btn-save {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 11px 26px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: background .18s;
}
.nng-btn-save:hover { background: #1d4ed8; }
.nng-btn-cancel {
    background: #f1f5f9;
    color: #475569;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s;
}
.nng-btn-cancel:hover { background: #e2e8f0; }

/* ── Messaggi salvataggio ────────────────────────────────── */
.nng-msg {
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 6px;
}
.nng-msg.success { background: #dcfce7; color: #166534; }
.nng-msg.error   { background: #fee2e2; color: #991b1b; }

/* ── Avviso numero (prima delle note precedenti) ─────────── */
#note-ng-tel-alert {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #1d4ed8;
    margin-bottom: 10px;
}

/* ── Sezione note precedenti ─────────────────────────────── */
#note-ng-prev-container {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
}
.nng-prev-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #2563eb;
    margin-bottom: 12px;
}

/* ── Tabella note precedenti ─────────────────────────────── */
#note-ng-prev-list table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
#note-ng-prev-list td {
    padding: 8px 6px;
    border-bottom: 1px solid #dbeafe;
    vertical-align: top;
    color: #1e293b;
}
#note-ng-prev-list tr:last-child td { border-bottom: none; }
#note-ng-prev-list td:first-child {
    color: #64748b;
    white-space: nowrap;
    width: 100px;
}
#note-ng-prev-list td.nota-cell {
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Card elenco note ────────────────────────────────────── */
#note-ng-list-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px 24px 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

/* ── Header elenco ───────────────────────────────────────── */
.nng-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}
.nng-list-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}
.nng-list-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.nng-search {
    padding: 8px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    min-width: 200px;
    font-family: inherit;
}
.nng-search:focus { outline: none; border-color: #3b82f6; }
.nng-order {
    padding: 8px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
}

/* ── Tabella elenco ──────────────────────────────────────── */
#note-ng-list table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
#note-ng-list thead th {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #64748b;
    padding: 8px 14px;
    border-bottom: 2px solid #f1f5f9;
    text-align: left;
}
#note-ng-list tbody td {
    padding: 14px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
    color: #1e293b;
}
#note-ng-list tbody tr:last-child td { border-bottom: none; }
#note-ng-list tbody tr:hover td { background: #f8fafc; }
#note-ng-list .nota-cell {
    white-space: pre-wrap;
    word-break: break-word;
}
/* Numeri di telefono come link blu */
.nng-tel-link {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.nng-tel-link:hover { text-decoration: underline; }

/* ── Pulsanti tabella ────────────────────────────────────── */
.nng-btn-edit-row {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 13px;
    border: 1.5px solid #bfdbfe;
    border-radius: 6px;
    background: #f0f7ff;
    color: #2563eb;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    margin-right: 4px;
    transition: background .15s;
}
.nng-btn-edit-row:hover { background: #dbeafe; }
.nng-btn-delete-row {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 13px;
    border: 1.5px solid #fecaca;
    border-radius: 6px;
    background: #fff;
    color: #dc2626;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: background .15s;
}
.nng-btn-delete-row:hover { background: #fee2e2; }

/* ── Conteggio note (footer elenco) ──────────────────────── */
.nng-list-count {
    font-size: 12px;
    color: #94a3b8;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
}

/* ── Nessun risultato ────────────────────────────────────── */
.nng-empty {
    text-align: center;
    color: #94a3b8;
    padding: 28px;
    font-style: italic;
    font-size: 13px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
    .nng-row-2col { grid-template-columns: 1fr; }
    .nng-list-header { flex-direction: column; align-items: flex-start; }
    .nng-search { min-width: 160px; }
    #note-ng-list thead th:nth-child(2),
    #note-ng-list tbody td:nth-child(2) { display: none; }
}
