/* =============================================================================
   communication.css : Analyser > Communication (communicate.php), fichier unique du domaine
   Réutilise Foundation 6 (label, callout, button, button-group, fieldset) et .button-action de style.css.
   ============================================================================= */

/* Barre d'actions du haut et des étapes */
.communication-toolbar-actions {
	margin-bottom: 1rem;
}

.communication-step-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-top: 1rem;
}

.communication-step-actions .button {
	margin-bottom: 0;
}

/* Étapes de l'assistant (même principe que generate_document) */
.communication-steps {
	margin-bottom: 1rem;
	border-bottom: 1px solid #e6e6e6;
}

.communication-steps a.is-active {
	font-weight: bold;
	border-bottom: 3px solid #1779ba;
}

/* Statuts (tags de traduction ComStatus*) */
.communication-status-draft,
.communication-status-pending,
.communication-status-excluded { background: #767676; }
.communication-status-scheduled { background: #ffae00; color: #0a0a0a; }
.communication-status-sending { background: #1779ba; }
.communication-status-sent { background: #1a7f3f; }
.communication-status-sentwitherrors,
.communication-status-failed { background: #cc4b37; }

/* Envois en cours (rafraîchis toutes les 3 s) */
.communication-in-progress {
	margin-bottom: 1rem;
}

.communication-message-status .ui-progressbar {
	height: 1rem;
	margin: 0.5rem 0;
	min-width: 8rem;
}

/* Tableaux */
.communication-table .communication-actions {
	white-space: nowrap;
}

.communication-rent-no-email td {
	color: #8a8a8a;
}

.communication-summary {
	margin-bottom: 0.5rem;
}

/* Étiquettes de publipostage : pastilles (liste de gauche et texte) */
.communication-merge-tag {
	background: #1a7f3f;
	color: #fefefe;
	border-radius: 3px;
	font-size: 0.85rem;
	margin: 0 0.1rem;
	white-space: nowrap;
	user-select: none;
}

.communication-merge-source {
	cursor: grab;
	border: 0;
	margin: 0 0.15rem 0.35rem 0;
}

.communication-merge-source:hover,
.communication-merge-source:focus {
	background: #14633a;
}

.communication-merge-panel {
	background: #f7f7f7;
	border: 1px solid #e6e6e6;
	border-radius: 3px;
	padding: 0.75rem;
	margin-bottom: 1rem;
}

.communication-merge-group h6 {
	margin: 0.5rem 0 0.35rem 0;
	color: #1a7f3f;
	font-weight: bold;
}

/* Éditeur maison : objet sur une ligne, corps avec gras / italique / souligné ; polices standard multilingues */
.communication-editor {
	background: #fefefe;
	border: 1px solid #cacaca;
	border-radius: 3px;
	padding: 0.5rem 0.75rem;
	margin-bottom: 1rem;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 1rem;
	line-height: 1.6;
	color: #0a0a0a;
	overflow-wrap: break-word;
}

.communication-editor:focus {
	outline: none;
	border-color: #1779ba;
	box-shadow: 0 0 5px #cacaca;
}

.communication-editor:empty::before {
	content: attr(data-placeholder);
	color: #8a8a8a;
}

.communication-editor-subject {
	min-height: 2.5rem;
	white-space: nowrap;
	overflow: hidden;
}

.communication-editor-body {
	min-height: 16rem;
}

.communication-toolbar {
	margin-bottom: 0.25rem;
}

.communication-toolbar .button {
	min-width: 2.5rem;
}

/* Aperçu et détail : l'email tel qu'il sera ou a été envoyé */
.communication-preview-frame {
	width: 100%;
	height: 32rem;
	border: 1px solid #e6e6e6;
	background: #fefefe;
	margin-bottom: 1rem;
}


/* v2 : fieldsets du tableau de bord */
.communication-fieldset legend {
	font-weight: bold;
	color: #1a7f3f;
}

/* Filtres : une ligne pleine largeur par clé, options en cases à cocher avec le nombre de locations actives */
.communication-filter-key {
	padding: 0.5rem 0;
	border-bottom: 1px solid #e6e6e6;
}

.communication-filter-options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.25rem;
	margin-top: 0.35rem;
}

.communication-filter-option label {
	margin: 0;
}

.communication-filter-type {
	margin-top: 0.5rem;
}

.communication-filter-subtypes {
	margin-left: 1.75rem;
}

/* Destinataires : ligne d'en-tête par adresse, colonne Location avec lien de modification 16x16 */
.communication-recipients tr.communication-address-row td {
	background: #f0f8f5;
	border-top: 2px solid #1a7f3f;
}

.communication-rent-cell {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
}

.communication-rent-cell .communication-edit-rent {
	flex: 0 0 auto;
}

/* v3 : signature au choix et aperçu par location */
.communication-signature-buttons {
	margin-bottom: 0.5rem;
}

.communication-signature-preview {
	background: #f7f7f7;
	border: 1px dashed #cacaca;
	border-radius: 3px;
	padding: 0.5rem 0.75rem;
	font-family: Arial, Helvetica, sans-serif;
	line-height: 1.6;
}

.communication-preview-rent {
	margin-bottom: 0.75rem;
}

.communication-attachment-input {
	display: none;
}

.communication-attachments .button-action {
	margin-right: 0.75rem;
}

.communication-attachment-list {
	margin: 0.75rem 0;
}

.communication-attachment {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem;
	padding: 0.35rem 0;
	border-bottom: 1px solid #e6e6e6;
}

.communication-attachment-name {
	overflow-wrap: anywhere;
}

.communication-attachment .button-action {
	margin: 0 0 0 auto;
}

.communication-email-size {
	margin-top: 1rem;
}

#communication_email_size_progress {
	height: 1rem;
}

#communication_email_size_progress .ui-progressbar-value {
	background: #1a7f3f;
}

#communication_email_size_progress.communication-size-warning .ui-progressbar-value {
	background: #ffae00;
}

#communication_email_size_progress.communication-size-danger .ui-progressbar-value {
	background: #cc4b37;
}

#communication_email_size_warning {
	margin-top: 0.75rem;
}

.communication-inline-image-selected {
	outline: 2px solid #1779ba;
	outline-offset: 2px;
}

.communication-image-resize-handle {
	display: inline-block;
	margin: 0 0.2rem;
	padding: 0.1rem 0.3rem;
	border: 1px solid #1779ba;
	border-radius: 3px;
	color: #1779ba;
	cursor: ew-resize;
	user-select: none;
	touch-action: none;
}

.communication-editor-body img {
	height: auto;
	max-width: 100%;
}

.communication-image-actions {
	margin-top: 0.5rem;
}

.communication-retention-notice {
	margin: 0.5rem 0 1rem;
}

/* Nom et prénom du locataire : clic = cocher / décocher la location (label relié à la case) */
.communication-recipients label.communication-tenant-name {
	display: inline;
	margin: 0;
	font-size: inherit;
	color: inherit;
	cursor: pointer;
}

.communication-recipients label.communication-tenant-name:hover {
	text-decoration: underline;
}

/* Tableaux « En cours ou programmées » et « Envoyées » : Détails (loupe) et Aperçu (jumelles) côte à côte, libellé sous l'icône ;
   la ligne Détails / Aperçu est insérée sous la communication par js/communication.js */
.communication-panel-links {
	display: flex;
	flex-wrap: nowrap;
	gap: 0.35rem;
}

/* Colonne Dates, identique dans les deux tableaux : une information par ligne, police réduite */
.communication-dates {
	font-size: 0.8rem;
	line-height: 1.35;
	white-space: nowrap;
}

/* Envoi programmé (ancien) : pas de cron, l'envoi part seulement par « Envoyer maintenant » */
.communication-manual-send {
	color: #cc4b37;
	font-size: 0.85rem;
}

.communication-panel-row > td {
	background: #f7f7f7;
	border-top: 1px dashed #cacaca;
}
