/* Search card, status, indicators, CTA */

/* Search icon inside input */
.input-group.search-card {
	position: relative;
	overflow: visible;
}

.search-card .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.search-card .search-button-fulltext {
  border-top-left-radius: 0; 
  border-bottom-left-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

/* When input is focused, button hover should use primary-active */
.search-card:focus-within .search-button-fulltext:hover {
  background-color: rgb(var(--color-primary-active)) !important;
  border-color: rgb(var(--color-primary-active)) !important;
  color: rgb(var(--color-canvas)) !important;
}

.search-card .search-button-fulltext i{
  font-size: 20px;
  transition: font-size var(--dur) var(--easing), transform var(--dur) var(--easing);
  line-height: 1;
  display: block;
  /* optical centering for right-pointing triangle */
  transform: translateX(-1px);
}

.search-status {
  min-height: 28px;
  animation: fade-in var(--dur) var(--easing) both;
}

.search-indicators .status-chip {
  padding: 2px 8px;
  font-size: 12px;
}

.search-hints .badge {
  font-weight: 500;
}

/* Highlight CTA when NP=0 (to be toggled by future logic) */
.search-button-fulltext.is-emphasized {
  position: relative;
  border-color: rgb(var(--color-primary));
  color: rgb(var(--color-canvas));
  /* modern animated gradient */
  background-image: linear-gradient(90deg, rgb(var(--color-primary)) 0%, rgb(var(--color-primary-hover)) 50%, rgb(var(--color-primary)) 100%);
  background-size: 200% 100%;
  /* soft pulse + gradient shift */
  animation: gradient-shift 3.5s ease-in-out infinite, pulse-soft 1.4s var(--easing) infinite;
  box-shadow: 0 8px 24px rgba(var(--color-primary), .35), 0 0 0 1px rgba(var(--color-canvas), .18) inset;
}

/* glossy sheen sweep */
.search-button-fulltext.is-emphasized::before{
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(120deg, transparent 10%, rgba(var(--color-canvas), .33) 45%, transparent 55%);
  transform: translateX(-120%);
  animation: sheen 2.6s ease-in-out infinite;
  pointer-events: none;
}

.search-button-fulltext.is-emphasized i {
  transform-origin: 55% 55%;
  /* subtle duotone-like effect */
  color: transparent;
  background: linear-gradient(180deg, rgb(var(--color-canvas)) 0%, rgba(var(--color-primary-hover), 0.1) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 1px 2px rgba(var(--color-text), .18)) drop-shadow(0 0 4px rgba(var(--color-primary-hover), .25));
  font-size: 3em;
}

/* no hover growth requested */

@media (prefers-reduced-motion: reduce){
  .search-button-fulltext.is-emphasized,
  .search-button-fulltext.is-emphasized i { animation: none !important; }
  .search-button-fulltext.is-emphasized{ background-size: auto; }
}

/* Modern search card - no radius, clean borders */
.search-card.glass{
  border-radius: 0;
  box-shadow: none;
  background: rgb(var(--color-canvas));
  border: 0.6rem solid;
  border-image: linear-gradient(135deg, rgb(var(--color-primary)) 0%, rgb(var(--color-primary-active)) 50%, rgb(var(--color-primary)) 100%) 1;
}
.search-card.glass:focus-within{
  border-image: linear-gradient(135deg, rgb(var(--color-primary-active)) 0%, rgb(var(--color-primary-hover)) 50%, rgb(var(--color-primary-active)) 100%) 1;
  box-shadow: none;
}

.search-card.glass .form-control{ 
  border-color: transparent; 
  border-radius: 0;
}


/* [data-theme="dark"] .search-card.glass .form-control:active:not(:disabled),
[data-theme="dark"] .search-card.glass .form-control:focus {
    background-color: rgb(var(--input-bg-active, var(--input-bg)));
    border-color: rgb(var(--input-focus-border));
} */
.search-card.glass .btn{ 
  border-color: transparent; 
  border-radius: 0 !important;
}
.search-card.glass .rounded-start{
  border-radius: 0 !important;
  background-color: rgb(var(--grey-400));
}
.search-card.glass .form-control:focus{ 
  box-shadow: none; 
  border-color: transparent;
}
.search-card.glass .search-button-fulltext{ 
  border-left: 0;
  /* background: rgb(var(--grey-100)); */
}

/* Dark mode кнопка поиска - цвета уже в оттенке темной морской волны */

/* Full-text minimal result cards */
.fulltext-result-card { border-color: rgb(var(--grey-300)); }
.fulltext-result-card { display: flex; gap: 12px; }
.fulltext-result-card { position: relative; }
.fulltext-result-title h6 { color: rgb(var(--color-text)); font-weight: 700; font-size: 1.05rem; }
.fulltext-result-title:hover h6 { color: rgb(var(--color-primary)); text-decoration: underline; }
.fulltext-result-snippet { line-height: 1.5; padding-right:1em;}

/* Missing file styles */
.fulltext-result-missing {
  opacity: 0.6;
}

.fulltext-result-missing .fulltext-result-title h6,
.fulltext-result-missing h6 {
  color: rgb(var(--grey-400));
  text-decoration: line-through;
  cursor: not-allowed;
}

.fulltext-result-missing .fulltext-result-snippet {
  color: rgb(var(--grey-400));
}

.fulltext-missing-notice {
  display: flex;
  align-items: center;
  gap: 4px;
  color: rgb(var(--grey-500));
  font-style: italic;
}

.fulltext-missing-notice i {
  font-size: 0.875rem;
}

/* Search match highlighting in snippets */
/* Styles removed - backend HTML is used directly */

.fulltext-result-meta span {
	opacity: .9;
	font-size: 0.8em;
	align-content: center;

}

/* Medium screens (md): move tags to inline with meta, remove backgrounds, gray text */
@media (min-width: 768px) {
	/* Remove backgrounds from tags and badges in meta, make text gray-400 */
	.fulltext-result-meta .fulltext-tag,
	.fulltext-result-meta .fulltext-tag--language,
	.fulltext-result-meta .fulltext-tag--material,
	.fulltext-result-meta .fulltext-tag--format {
		background: transparent !important;
		padding: 0;
		color: rgb(var(--grey-400)) !important;
	}
	
	.fulltext-result-meta .fulltext-size-badge {
		background: transparent !important;
		padding: 0;
		color: rgb(var(--grey-400)) !important;
	}
}

/* Pagination loading animation */
.page-link.page-link--loading {
	position: relative;
	overflow: hidden;
	background: linear-gradient(90deg, 
		rgb(var(--color-primary)) 0%, 
		rgb(var(--color-primary-hover)) 25%, 
		rgb(var(--color-primary)) 50%, 
		rgb(var(--color-primary-hover)) 75%, 
		rgb(var(--color-primary)) 100%);
	background-size: 200% 100%;
	animation: pagination-loading 2s linear infinite;
	color: rgb(var(--color-canvas)) !important;
	pointer-events: none;
}

@keyframes pagination-loading {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

/* Pagination fixed width for all items */
.pagination {
	position: relative;
	z-index: 5; /* Above pull-to-load indicator */
	/* Mobile safe area: extra padding for iOS browser bars */
}

.pagination .page-item {
	min-width: 2.5rem;
}

.pagination .page-link {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	text-align: center;
	transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.pagination .page-link i {
	font-size: 1rem;
	line-height: 1;
}

/* Enhanced hover effect for pagination buttons */
.pagination .page-item:not(.disabled):not(.active) .page-link:hover {
	background-color: rgba(var(--color-primary), 0.2);
	color: rgb(var(--color-primary-hover));
	transform: scale(1.05);
}

.pagination .page-item.disabled .page-link {
	opacity: 0.4;
	cursor: not-allowed;
}

/* Pull-to-load indicator - standard pull-to-refresh pattern */
.pull-to-load-indicator {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 120px;
	overflow: hidden;
	opacity: 0;
	pointer-events: none; /* Never intercept clicks - pagination should be clickable */
	transform: translateY(100%);
	transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	z-index: 1; /* Behind pagination */
	--progress: 0;
}

.pull-to-load-indicator.pull-to-load-active {
	opacity: 1;
	transform: translateY(0);
	/* Keep pointer-events: none to not interfere with pagination clicks */
}

.pull-to-load-content {
	position: absolute;
	bottom: 30px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	z-index: 2; /* Still behind pagination (z-index: 5) */
	transition: bottom 0.3s ease;
}

.pull-to-load-indicator.pull-to-load-ready .pull-to-load-content {
	bottom: 35px;
}

/* Icon wrapper with Ultra spinner */
.pull-to-load-icon-wrapper {
	position: relative;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Mini Ultra spinner integrated with pull-to-load */
.pull-to-load-spinner-ultra.spinner-ultra-mini {
	position: absolute;
	top: 0;
	left: 0;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	--c1: rgb(var(--color-primary));
	--c2: rgb(var(--color-primary-hover));
	background:
		conic-gradient(from 0deg, var(--c1) 0 25%, transparent 25% 100%),
		conic-gradient(from 180deg, var(--c2) 0 25%, transparent 25% 100%);
	-webkit-mask: radial-gradient(farthest-side, #0000 58%, rgb(var(--color-text)) 59%);
	mask: radial-gradient(farthest-side, #0000 58%, rgb(var(--color-text)) 59%);
	animation: spin 4s linear infinite; /* Slowed down 10x (was 1.2s) */
	filter: drop-shadow(0 4px 12px rgba(var(--color-text), .12));
	opacity: 0;
	transition: opacity 0.2s ease, filter 0.2s ease;
	z-index: 1;
}

[data-theme="dark"] .pull-to-load-spinner-ultra.spinner-ultra-mini {
	--c1: rgb(var(--color-primary-hover));
	--c2: rgb(var(--color-primary-active-gr1));
	filter: drop-shadow(0 4px 12px rgba(var(--color-text), .3));
}

.pull-to-load-spinner-ultra.pull-to-load-spinner-ready {
	filter: drop-shadow(0 6px 16px rgba(var(--color-primary), .4));
}

.pull-to-load-icon {
	position: relative;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.5rem;
	color: rgb(var(--color-primary));
	transition: transform 0.2s ease, opacity 0.2s ease;
	transform: rotate(0deg);
	opacity: 0;
	z-index: 2; /* Above spinner */
}

.pull-to-load-indicator.pull-to-load-active .pull-to-load-icon {
	opacity: 1;
}

.pull-to-load-indicator.pull-to-load-ready .pull-to-load-icon {
	opacity: 0;
}

.pull-to-load-text {
	font-size: 0.875rem;
	color: rgb(var(--color-text-muted));
	text-align: center;
	white-space: nowrap;
	transition: color 0.3s ease, font-weight 0.3s ease, opacity 0.3s ease;
	opacity: 0;
}

.pull-to-load-indicator.pull-to-load-active .pull-to-load-text {
	opacity: 0.8;
}

.pull-to-load-indicator.pull-to-load-ready .pull-to-load-text {
	color: rgb(var(--color-primary));
	font-weight: 600;
	opacity: 1;
}

.pull-to-load-indicator.pull-to-load-loading .pull-to-load-text {
	color: rgb(var(--color-primary));
	font-weight: 600;
	opacity: 1;
}

@keyframes wave-flow {
	0% {
		transform: translateX(0);
	}
	100% {
		transform: translateX(-600px);
	}
}

/* Fulltext results morphing animation */
/* Adjustable morphing animation duration - change this value to adjust morphing speed */
#fulltext-results-container {
	/* Disable scroll anchoring to prevent automatic scroll when appending elements */
	overflow-anchor: none;
	--morph-animation-duration: 500ms;
	position: relative;
	/* padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); Space for pull indicator + iOS safe area */
}

/* Wrapper for morphing layers - provides positioning context */
#fulltext-results-container .morph-wrapper {
	position: relative;
}

/* Morphing layers - old and new content overlapped */
#fulltext-results-container .morph-layer {
	transition: opacity var(--morph-animation-duration) ease-in-out,
	            filter var(--morph-animation-duration) ease-in-out,
	            transform var(--morph-animation-duration) ease-in-out;
	opacity: 1;
	filter: blur(0px);
	transform: scale(1);
}

/* Old content layer - positioned normally, fading out with subtle blur */
#fulltext-results-container .morph-layer.morphing-out {
	opacity: 0;
	filter: blur(5px);
	transform: scale(0.99);
	pointer-events: none;
}

/* New content layer - absolutely positioned over old content, fading in with subtle effect */
#fulltext-results-container .morph-layer.morphing-in {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	opacity: 1;
	filter: blur(0px);
	transform: scale(1);
	z-index: 1;
}

/* Initial state for new content before morphing starts */
#fulltext-results-container .morph-layer.morphing-initial {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	opacity: 0;
	filter: blur(5px);
	transform: scale(0.99);
	z-index: 1;
}

/* Append mode: new content fading in (no absolute positioning, appends to end) */
#fulltext-results-container .morph-layer.morphing-initial-append {
	opacity: 0;
	filter: blur(5px);
	transform: scale(0.99);
}

#fulltext-results-container .morph-layer.morphing-in-append {
	opacity: 1;
	filter: blur(0px);
	transform: scale(1);
}

/* Fulltext loading spinner */
#nav-full-text {
	position: relative;
	/* min-height: 200px; */
}

/* Initial spinner (shown when list hasn't loaded yet) */
.fulltext-initial-spinner {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 300px;
	padding: 3rem 0;
	position: relative;
}

.fulltext-initial-spinner.d-none {
	display: none !important;
}

.fulltext-initial-spinner .spinner-ultra {
	opacity: 1;
	filter: drop-shadow(0 4px 12px rgba(var(--color-text), .08));
	/* Reduced size by 30% for fulltext search initial loading */
	width: clamp(50.4px, 8.4vw, 100.8px) !important; /* 70% of original (was clamp(72px, 12vw, 144px)) */
	height: clamp(50.4px, 8.4vw, 100.8px) !important; /* 70% of original (was clamp(72px, 12vw, 144px)) */
}

/* ⛓️ CURSOR_ANCHOR:ui:fulltext_search_loading_background */
/* Background effects for loading state - same as file-list-container */

/* Barber pole - moving diagonal stripes (blue) with subtle dynamics */
/* Loading effects removed - no longer needed */

.fulltext-loading-spinner {
	position: relative;
	z-index: 10;
	margin: var(--space-5) 0;
	clear: both;
}

/* Search request text with pagination */
.search-request-text {
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	flex-wrap: nowrap;
	gap: var(--space-2);
	width: 100%;
	position: relative;
  background-color: rgb(var(--color-canvas));
}

/* Dark mode Request блок - темный фон */

.search-request-text__content {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2);
	flex-wrap: nowrap;
	width: 100%;
	min-width: 0;
	position: relative;
}

.search-request-text__loading {
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	font-size: 0.875rem;
	color: rgb(var(--text-muted));
	opacity: 0.7;
}

.search-request-text__left {
	flex: 0 1 auto;
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: nowrap;
	white-space: nowrap;
	overflow: hidden;
	min-width: 0;
}

.search-request-text__left > * {
	flex-shrink: 0;
	white-space: nowrap;
}

.search-request-text__right {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: nowrap;
	margin-left: auto;
}
/* Fulltext request refresh badge on tab - styled to match page design */
.fulltext-request-refresh-badge {
	left: 8px;
	top: 50%;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.375rem 0.625rem;
	font-size: 1rem;
	font-weight: 600;
	color: rgb(var(--color-canvas));
	background: transparent;
	border: none;
	transition: opacity var(--dur) var(--easing);
	z-index: 10;
}

.fulltext-request-refresh-badge:hover {
	opacity: 0.8;
}

.fulltext-request-refresh-badge i {
	font-size: 1.4rem;
	line-height: 1;
	font-weight: 600;
}

/* Fulltext request changed indicator - customizable via CSS */
.fulltext-request-text.fulltext-request-changed {
	color: rgb(var(--color-error));
	transition: color var(--dur) var(--easing);
}

/* Empty content switch tab link */
.empty-content-switch-tab {
	color: rgb(var(--color-primary));
	text-decoration: none;
	cursor: pointer;
	transition: color var(--dur) var(--easing), opacity var(--dur) var(--easing);
}

.empty-content-switch-tab:hover {
	color: rgb(var(--color-primary-active));
	text-decoration: underline;
	opacity: 0.8;
}


/* Index badge */
.fulltext-index {
  flex: 0 0 auto;
  width: 28px;
  height: 22px;
  border-radius: 50%;
  color: rgb(var(--grey-700));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
	font-family: var(--font-compact);
	margin-top: -1px;

}

@media (min-width: 768px) {
  .fulltext-index {
    font-size: 0.9rem;
  }
}
@media (min-width: 992px) {
  .fulltext-index {
    font-size: 1rem;
  }
}
/* Meta chips */
.fulltext-meta-chip { background: rgba(var(--color-text), .04); border-radius: 999px; padding: 2px 8px; }

/* AI summary icon (Anthropic) */
.fulltext-summary__chip {
	background: transparent;
	padding: 0;
	border: 0 none;
	border-radius: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.fulltext-summary__chip i {
	font-size: 1.1rem;
	opacity: 0.6;
	color: rgb(var(--grey-500));
	cursor: pointer;
	transition: opacity var(--dur) var(--easing), transform var(--dur) var(--easing);
	transform-origin: center;
}

.fulltext-summary__chip:hover i {
	opacity: 1;
	color: rgb(var(--color-primary));
	transform: scale(1.3);
}

/* Top-right container for tags and size */
.fulltext-top-right {
  position: absolute;
  right: 0;
  top: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* File size badge (inside top-right container) */
.fulltext-size-badge {
  background: rgba(var(--color-text), .02);
  border-radius: 10px;
  padding: 2px 8px;
  /* font-size: .8rem; */
  color: rgb(var(--grey-400));
}

/* Summary block */
.fulltext-summary { margin-top: 4px; }
.fulltext-summary__label { font-size: .75rem; color: rgb(var(--color-primary)); font-weight: 600; }
.fulltext-summary__text { overflow: visible; }
.fulltext-summary.is-expanded .fulltext-summary__text { overflow: visible; }
.fulltext-summary__toggle { font-size: .85rem; }

/* Hide legacy matches if any */
.matches, .result-matches { display: none !important; }

/* Mobile responsive search */
@media (max-width: 575px) {
  /* Compact search card */
  .search-card {
    border-radius: var(--radius);
  }
  .search-request-text__left{
    padding-left: 10px;
  }
  .fulltext-result-card{
    gap: 0px;
  }
  
  /* Extra bottom padding for mobile browsers (iOS Safari bars) - uses safe-area-inset-bottom for automatic detection */
  /* #fulltext-results-container {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  } */
  
  .pagination {
    /* padding-bottom: env(safe-area-inset-bottom, 0px); */
    margin-bottom: 0;
  }
  
  /* Adjust tags container on mobile */
  /* .fulltext-top-right {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  } */
  
  /* .fulltext-tag {
    font-size: .7rem;
    padding: 1px 6px;
  } */
  
  /* .fulltext-size-badge {
    font-size: .7rem;
    padding: 1px 6px;
  } */
  
  .search-card .form-control {
    font-size: 0.95rem;
    padding: 10px 12px;
  }

  .search-card .search-button-fulltext {
    min-width: 44px;
    padding: 0 8px;
  }

  .search-card .search-button-fulltext i {
    font-size: 18px;
  }

  /* Filter button on mobile */
  .filter-button {
    min-width: 44px;
  }

  .filter-button i {
    font-size: 1.5rem;
  }

  /* Search hints - hide on very small screens */
  .search-hints {
    font-size: 0.75rem;
  }

  .search-hints .badge {
    padding: 2px 6px;
    font-size: 0.7rem;
  }
  
  /* Hide pull-to-load text on mobile devices */
  .pull-to-load-text {
    display: none;
  }
}

@media (max-width: 400px) {
  /* Hide hints on very small screens */
  .search-hints {
    display: none;
  }

  /* Even more compact */
  .search-card .form-control {
    font-size: 0.9rem;
    padding: 8px 10px;
  }
}

