/**
 * Datei: /wp-content/plugins/mietp-core/inc/modules/messages/css/messages-dashboard.layout.css
 * Modul: Messages (Nachrichten)
 * Autor: MARKS MEDIA
 *
 * Zweck:
 * - Layout/Struktur fuer den Messenger im Benutzer-Dashboard
 * - Enthält nur Screen-/Container-/Listen-/Header-/Pills-Struktur
 * - Keine Message-Content-Details (Bubbles/Attachments/Upload-Grid)
 *
 * Refactor:
 * - Tokens statt Hex/rgba -> nutzt globale Tokens aus style.css
 * - Inputs/Felder: sichtbare Field-Flaechen im Light-Mode (field-*)
 * - Fokus: ueber focus-ring (kein Outline-Wildwuchs)
 * - Keine eigenen Button-Systeme: Tabs/Actions an Pill/Filter-Pattern angelehnt
 * - Compose bleibt in messages-dashboard.messages.css (keine ID-Kollisionen)
 */

/* ============================================================
   0) MIETP Messages – Modul Tokens (Alias auf globale Theme-Tokens)
   Hinweis: bewusst nicht mehr :root global, damit es nicht in andere Screens "leakt"
============================================================ */
#mp-messages{
	--mp-msg-bg: var(--block-bg);
	--mp-msg-border: var(--block-border);
	--mp-msg-text: var(--text-main);
	--mp-msg-muted: var(--text-muted);
	--mp-msg-surface: var(--bg-surface);
	--mp-msg-hover: var(--hover-bg);

	--mp-msg-primary: var(--brand-primary);
	--mp-msg-danger: var(--brand-secondary);

	/* optional, falls du spaeter ein globales Success-Token einfuehrst */
	--mp-msg-success: #2e8b57;
}

/* ============================================================
   1) CONTAINER-STRUKTUR
============================================================ */

#mp-messages{
	display:flex;
	gap:20px;
	min-height:500px;
	max-height:70vh;
	width:100%;
}

@media (max-width:720px){
	#mp-messages{
		flex-direction:column;
	}
}

/* ============================================================
   2) THREAD-LISTE (LINKS)
============================================================ */

.mp-messages-sidebar{
	flex:0 0 55%;
	max-width:550px;

	background:var(--surface-0);
	display:flex;
	flex-direction:column;
	overflow:hidden;

	border:1px solid var(--border-hairline);
	box-shadow:var(--shadow-xs);
	border-radius:var(--radius-lg);
}

@media (max-width:1024px){
	.mp-messages-sidebar{
		flex:0 0 380px;
		max-width:380px;
	}
}

@media (max-width:720px){
	.mp-messages-sidebar{
		flex:0 0 100%;
		max-width:100%;
	}
}

/* Suche: nutzt globale Field-Tokens (sichtbare Flaeche im Light-Mode) */
.mp-messages-sidebar input#mp-message-search{
	width:100%;
	min-height:var(--field-height);
	padding:var(--field-padding);
	font-size:14px;
	margin-top:10px;
	border:1px solid var(--field-border-soft);
	border-radius:var(--field-radius);

	background:var(--field-bg);
	color:var(--field-color);

	outline:none;

	transition:
		border-color 0.15s ease,
		box-shadow 0.15s ease,
		background 0.15s ease;
}

.mp-messages-sidebar input#mp-message-search::placeholder{
	color:var(--field-placeholder);
}

.mp-messages-sidebar input#mp-message-search:hover{
	border-color:var(--field-border-hover);
}

.mp-messages-sidebar input#mp-message-search:focus-visible{
	outline:none;
	border-color:var(--brand-primary);
	box-shadow:0 0 0 3px var(--focus-ring);
}

/* ============================================================
   THREAD-AKTIONSLEISTE
============================================================ */

.mp-thread-actions{
	display:flex;
	align-items:center;
	justify-content:space-between;
	gap:12px;

	margin:10px 0 12px;
	padding:0 10px 8px;

	border-bottom:1px solid var(--border-hairline);
}

.mp-thread-actions-left{
	display:flex;
	align-items:center;
}

.mp-thread-actions-right{
	display:flex;
	align-items:center;
	gap:8px;
	margin-right:5px;
}

@media (max-width:600px){
	.mp-thread-actions{
		flex-direction:column;
		align-items:stretch;
	}

	.mp-thread-actions-right{
		justify-content:flex-start;
	}
}

#mp-trash-auto-delete-hint{
	display:none;
	padding:6px 4px;
}

/* Threadliste */
#mp-thread-list{
	flex:1;
	overflow-y:auto;
	padding:6px 4px;
}

/* ============================================================
   THREAD-EINTRAG
============================================================ */

.mp-thread-item{
	display:flex;
	gap:10px;
	padding:8px 6px;

	cursor:pointer;

	border-bottom:1px solid var(--border-hairline);
	transition:background-color 0.15s ease;

	position:relative;
	max-width:100%;
	overflow:hidden;
}

.mp-thread-item:last-child{
	border-bottom:none;
}

.mp-thread-item:hover{
	background:var(--mp-msg-hover);
}

/* Tastaturfokus sichtbar */
.mp-thread-item:focus-visible{
	outline:none;
	box-shadow:0 0 0 3px var(--focus-ring);
	border-radius:8px;
}

/* Ungelesen */
.mp-thread-item.is-unread{
	background:color-mix(in srgb, var(--bg-surface) 70%, transparent);
}

.mp-thread-item.is-unread .mp-thread-title{
	font-weight:700;
	color:var(--text-main);
}

.mp-thread-item.is-unread .mp-thread-preview{
	color:var(--text-main);
}

/* ============================================================
   THREAD – BILD
============================================================ */

.mp-thread-thumb{
	flex:0 0 44px;
	height:44px;
	border-radius:var(--btn-radius);
	overflow:hidden;

	background:var(--bg-surface);
	border:1px solid var(--border-hairline);
}

.mp-thread-thumb img{
	width:100%;
	height:100%;
	object-fit:cover;
	display:block;
}

/* ============================================================
   THREAD – INHALT
============================================================ */

.mp-thread-body{
	flex:1;
	min-width:0;
	display:flex;
	flex-direction:column;
	gap:2px;
}

/* Kopf: Username | Zeit */
.mp-thread-meta-row{
	display:flex;
	align-items:center;
	justify-content:space-between;
	gap:10px;

	font-size:12px;
	color:var(--text-muted);
}

.mp-thread-user{
	font-size:13px;
	min-width:0;
	overflow:hidden;
	text-overflow:ellipsis;
	white-space:nowrap;
	color:var(--text-main);
}

.mp-thread-time{
	font-size:13px;
	margin-left:auto;
	white-space:nowrap;
	text-align:right;
	color:var(--text-muted);
}

/* Titel */
.mp-thread-title{
	font-size:15px;
	font-weight:600;
	color:var(--brand-primary);

	white-space:nowrap;
	overflow:hidden;
	text-overflow:ellipsis;
}

/* Vorschau */
.mp-thread-preview{
	font-size:13px;
	color:var(--text-muted);
	line-height:1.3;

	white-space:nowrap;
	overflow:hidden;
	text-overflow:ellipsis;
}

.mp-thread-listing-meta{
	display:flex;
	flex-direction:column;
	min-width:0;
}

/* Kontaktname */
.mp-thread-contact-name{
	font-size:12px;
	font-weight:600;
	color:var(--text-muted);
	line-height:1.2;

	white-space:nowrap;
	overflow:hidden;
	text-overflow:ellipsis;
}

/* ============================================================
   UNREAD BADGE
============================================================ */

.mp-thread-unread-badge{
	position:absolute;
	top:6px;
	right:6px;

	font-size:11px;
	padding:2px 6px;

	background:var(--brand-primary);
	color:var(--text-invert);
	border-radius:10px;
	font-weight:700;
}

/* ============================================================
   3) CHATBEREICH (RECHTS)
============================================================ */

.mp-messages-content{
	flex:1;
	display:flex;
	flex-direction:column;
	overflow:hidden;

	background:var(--surface-0);
	border:1px solid var(--border-hairline);
	border-radius:var(--radius-lg);
	box-shadow:var(--shadow-xs);
}

#mp-thread-view{
	flex:1;
	padding:15px;
	overflow-y:auto;

	border-bottom:1px solid var(--border-hairline);
	display:flex;
	flex-direction:column;
}

/* ============================================================
   6) SCROLLBAR
============================================================ */

#mp-thread-list::-webkit-scrollbar,
#mp-thread-view::-webkit-scrollbar{
	width:8px;
}

#mp-thread-list::-webkit-scrollbar-thumb,
#mp-thread-view::-webkit-scrollbar-thumb{
	background:color-mix(in srgb, var(--text-main) 18%, transparent);
	border-radius:4px;
}

#mp-thread-list::-webkit-scrollbar-thumb:hover,
#mp-thread-view::-webkit-scrollbar-thumb:hover{
	background:color-mix(in srgb, var(--text-main) 28%, transparent);
}

/* ============================================================
   7) MOBILE
============================================================ */

@media (max-width:720px){
	.mp-thread-thumb{
		flex:0 0 40px;
		height:40px;
	}
}

/* ============================================================
   9) Listing-Header
============================================================ */

.mp-thread-listing-header{
	display:flex;
	align-items:center;
	gap:10px;
	padding:10px 12px;

	border-bottom:1px solid var(--border-hairline);
	background:var(--surface-0);
}

.mp-thread-listing-thumb{
	flex:0 0 44px;
	height:44px;
	border-radius:var(--btn-radius);
	overflow:hidden;

	background:var(--bg-surface);
	border:1px solid var(--border-hairline);
}

.mp-thread-listing-thumb img{
	width:100%;
	height:100%;
	object-fit:cover;
	display:block;
}

.mp-thread-listing-title{
	font-size:14px;
	font-weight:600;
	color:var(--brand-primary);
	text-decoration:none;

	white-space:nowrap;
	overflow:hidden;
	text-overflow:ellipsis;
}

.mp-thread-listing-title:hover{
	text-decoration:underline;
}

.mp-thread-listing-meta{
	display:flex;
	flex-direction:column;
	min-width:0;
}
