/* ==========================================================================
   WP Social Publisher — Front-end Widget Styles
   ========================================================================== */

/* Container
   ========================================================================== */
.sp-widget {
	max-width: 560px;
	margin: 1.5rem 0;
	padding: 1.25rem;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 0.95rem;
	color: #1c1c1e;
	box-sizing: border-box;
}

/* Image preview
   ========================================================================== */
.sp-image-preview {
	margin-bottom: 1rem;
	border-radius: 6px;
	overflow: hidden;
	background: #f5f5f7;
}

.sp-image-preview img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
}

/* Connect section
   ========================================================================== */
.sp-connect-section {
	text-align: center;
	padding: 0.5rem 0 0.25rem;
}

.sp-connect-label {
	margin: 0 0 0.75rem;
	color: #555;
	font-size: 0.9rem;
}

.sp-connect-buttons {
	display: flex;
	gap: 0.625rem;
	justify-content: center;
	flex-wrap: wrap;
}

/* Buttons — base
   ========================================================================== */
.sp-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.55rem 1.1rem;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1;
	color: #fff;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: opacity 0.15s ease, transform 0.1s ease;
	white-space: nowrap;
}

.sp-btn:hover:not(:disabled) {
	opacity: 0.88;
}

.sp-btn:active:not(:disabled) {
	transform: scale(0.97);
}

.sp-btn:disabled,
.sp-btn.sp-loading {
	opacity: 0.55;
	cursor: not-allowed;
}

/* Loading spinner via pseudo-element */
.sp-btn.sp-loading::after {
	content: "";
	display: inline-block;
	width: 0.75em;
	height: 0.75em;
	margin-left: 0.4em;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: sp-spin 0.6s linear infinite;
}

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

/* Buttons — Facebook */
.sp-btn-facebook {
	background-color: #1877f2;
}

.sp-btn-facebook:hover:not(:disabled) {
	background-color: #166fe5;
	opacity: 1;
}

/* Buttons — Instagram */
.sp-btn-instagram {
	background: linear-gradient(135deg, #f58529 0%, #e1306c 50%, #833ab4 100%);
}

/* Action buttons row */
.sp-action-buttons {
	display: flex;
	gap: 0.625rem;
	flex-wrap: wrap;
	margin-top: 0.875rem;
}

/* Caption
   ========================================================================== */
.sp-caption-label {
	display: block;
	font-size: 0.85rem;
	font-weight: 600;
	color: #555;
	margin-bottom: 0.3rem;
}

.sp-caption {
	width: 100%;
	padding: 0.55rem 0.7rem;
	font-size: 0.9rem;
	line-height: 1.45;
	color: #1c1c1e;
	background: #fafafa;
	border: 1px solid #ccc;
	border-radius: 5px;
	resize: vertical;
	box-sizing: border-box;
	transition: border-color 0.15s;
}

.sp-caption:focus {
	outline: none;
	border-color: #1877f2;
	background: #fff;
}

.sp-caption-wrap {
	margin-bottom: 0.5rem;
}

.sp-caption-locked {
	margin: 0 0 0.875rem;
	color: #444;
	font-style: italic;
}

/* Character count
   ========================================================================== */
.sp-char-count {
	text-align: right;
	font-size: 0.78rem;
	color: #888;
	margin-top: 0.2rem;
	user-select: none;
}

.sp-char-count.sp-over-limit .sp-char-current {
	color: #d93025;
	font-weight: 700;
}

/* Account selectors (populated in Phase 4)
   ========================================================================== */
.sp-account-selectors select {
	width: 100%;
	padding: 0.45rem 0.65rem;
	font-size: 0.9rem;
	border: 1px solid #ccc;
	border-radius: 5px;
	background: #fafafa;
	margin-bottom: 0.625rem;
	box-sizing: border-box;
}

/* Status messages
   ========================================================================== */
.sp-message {
	margin-top: 0.75rem;
	padding: 0.55rem 0.8rem;
	border-radius: 5px;
	font-size: 0.9rem;
	line-height: 1.4;
	display: none;
}

.sp-message:not(:empty) {
	display: block;
}

.sp-message.sp-success {
	background: #e6f4ea;
	color: #1e7e34;
	border: 1px solid #b7dfc0;
}

.sp-message.sp-error {
	background: #fce8e6;
	color: #c5221f;
	border: 1px solid #f5c6c3;
}
