/**
 * Frontend Styles
 *
 * @package SBSM\AITranscription
 */

/* Search Container */
.sbsm-transcript-search {
	max-width: 800px;
	margin: 30px auto;
	padding: 0 15px;
}

/* Search Form */
.sbsm-search-form {
	margin-bottom: 30px;
}

.sbsm-search-input-wrapper {
	display: flex;
	gap: 10px;
	margin-bottom: 15px;
}

.sbsm-search-input {
	flex: 1;
	padding: 12px 15px;
	font-size: 16px;
	border: 2px solid #ddd;
	border-radius: 4px;
	transition: border-color 0.3s;
	background-color: #fff !important;
	color: #1a1a1a !important;
}

.sbsm-search-input:focus {
	outline: none;
	border-color: #0073aa;
	box-shadow: 0 0 0 1px #0073aa;
}

.sbsm-search-button {
	padding: 12px 24px;
	background: #0073aa;
	color: white;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 16px;
	font-weight: 500;
	transition: background 0.3s;
}

.sbsm-search-button:hover {
	background: #005a87;
}

.sbsm-search-button .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
}

/* Filters */
.sbsm-search-filters {
	padding: 15px;
	background: #f9f9f9;
	border: 1px solid #ddd;
	border-radius: 4px;
	margin-top: 15px;
}

.sbsm-search-filters label {
	display: block;
	margin-bottom: 10px;
}

.sbsm-search-filters select {
	padding: 5px 10px;
	border: 1px solid #ddd;
	border-radius: 3px;
}

.sbsm-toggle-filters {
	background: none;
	border: none;
	color: #0073aa;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 13px;
	padding: 5px 0;
	transition: color 0.3s;
}

.sbsm-toggle-filters:hover {
	color: #005a87;
	text-decoration: underline;
}

.sbsm-toggle-filters .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* Loading Indicator */
.sbsm-search-loading {
	text-align: center;
	padding: 40px 20px;
	color: #666;
}

.sbsm-search-loading .spinner {
	float: none;
	margin: 0 auto 10px;
}

/* Search Results */
.sbsm-search-results {
	margin-top: 30px;
}

.sbsm-search-result {
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 20px;
	margin-bottom: 15px;
	transition: box-shadow 0.3s, transform 0.2s;
}

.sbsm-search-result:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
}

.sbsm-result-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 15px;
	flex-wrap: wrap;
	gap: 10px;
}

.sbsm-result-header h3 {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
}

.sbsm-result-header h3 a {
	color: #0073aa;
	text-decoration: none;
	transition: color 0.3s;
}

.sbsm-result-header h3 a:hover {
	color: #005a87;
	text-decoration: underline;
}

.sbsm-result-timestamp {
	background: #0073aa;
	color: white;
	padding: 5px 12px;
	border-radius: 3px;
	font-weight: bold;
	font-size: 14px;
	white-space: nowrap;
}

.sbsm-result-content {
	margin: 15px 0;
	line-height: 1.7;
	color: #333;
}

.sbsm-result-content p {
	margin: 0;
}

/* Q&A Badge */
.sbsm-qa-badge {
	background: #d4edda;
	border: 1px solid #c3e6cb;
	padding: 12px;
	border-radius: 4px;
	margin-top: 15px;
}

.sbsm-qa-badge strong {
	color: #155724;
	display: block;
	margin-bottom: 8px;
}

.sbsm-qa-badge p {
	margin: 5px 0 0 0;
	color: #155724;
}

/* Result Actions */
.sbsm-result-actions {
	margin-top: 15px;
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
}

.sbsm-result-actions .button,
.sbsm-segment-actions .button {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 8px 16px;
	text-decoration: none;
	border-radius: 4px;
	transition: all 0.3s;
}

.sbsm-result-actions .button-primary,
.sbsm-segment-actions .button-primary {
	background: #0073aa;
	color: white;
	border: none;
}

.sbsm-result-actions .button-primary:hover,
.sbsm-segment-actions .button-primary:hover {
	background: #005a87;
}

.sbsm-result-actions .button .dashicons,
.sbsm-segment-actions .button .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

/* Load More */
.sbsm-load-more-wrapper {
	text-align: center;
	margin-top: 30px;
	padding: 20px 0;
}

.sbsm-load-more {
	padding: 12px 30px;
	font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
	.sbsm-search-input-wrapper {
		flex-direction: column;
	}

	.sbsm-search-button {
		width: 100%;
		justify-content: center;
	}

	.sbsm-result-header {
		flex-direction: column;
		align-items: flex-start;
	}

	.sbsm-result-actions,
	.sbsm-segment-actions {
		flex-direction: column;
		width: 100%;
	}

	.sbsm-result-actions .button,
	.sbsm-segment-actions .button {
		width: 100%;
		justify-content: center;
	}

	.sbsm-transcript-search {
		padding: 0 10px;
	}
}

@media (max-width: 480px) {
	.sbsm-search-input {
		font-size: 14px;
	}

	.sbsm-result-header h3 {
		font-size: 16px;
	}

	.sbsm-search-result {
		padding: 15px;
	}
}

/* =====================================================
   AI Q&A Interface Styles
   ===================================================== */

/* Question Textarea */
.sbsm-search-input.sbsm-ai-question {
	min-height: 80px;
	resize: vertical;
	font-family: inherit;
	line-height: 1.5;
}

/* AI Loading State */
.sbsm-ai-loading {
	text-align: center;
	padding: 60px 20px;
	background: #f9f9f9;
	border: 1px solid #ddd;
	border-radius: 8px;
	margin-top: 30px;
}

.sbsm-ai-loading.hidden {
	display: none;
}

.sbsm-ai-spinner {
	width: 40px;
	height: 40px;
	border: 3px solid #e0e0e0;
	border-top-color: #0073aa;
	border-radius: 50%;
	animation: sbsm-spin 0.8s linear infinite;
	margin: 0 auto 15px;
}

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

.sbsm-ai-loading p {
	color: #666;
	margin: 0;
	font-size: 15px;
}

.sbsm-ai-loading p:last-child {
	font-size: 13px;
	color: #999;
	margin-top: 8px;
}

/* AI Response Container */
.sbsm-ai-response {
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 8px;
	padding: 25px;
	margin-top: 30px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.sbsm-ai-response.hidden {
	display: none;
}

/* Crisis Response Styling */
.sbsm-ai-response.sbsm-crisis-response {
	background: #fff5f5;
	border-color: #feb2b2;
}

.sbsm-ai-response.sbsm-crisis-response .sbsm-ai-answer {
	border-left: 4px solid #e53e3e;
	padding-left: 20px;
}

/* AI Answer Section */
.sbsm-ai-answer {
	margin-bottom: 25px;
}

.sbsm-ai-answer h3 {
	margin: 0 0 15px 0;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #666;
}

.sbsm-ai-answer-content {
	font-size: 16px;
	line-height: 1.8;
	color: #333;
}

.sbsm-ai-answer-content p {
	margin: 0 0 15px 0;
}

.sbsm-ai-answer-content p:last-child {
	margin-bottom: 0;
}

/* Source Reference in Answer Text */
.sbsm-source-ref {
	background: #e8f4fc;
	color: #0073aa;
	padding: 2px 6px;
	border-radius: 3px;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}

/* Error Message */
.sbsm-error-message {
	color: #c53030;
	background: #fff5f5;
	border: 1px solid #feb2b2;
	padding: 15px;
	border-radius: 4px;
}

/* AI Sources Section */
.sbsm-ai-sources {
	border-top: 1px solid #eee;
	padding-top: 20px;
}

.sbsm-ai-sources.hidden {
	display: none;
}

.sbsm-ai-sources h4 {
	margin: 0 0 15px 0;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #666;
}

.sbsm-ai-sources-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.sbsm-source-item {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	padding: 12px;
	background: #f9f9f9;
	border-radius: 4px;
	margin-bottom: 8px;
	transition: background-color 0.2s;
}

.sbsm-source-item:last-child {
	margin-bottom: 0;
}

.sbsm-source-item:hover {
	background: #f0f0f0;
}

.sbsm-source-label {
	background: #0073aa;
	color: #fff;
	padding: 3px 8px;
	border-radius: 3px;
	font-size: 12px;
	font-weight: 600;
}

.sbsm-source-title {
	font-weight: 500;
	color: #333;
}

.sbsm-source-timestamp {
	color: #666;
	font-size: 14px;
}

.sbsm-source-play-btn {
	background: #0073aa;
	color: #fff;
	border: none;
	border-radius: 50%;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	margin-left: auto;
	transition: background-color 0.2s, transform 0.2s;
}

.sbsm-source-play-btn:hover {
	background: #005a87;
	transform: scale(1.1);
}

.sbsm-source-play-btn svg {
	width: 16px;
	height: 16px;
}

/* Keyword Cloud */
.sbsm-keyword-cloud {
	margin-bottom: 30px;
	text-align: center;
}

.sbsm-keyword-cloud.hidden {
	display: none;
}

.sbsm-keyword-cloud p {
	color: #666;
	font-size: 14px;
	margin-bottom: 12px;
}

.sbsm-keyword-cloud-items {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
}

.sbsm-keyword-cloud-item {
	background: #f0f0f0;
	border: 1px solid #ddd;
	color: #333;
	padding: 6px 14px;
	border-radius: 20px;
	font-size: 14px;
	cursor: pointer;
	transition: all 0.2s;
}

.sbsm-keyword-cloud-item:hover {
	background: #0073aa;
	border-color: #0073aa;
	color: #fff;
}

/* Player Modal */
.sbsm-player-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 100000;
}

.sbsm-modal-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.75);
}

.sbsm-modal-content {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #fff;
	border-radius: 8px;
	max-width: 90%;
	max-height: 90vh;
	width: 800px;
	overflow: hidden;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.sbsm-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 15px 20px;
	background: #f5f5f5;
	border-bottom: 1px solid #ddd;
}

.sbsm-player-title {
	font-weight: 600;
	font-size: 16px;
	margin: 0;
	color: #333;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	flex: 1;
	margin-right: 15px;
}

.sbsm-modal-close {
	background: none;
	border: none;
	font-size: 28px;
	color: #666;
	cursor: pointer;
	line-height: 1;
	padding: 0;
	transition: color 0.2s;
}

.sbsm-modal-close:hover {
	color: #333;
}

.sbsm-player-container {
	padding: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	background: #000;
}

.sbsm-player-container video,
.sbsm-player-container audio {
	max-width: 100%;
}

.sbsm-player-container audio {
	min-width: 300px;
}

/* Modal open state */
body.sbsm-modal-open {
	overflow: hidden;
}

/* =====================================================
   Responsive Adjustments for AI Q&A
   ===================================================== */

@media (max-width: 768px) {
	.sbsm-ai-response {
		padding: 20px 15px;
	}

	.sbsm-source-item {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
	}

	.sbsm-source-play-btn {
		margin-left: 0;
	}

	.sbsm-modal-content {
		width: 95%;
		max-height: 85vh;
	}

	.sbsm-player-title {
		font-size: 14px;
	}
}

@media (max-width: 480px) {
	.sbsm-ai-loading {
		padding: 40px 15px;
	}

	.sbsm-ai-answer-content {
		font-size: 15px;
		line-height: 1.7;
	}

	.sbsm-keyword-cloud-item {
		font-size: 13px;
		padding: 5px 12px;
	}
}

/* =====================================================
   Dark Mode Support
   ===================================================== */

@media (prefers-color-scheme: dark) {
	.sbsm-search-result {
		background: #1e1e1e;
		border-color: #444;
		color: #e0e0e0;
	}

	.sbsm-result-content {
		color: #e0e0e0;
	}

	.sbsm-result-header h3 a {
		color: #4a9eff;
	}

	.sbsm-search-input {
		background: #2a2a2a;
		color: #e0e0e0;
		border-color: #444;
	}

	.sbsm-search-filters {
		background: #2a2a2a;
		border-color: #444;
	}

	/* AI Q&A Dark Mode */
	.sbsm-ai-loading {
		background: #2a2a2a;
		border-color: #444;
	}

	.sbsm-ai-loading p {
		color: #999;
	}

	.sbsm-ai-response {
		background: #1e1e1e;
		border-color: #444;
	}

	.sbsm-ai-answer h3,
	.sbsm-ai-sources h4 {
		color: #999;
	}

	.sbsm-ai-answer-content {
		color: #e0e0e0;
	}

	.sbsm-source-ref {
		background: #2d4a5e;
		color: #4a9eff;
	}

	.sbsm-ai-sources {
		border-top-color: #444;
	}

	.sbsm-source-item {
		background: #2a2a2a;
	}

	.sbsm-source-item:hover {
		background: #333;
	}

	.sbsm-source-title {
		color: #e0e0e0;
	}

	.sbsm-source-timestamp {
		color: #999;
	}

	.sbsm-keyword-cloud p {
		color: #999;
	}

	.sbsm-keyword-cloud-item {
		background: #2a2a2a;
		border-color: #444;
		color: #e0e0e0;
	}

	.sbsm-modal-content {
		background: #1e1e1e;
	}

	.sbsm-modal-header {
		background: #2a2a2a;
		border-bottom-color: #444;
	}

	.sbsm-player-title {
		color: #e0e0e0;
	}

	.sbsm-modal-close {
		color: #999;
	}

	.sbsm-modal-close:hover {
		color: #fff;
	}

	/* Crisis response in dark mode */
	.sbsm-ai-response.sbsm-crisis-response {
		background: #2d1f1f;
		border-color: #6b3030;
	}

	.sbsm-error-message {
		background: #2d1f1f;
		border-color: #6b3030;
		color: #fc8181;
	}
}
