/* UnifiedSMB widget on the WordPress dashboard.
   Self-contained: main.css is not loaded on this screen. */
#unifiedsmb_dashboard_widget .inside {
	margin: 0;
	padding: 0;
}

.usmb-widget {
	--usmb-w-blue: #009FE3;
	--usmb-w-blue-dark: #025A7A;
	--usmb-w-blue-text: #0273A8;
	--usmb-w-blue-soft: #E6F5FC;
	--usmb-w-green: #1F9D57;
	--usmb-w-green-soft: #E6F6EC;
	--usmb-w-orange: #C26100;
	--usmb-w-red: #D63638;
	--usmb-w-red-soft: #FCEBEB;
	--usmb-w-ink: #1d2327;
	--usmb-w-muted: #646970;
	--usmb-w-line: #EDEFF2;

	color: var(--usmb-w-ink);
}

/* Header */
.usmb-widget-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	background: linear-gradient(120deg, var(--usmb-w-blue) 0%, var(--usmb-w-blue-dark) 100%);
}

.usmb-widget-logo {
	display: block;
	height: 22px;
	width: auto;
}

.usmb-widget-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .16);
	color: #fff;
	font-size: 12px;
	font-weight: 500;
	white-space: nowrap;
}

.usmb-widget-pill-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #6EE7A0;
}

.usmb-widget-pill-syncing .usmb-widget-pill-dot {
	background: #fff;
	animation: usmb-widget-pulse 1.2s ease-in-out infinite;
}

.usmb-widget-pill-error .usmb-widget-pill-dot {
	background: #FF8A8A;
}

.usmb-widget-pill-off .usmb-widget-pill-dot {
	background: rgba(255, 255, 255, .5);
}

@keyframes usmb-widget-pulse {
	50% { opacity: .3; }
}

/* Today + 7 day bars */
.usmb-widget-today {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 16px 16px;
	border-bottom: 1px solid var(--usmb-w-line);
}

.usmb-widget-today-numbers {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.usmb-widget-eyebrow {
	color: var(--usmb-w-muted);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.usmb-widget-big {
	margin-top: 2px;
	font-size: 36px;
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -.02em;
}

.usmb-widget-big-label {
	color: var(--usmb-w-muted);
	font-size: 13px;
}

.usmb-widget-spark {
	flex: 0 0 auto;
	margin: 0;
	text-align: right;
}

.usmb-widget-spark-bars {
	display: flex;
	align-items: flex-end;
	gap: 4px;
	height: 64px;
}

.usmb-widget-spark-col {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	width: 18px;
	height: 100%;
	cursor: default;
}

.usmb-widget-spark-bar {
	display: block;
	width: 12px;
	min-height: 2px;
	border-radius: 3px 3px 0 0;
	background: #9FD8F2;
	transition: background .15s ease;
}

.usmb-widget-spark-col.is-today .usmb-widget-spark-bar {
	background: #0284C7;
}

.usmb-widget-spark-col:hover .usmb-widget-spark-bar {
	background: var(--usmb-w-blue-dark);
}

.usmb-widget-spark-day {
	margin-top: 4px;
	color: var(--usmb-w-muted);
	font-size: 10px;
	line-height: 1;
}

.usmb-widget-spark figcaption {
	margin-top: 6px;
	color: var(--usmb-w-muted);
	font-size: 11px;
}

/* Status rows */
.usmb-widget-rows {
	margin: 0;
	padding: 4px 16px;
}

.usmb-widget-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 10px 0;
	border-bottom: 1px solid var(--usmb-w-line);
}

.usmb-widget-row:last-child {
	border-bottom: 0;
}

.usmb-widget-row-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 30px;
	width: 30px;
	height: 30px;
	border-radius: 8px;
}

.usmb-widget-row-icon .dashicons {
	font-size: 17px;
	width: 17px;
	height: 17px;
}

.usmb-widget-row-ok {
	background: var(--usmb-w-green-soft);
	color: var(--usmb-w-green);
}

.usmb-widget-row-error {
	background: var(--usmb-w-red-soft);
	color: var(--usmb-w-red);
}

.usmb-widget-row-syncing {
	background: var(--usmb-w-blue-soft);
	color: var(--usmb-w-blue-text);
}

/* Sync icon: an SVG instead of a dashicon, because the dashicon glyph is
   not centred in its box and wobbles while it spins. */
.usmb-widget-sync-svg {
	display: block;
	width: 14px;
	height: 14px;
	flex: 0 0 auto;
	transform-origin: 50% 50%;
}

.usmb-widget-row-syncing .usmb-widget-sync-svg,
#unifiedsmb_dashboard_widget .usmb-widget-primary:disabled .usmb-widget-sync-svg {
	animation: usmb-widget-spin 1.4s linear infinite;
}

@keyframes usmb-widget-spin {
	to { transform: rotate(360deg); }
}

.usmb-widget-row-text {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
	font-size: 13px;
	line-height: 1.4;
}

.usmb-widget-row-text strong {
	font-weight: 600;
}

.usmb-widget-row-text > span {
	color: var(--usmb-w-muted);
}

.usmb-widget-row-link {
	font-size: 12px;
	font-weight: 500;
	white-space: nowrap;
	text-decoration: none;
}

/* Feedback after "sync now" */
.usmb-widget-status {
	display: none;
	margin: 0 16px 12px;
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 13px;
}

.usmb-widget-status.show {
	display: block;
}

.usmb-widget-status.notice-success {
	background: var(--usmb-w-green-soft);
	color: #11643A;
}

.usmb-widget-status.notice-warning {
	background: #FFF4E5;
	color: #8A4500;
}

.usmb-widget-status.notice-error {
	background: var(--usmb-w-red-soft);
	color: #A12123;
}

/* Actions */
.usmb-widget-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	background: #F6F7F7;
	border-top: 1px solid var(--usmb-w-line);
}

#unifiedsmb_dashboard_widget .usmb-widget-primary {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: #0284C7;
	border-color: #0284C7;
	box-shadow: none;
	text-shadow: none;
}

#unifiedsmb_dashboard_widget .usmb-widget-primary:hover,
#unifiedsmb_dashboard_widget .usmb-widget-primary:focus {
	background: var(--usmb-w-blue-dark);
	border-color: var(--usmb-w-blue-dark);
}

/* Icon and label centred on one line, whatever line-height WordPress gives buttons. */
#unifiedsmb_dashboard_widget .usmb-widget-primary {
	height: 32px;
	min-height: 32px;
	padding: 0 14px;
	line-height: 1;
}

#unifiedsmb_dashboard_widget .usmb-widget-primary .usmb-widget-button-label {
	line-height: 1;
}

.usmb-widget-links {
	display: flex;
	gap: 14px;
	font-size: 13px;
}

.usmb-widget-links a {
	text-decoration: none;
}

/* Not connected */
.usmb-widget-connect {
	padding: 28px 24px 24px;
	text-align: center;
}

.usmb-widget-connect > .dashicons {
	font-size: 32px;
	width: 32px;
	height: 32px;
	color: #0284C7;
}

.usmb-widget-connect h3 {
	margin: 10px 0 6px;
	font-size: 16px;
}

.usmb-widget-connect p {
	margin: 0 auto 16px;
	max-width: 320px;
	color: var(--usmb-w-muted);
}

@media (max-width: 480px) {
	.usmb-widget-today {
		flex-direction: column;
		align-items: flex-start;
	}

	.usmb-widget-spark {
		text-align: left;
	}

	.usmb-widget-actions {
		flex-direction: column;
		align-items: stretch;
	}

	#unifiedsmb_dashboard_widget .usmb-widget-primary {
		justify-content: center;
	}

	.usmb-widget-links {
		justify-content: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.usmb-widget * {
		animation: none !important;
	}
}
