/**
 * Social Boost Form & Output Styles
 * 
 * @package Kliken_AI
 * @since 1.0.0
 */

/* ============================================
   Hero Form
   ============================================ */

.hero__form {
	max-width: 600px;
	margin: 0 auto;
}

.hero__form .form-group {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 12px;
}

@media (min-width: 768px) {
	.hero__form .form-group {
		flex-direction: row;
		gap: 16px;
	}
}

.hero__form input[type="text"] {
	flex: 1;
	padding: 16px 20px;
	border: 2px solid #e5e5e5;
	border-radius: 8px;
	font-size: 16px;
	font-family: 'Lato', sans-serif;
	transition: border-color 0.2s ease;
	background: #fff;
}

.hero__form input[type="text"]:focus {
	outline: none;
	border-color: #F58220;
	box-shadow: 0 0 0 3px rgba(245, 130, 32, 0.1);
}

.hero__form input[type="text"]::placeholder {
	color: #999;
}

.hero__form .error-message {
	display: block;
	color: #dc3545;
	font-size: 14px;
	margin-top: 8px;
	font-weight: 600;
}

/* Loading state for URL validation */
.hero__form .error-message--loading {
	color: var(--color-text-secondary);
}

.hero__form .error-message--loading::before {
	content: '';
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-right: 6px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: spin 0.6s linear infinite;
}

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

.hero__form button {
	white-space: nowrap;
	min-width: 200px;
}

@media (max-width: 767px) {
	.hero__form button {
		width: 100%;
	}
}

/* Loading state */
.hero__form button.loading {
	pointer-events: none;
	opacity: 0.7;
	position: relative;
}

.hero__form button.loading::before {
	content: "⟳ ";
	display: inline-block;
	animation: spin 1s linear infinite;
	margin-right: 8px;
}

@keyframes spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

/* ============================================
   Progress Container (Output Page)
   ============================================ */

.progress-container {
	max-width: 700px;
	margin: 60px auto;
	padding: 50px 60px;
	background: #ffffff;
	border: 1px solid #e0e0e0;
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
	text-align: center;
}

@media (max-width: 767px) {
	.progress-container {
		padding: 40px 30px;
		margin: 40px 20px;
	}
}

/* Step Counter */
.progress-step {
	font-size: 18px;
	font-weight: 700;
	color: #F58220;
	font-family: 'Raleway', sans-serif;
	text-transform: uppercase;
	letter-spacing: 1px;
	margin-bottom: 30px;
}

/* Status Message (Real API Message) */
.progress-message {
	font-size: 24px;
	font-weight: 400;
	color: #333;
	font-family: 'Lato', sans-serif;
	margin-bottom: 20px;
	line-height: 1.5;
	min-height: 72px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.3s ease;
}

@media (max-width: 767px) {
	.progress-message {
		font-size: 18px;
		min-height: 54px;
	}
}

/* Submessage (contextual help text) */
.progress-submessage {
	font-size: 16px;
	font-weight: 400;
	color: #666;
	font-family: 'Lato', sans-serif;
	line-height: 1.6;
	margin-bottom: 30px;
	max-width: 540px;
	margin-left: auto;
	margin-right: auto;
	display: none;
	transition: opacity 0.3s ease;
}

@media (max-width: 767px) {
	.progress-submessage {
		font-size: 15px;
	}
}

/* Time Remaining */
.progress-time {
	font-size: 15px;
	color: #666;
	font-family: 'Lato', sans-serif;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-bottom: 40px;
}

.time-icon {
	font-size: 16px;
}

.time-text {
	font-weight: 500;
}

/* Progress Bar (at bottom) */
.progress-bar-wrapper {
	margin-top: 20px;
}

/**
 * Modal-specific progress bar width
 * 
 * Sets wrapper to 75% of modal content width (~312px of 416px available).
 * Without explicit width, wrapper collapses to content size, causing percentage-based
 * fill width to fail. Preview page uses different layout, doesn't need this fix.
 * 
 * @see docs/investigations/2025-12-11_progress_bar_width_fix.md
 */
.modal .progress-bar-wrapper {
	width: 75%;
	margin-left: auto;
	margin-right: auto;
}

.progress-bar {
	width: 100%;
	height: 24px;
	background: #f0f0f0;
	border-radius: 12px;
	overflow: visible;
	position: relative;
	box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
	height: 100%;
	background: linear-gradient(90deg, #F58220 0%, #FF9149 100%);
	transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
	border-radius: 12px;
	position: relative;
	box-shadow: 0 2px 8px rgba(245, 130, 32, 0.3);
	display: flex;
	align-items: center;
	justify-content: flex-end;
	padding-right: 16px;
	min-width: 50px;
	overflow: hidden;
}

/**
 * Modal-specific: remove min-width constraint so percentage-based width works
 * 
 * Default min-width of 50px ensures text visibility on preview page, but in edit modal
 * it prevents JavaScript width: X% from working correctly when X% < 50px. Setting to 0
 * allows bar to show actual percentage (e.g., 20% of 312px = 62px, enough for "20%" text).
 * 
 * @see docs/investigations/2025-12-11_progress_bar_width_fix.md
 */
.modal .progress-bar-fill {
	min-width: 0;
}

/* Animated shimmer overlay to show activity */
.progress-bar-fill::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	right: 0;
	background-image: linear-gradient(
		45deg,
		rgba(255, 255, 255, 0.5) 25%,
		transparent 25%,
		transparent 50%,
		rgba(255, 255, 255, 0.5) 50%,
		rgba(255, 255, 255, 0.5) 75%,
		transparent 75%,
		transparent
	);
	background-size: 50px 50px;
	animation: progressShimmer 2s linear infinite;
	z-index: 1;
}

@keyframes progressShimmer {
	0% {
		background-position: 0 0;
	}
	100% {
		background-position: 50px 50px;
	}
}

.progress-percent {
	font-size: 13px;
	font-weight: 700;
	color: #ffffff;
	font-family: 'Lato', sans-serif;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
	position: relative;
	z-index: 2;
}

/* ============================================
   Posts Output Section
   ============================================ */

.posts-output {
	max-width: 1200px;
	margin: 40px auto;
	padding: 40px 20px;
}

.posts-output h2 {
	text-align: center;
	margin-bottom: 40px;
	color: #333;
	font-size: 32px;
	font-family: 'Raleway', sans-serif;
	font-weight: 700;
}

.post-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 24px;
}

@media (min-width: 768px) {
	.post-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 32px;
	}
}

.post-card {
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	padding: 24px;
	transition: box-shadow 0.2s ease;
}

.post-card:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.post-card img {
	width: 100%;
	height: auto;
	border-radius: 4px;
	margin-bottom: 16px;
}

.post-card h3 {
	font-size: 20px;
	margin-bottom: 12px;
	color: #333;
	font-family: 'Raleway', sans-serif;
	font-weight: 700;
}

.post-card .caption {
	color: #666;
	line-height: 1.6;
	margin-bottom: 12px;
	font-size: 15px;
}

.post-card .hashtags {
	color: #F58220;
	font-size: 14px;
	margin-bottom: 16px;
	font-weight: 600;
}

.post-card .landing-link {
	color: #F58220;
	text-decoration: none;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	font-size: 14px;
}

.post-card .landing-link:hover {
	text-decoration: underline;
}

/* ============================================
   Raw JSON Section
   ============================================ */

.raw-json-section {
	max-width: 1200px;
	margin: 40px auto;
	padding: 0 20px;
}

.raw-json-section summary {
	cursor: pointer;
	font-weight: 600;
	color: #666;
	padding: 16px;
	background: #f8f9fa;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	font-family: 'Lato', sans-serif;
	transition: background 0.2s ease;
}

.raw-json-section summary:hover {
	background: #e9ecef;
}

.raw-json-section pre {
	margin-top: 16px;
	padding: 20px;
	background: #282c34;
	color: #abb2bf;
	border-radius: 8px;
	overflow-x: auto;
	font-size: 14px;
	line-height: 1.5;
	font-family: 'Courier New', monospace;
}

/* ============================================
   Loading State (Output Page)
   ============================================ */

.loading-spinner {
	text-align: center;
	padding: 60px 20px;
}

.loading-spinner .spinner {
	display: inline-block;
	width: 50px;
	height: 50px;
	border: 4px solid #e5e5e5;
	border-top-color: #F58220;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

.loading-spinner p {
	margin-top: 20px;
	color: #666;
	font-size: 16px;
}

/* ============================================
   Error State (Output Page)
   ============================================ */

.error-state {
	max-width: 600px;
	margin: 60px auto;
	padding: 40px 20px;
	text-align: center;
}

.error-state h2 {
	color: #dc3545;
	font-size: 24px;
	margin-bottom: 16px;
	font-family: 'Raleway', sans-serif;
	font-weight: 700;
}

.error-state p {
	color: #666;
	line-height: 1.6;
	margin-bottom: 24px;
}

.error-state .btn {
	display: inline-block;
}
