/* ==========================================================================
   Mastodon Livefeed — Frontend styles
   ========================================================================== */

/* Feed wrapper */
.mastodon-feed {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

/* -----------------------------------------------------------------------
   Toot Card
   ----------------------------------------------------------------------- */

.mf-toot {
	padding: 1.25rem;
	border: 1px solid #e1e4e8;
	border-radius: 8px;
	background: #fff;
}

/* -----------------------------------------------------------------------
   Content
   ----------------------------------------------------------------------- */

.mf-content {
	font-size: 1rem;
	line-height: 1.6;
	color: #24292e;
}

.mf-content p {
	margin: 0 0 0.75em;
}

.mf-content p:last-child {
	margin-bottom: 0;
}

.mf-content a {
	color: #0366d6;
	word-break: break-word;
}

/* -----------------------------------------------------------------------
   Media wrapper
   ----------------------------------------------------------------------- */

.mf-media {
	margin-top: 0.75rem;
}

/* -----------------------------------------------------------------------
   Image Grid
   1 image  → full width
   2 images → 2 columns
   3 images → 3 columns
   4 images → 2×2 grid
   ----------------------------------------------------------------------- */

.mf-image-grid {
	display: grid;
	gap: 4px;
	border-radius: 8px;
	overflow: hidden;
}

.mf-grid-1 {
	grid-template-columns: 1fr;
}

.mf-grid-2 {
	grid-template-columns: repeat(2, 1fr);
}

.mf-grid-3 {
	grid-template-columns: repeat(3, 1fr);
}

.mf-grid-4 {
	grid-template-columns: repeat(2, 1fr);
}

/* Image link / image */

.mf-image-link {
	display: block;
	overflow: hidden;
	aspect-ratio: 16 / 9;
	background: #f6f8fa;
}

.mf-image-link img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.2s ease;
}

.mf-image-link:hover img {
	transform: scale(1.03);
}

/* -----------------------------------------------------------------------
   Video
   ----------------------------------------------------------------------- */

.mf-video {
	border-radius: 8px;
	overflow: hidden;
	margin-bottom: 4px;
}

.mf-video video {
	width: 100%;
	display: block;
	max-height: 420px;
	background: #000;
}

/* -----------------------------------------------------------------------
   Date
   ----------------------------------------------------------------------- */

.mf-date {
	display: block;
	margin-top: 0.75rem;
	font-size: 0.8rem;
	color: #6a737d;
}

/* -----------------------------------------------------------------------
   States
   ----------------------------------------------------------------------- */

.mastodon-feed-error,
.mastodon-feed-empty {
	color: #6a737d;
	font-style: italic;
}

/* -----------------------------------------------------------------------
   Load More (Feature 2)
   ----------------------------------------------------------------------- */

.mf-load-more-wrap {
	text-align: center;
	margin-top: 1rem;
}

.mf-load-more-btn {
	display: inline-block;
	padding: 0.6rem 1.5rem;
	background: #0366d6;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 0.95rem;
	cursor: pointer;
	transition: background 0.2s ease, opacity 0.2s ease;
}

.mf-load-more-btn:hover {
	background: #0257b3;
}

.mf-load-more-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* -----------------------------------------------------------------------
   New Updates Bubble (Feature 3)
   ----------------------------------------------------------------------- */

.mf-new-bubble {
	position: sticky;
	top: calc(var(--wp-admin--admin-bar--height, 0px) + 1rem);
	align-self: center;
	z-index: 9999;
	padding: 0.5rem 1.25rem;
	background: #2da44e;
	color: #fff;
	border-radius: 20px;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
	white-space: nowrap;
	margin-bottom: 0.5rem;
	animation: mf-bubble-in 0.25s ease;
}

@keyframes mf-bubble-in {
	from { opacity: 0; transform: translateY(-8px); }
	to   { opacity: 1; transform: translateY(0); }
}

.mf-new-bubble:hover {
	opacity: 0.85;
}

/* -----------------------------------------------------------------------
   Admin Inline Controls (Feature 4)
   ----------------------------------------------------------------------- */

.mf-admin-controls {
	display: flex;
	gap: 0.75rem;
	margin-top: 0.5rem;
}

.mf-edit-btn,
.mf-delete-btn {
	font-size: 0.72rem;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
	opacity: 0.45;
	transition: opacity 0.15s ease;
}

.mf-edit-btn {
	color: inherit;
}

.mf-delete-btn {
	color: #cb2431;
}

.mf-edit-btn:hover,
.mf-delete-btn:hover {
	opacity: 1;
}

.mf-delete-btn:hover {
	color: #cb2431;
}

.mf-edit-modal {
	margin-top: 0.75rem;
	padding: 0.75rem;
	border: 1px solid #d1d5da;
	border-radius: 6px;
	background: #f6f8fa;
}

.mf-edit-textarea {
	width: 100%;
	min-height: 100px;
	padding: 0.5rem;
	font-size: 0.9rem;
	font-family: inherit;
	border: 1px solid #d1d5da;
	border-radius: 4px;
	resize: vertical;
	box-sizing: border-box;
}

.mf-edit-modal-actions {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.5rem;
}

.mf-save-btn {
	padding: 0.35rem 0.9rem;
	background: #2da44e;
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.875rem;
	transition: background 0.15s ease;
}

.mf-save-btn:hover {
	background: #218838;
}

.mf-cancel-btn {
	padding: 0.35rem 0.9rem;
	background: #e1e4e8;
	color: #24292e;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.875rem;
	transition: background 0.15s ease;
}

.mf-cancel-btn:hover {
	background: #d1d5da;
}

/* -----------------------------------------------------------------------
   Compact Mode (mode="compact")
   ----------------------------------------------------------------------- */

.mf-compact-wrap {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.mastodon-feed.mf-compact {
	max-height: var(--mf-compact-height, 400px);
	overflow-y: auto;
	border: 1px solid #e1e4e8;
	border-radius: 8px;
	padding: 0.75rem;
	background: #fff;
	gap: 0;
	scrollbar-width: thin;
	scrollbar-color: #d1d5da transparent;
}

.mastodon-feed.mf-compact::-webkit-scrollbar {
	width: 4px;
}

.mastodon-feed.mf-compact::-webkit-scrollbar-thumb {
	background: #d1d5da;
	border-radius: 2px;
}

.mastodon-feed.mf-compact .mf-toot {
	display: flex;
	align-items: baseline;
	gap: 0.5rem;
	border: none;
	border-bottom: 1px solid #f0f0f0;
	border-radius: 0;
	padding: 0.4rem 0;
	background: transparent;
	min-width: 0;
}

.mastodon-feed.mf-compact .mf-toot:last-child {
	border-bottom: none;
}

.mf-compact-time {
	flex-shrink: 0;
	font-size: 0.72rem;
	color: #6a737d;
	font-variant-numeric: tabular-nums;
}

.mf-compact-text {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-size: 0.875rem;
	color: #24292e;
	min-width: 0;
}

.mf-compact-link {
	display: block;
	text-align: center;
	margin-top: 0.5rem;
	padding: 0.5rem 1rem;
	color: #0366d6;
	font-size: 0.875rem;
	text-decoration: none;
	border: 1px solid #e1e4e8;
	border-radius: 6px;
	transition: background 0.15s ease;
}

.mf-compact-link:hover {
	background: #f6f8fa;
	text-decoration: none;
}

/* -----------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------------- */

@media (max-width: 480px) {
	.mf-grid-3 {
		grid-template-columns: repeat(2, 1fr);
	}
}
