/**
 * Moduuli: 11-components.css
 * Description: Käyttöliittymäkomponentit (Haku, Lightbox, Ilmoitukset, Modaaleja).
 * Version: 1.0
 */

/* --- HAKUNÄKYMÄ (SEARCH OVERLAY) --- */
.search-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(255, 255, 255, 0.95);
	z-index: 2000;
	display: none;
	opacity: 0;
	transition: opacity 0.3s ease-in-out;
	overflow-y: auto;
}
.search-overlay.is-active {
	display: block;
	opacity: 1;
}
.search-overlay-content {
	max-width: 800px;
	margin: 5vh auto;
	padding: 2rem;
}
.close-search-btn {
	position: absolute;
	top: 1.5rem;
	right: 1.5rem;
	font-size: 2.5rem;
	color: #999;
	background: none;
	border: none;
	cursor: pointer;
}
.kalajokinen-search-input {
	width: 100%;
	padding: 1rem;
	font-size: 1.5rem;
	border: none;
	border-bottom: 2px solid #ccc;
	background-color: transparent;
}
.kalajokinen-search-input:focus {
	outline: none;
	border-bottom-color: #024f91;
}
.search-filters-container {
	display: flex;
	gap: 1rem;
	margin-top: 1.5rem;
	margin-bottom: 1.5rem;
	flex-wrap: wrap;
}
.search-filter-select {
	flex: 1;
	min-width: 180px;
	padding: 0.75rem 1rem;
	font-size: 0.9rem;
	font-weight: 600;
	color: #4c4c4c;
	background-color: #f1f1f1;
	border: 2px solid #ddd;
	border-radius: 5px;
	-webkit-appearance: none;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c6c6c' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 1rem center;
	background-size: 1em;
	cursor: pointer;
}
.search-results-container {
	margin-top: 2rem;
}
.search-results-group {
	margin-bottom: 2rem;
}
.search-results-group h3 {
	border-bottom: 1px solid #eee;
	padding-bottom: 0.5rem;
	margin-bottom: 1rem;
}
.search-result-item {
	display: block;
	padding: 1rem;
	border-radius: 5px;
	transition: background-color 0.2s ease;
}
.search-result-item:hover {
	background-color: #f1f1f1;
}
.search-result-item .result-title {
	font-weight: 700;
	color: #024f91;
}
.search-result-item .result-excerpt {
	font-size: 0.9rem;
	color: #6c6c6c;
	margin-top: 0.5rem;
}
.search-loader {
	width: 40px;
	height: 40px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid #024f91;
	border-radius: 50%;
	animation: spin 1s linear infinite;
	margin: 2rem auto;
}
@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}
.no-results {
	text-align: center;
	color: #999;
	font-style: italic;
	margin-top: 2rem;
}
.search-ad-slot {
	margin-top: 2rem;
	text-align: center;
}
.search-results-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1rem;
}
.search-result-item-post {
	position: relative;
	padding: 0;
	overflow: hidden;
	border-radius: 5px;
}
.search-result-item-post .result-image {
	width: 100%;
	height: 150px;
	object-fit: cover;
	display: block;
}
.search-result-item-post .result-title-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
	padding: 2rem 1rem 1rem 1rem;
	box-sizing: border-box;
}
.search-result-item-post .result-title {
	color: #fff;
	font-size: 0.9rem;
}
.save-search-container {
	margin-top: 1.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid #eee;
}
#save-search-button {
	background-color: #024f91;
	color: #ffffff;
	border: none;
	padding: 0.5rem 1rem;
	font-size: 0.9rem;
	font-weight: 700;
	cursor: pointer;
}
.save-search-status {
	font-size: 0.9rem;
	font-style: italic;
	margin-top: 0.5rem;
}

/* --- KUUNTELE-OMINAISUUDEN PONNAHDUSIKKUNA (LISTEN MODAL) --- */
body.listen-modal-is-open {
	overflow: hidden;
}
.listen-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.7);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2000;
}
.listen-modal-content {
	background-color: #fff;
	padding: 2rem;
	border-radius: 8px;
	box-shadow: 0 5px 20px rgba(0,0,0,0.3);
	position: relative;
	width: 90%;
	max-width: 500px;
}
.listen-modal-title {
	margin: 0 0 1.5rem 0;
	font-size: 1.5rem;
	color: #024f91;
}
.listen-section {
	padding: 1rem 0;
	border-bottom: 1px solid #eee;
}
.listen-section:last-of-type {
	border-bottom: none;
	padding-bottom: 0;
}
.listen-section h3 {
	margin: 0 0 1rem 0;
	font-size: 1.1rem;
}
.listen-controls {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1rem;
}
.listen-select {
	flex-grow: 1;
	padding: 0.5rem;
	border: 1px solid #ddd;
	border-radius: 4px;
}
#volume-control {
	width: 100%;
}
.listen-play-btn {
	background-color: #024f91;
	color: #fff;
	border: none;
	padding: 0.75rem 1.5rem;
	border-radius: 5px;
	cursor: pointer;
	font-weight: 700;
	transition: background-color 0.2s ease;
}
.listen-play-btn:hover {
	background-color: #225a82;
}
.listen-play-btn.is-playing {
	background-color: #d9534f;
}

/* --- LIGHTBOX --- */
body.lightbox-open {
	overflow: hidden;
}
#kalajokinen-lightbox {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.85);
	z-index: 3000;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	box-sizing: border-box;
}
.lightbox-content {
	position: relative;
	max-width: 90vw;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	align-items: center;
}
.lightbox-content img {
	max-width: 100%;
	max-height: calc(90vh - 80px);
	height: auto;
	display: block;
	box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.lightbox-close, .lightbox-prev, .lightbox-next {
	position: absolute;
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	font-size: 2.5rem;
	z-index: 10;
	text-shadow: 0 0 10px rgba(0,0,0,0.5);
}
.lightbox-close {
	top: 1rem;
	right: 1rem;
}
.lightbox-prev, .lightbox-next {
	top: 50%;
	transform: translateY(-50%);
}
.lightbox-prev {
	left: 1rem;
}
.lightbox-next {
	right: 1rem;
}
.lightbox-counter {
    position: absolute;
    top: 1rem;
    left: 1rem;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.9rem;
    z-index: 10;
}

/* --- ILMOITUSJÄRJESTELMÄ (NOTIFICATIONS) --- */
#kalajokinen-notification-container {
	position: fixed;
	top: 1rem;
	right: 1rem;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	align-items: flex-end;
}
body.admin-bar #kalajokinen-notification-container {
	top: calc(var(--wp-admin--admin-bar--height) + 1rem);
}
.kalajokinen-notification {
	background-color: #28a745;
	color: #fff;
	padding: 1rem 1.5rem;
	border-radius: 5px;
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
	font-weight: 700;
	animation: slideIn 0.3s ease-out forwards, fadeOut 0.5s ease-in 4.5s forwards;
}
.kalajokinen-notification.is-error {
	background-color: #dc3545;
}
@keyframes slideIn {
	from { opacity: 0; transform: translateX(100%); }
	to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
	from { opacity: 1; }
	to { opacity: 0; }
}

/* --- LUKEMISEN EDISTYMISPALKKI --- */
#reading-progress-bar {
	position: fixed;
	top: 0;
	left: 0;
	height: 4px;
	background-color: #024f91;
	width: 0%;
	z-index: 1001;
	transition: width 0.1s linear;
}
