/* ========================================
   CINEMATIC SEARCH MODAL STYLES
   Editorial Spotlight Aesthetic
   ======================================== */

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.search-modal.active {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

/* Animated Multi-Layer Backdrop */
.search-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.search-backdrop-layer {
  position: absolute;
  inset: 0;
  transform: translateY(-100%);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-backdrop-1 {
  background: #0d0d0d;
  transition-delay: 0s;
}

.search-backdrop-2 {
  background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 50%, #1a0a0a 100%);
  transition-delay: 0.05s;
}

.search-backdrop-3 {
  background: radial-gradient(ellipse at 50% 0%, rgba(239, 68, 68, 0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(249, 115, 22, 0.05) 0%, transparent 50%),
              #0d0d0d;
  transition-delay: 0.1s;
}

.search-modal.active .search-backdrop-layer {
  transform: translateY(0);
}

/* Closing animation - reverse */
.search-modal.closing .search-backdrop-1 { transition-delay: 0.1s; }
.search-modal.closing .search-backdrop-2 { transition-delay: 0.05s; }
.search-modal.closing .search-backdrop-3 { transition-delay: 0s; }
.search-modal.closing .search-backdrop-layer {
  transform: translateY(-100%);
}

/* Search Container */
.search-container {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

/* Close Button */
.search-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0;
  transform: scale(0.8) rotate(-90deg);
}

.search-modal.active .search-close {
  opacity: 1;
  transform: scale(1) rotate(0);
  transition-delay: 0.4s;
}

.search-close:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
  transform: scale(1.05) rotate(90deg);
}

/* Search Content */
.search-content {
  width: 100%;
  max-width: 700px;
  text-align: center;
}

/* Dramatic Title */
.search-title {
  margin-bottom: 3rem;
  overflow: hidden;
}

.search-title-line {
  display: block;
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: clamp(2rem, 8vw, 4rem);
  letter-spacing: 0.15em;
  line-height: 1;
  color: rgba(255, 255, 255, 0.15);
  transform: translateY(100%);
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-title-accent {
  color: rgba(239, 68, 68, 0.9);
  transition-delay: 0.1s;
}

.search-modal.active .search-title-line {
  transform: translateY(0);
  opacity: 1;
}

.search-modal.active .search-title-line:first-child { transition-delay: 0.2s; }
.search-modal.active .search-title-accent { transition-delay: 0.3s; }

/* Search Form */
.search-form {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: 0.35s;
}

.search-modal.active .search-form {
  opacity: 1;
  transform: translateY(0);
}

/* Search Input Wrapper */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 1.25rem 3.5rem 1.25rem 0;
  font-family: 'Newsreader', Georgia, serif;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-style: italic;
  color: white;
  background: transparent;
  border: none;
  outline: none;
  caret-color: #ef4444;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
  font-style: italic;
}

/* Animated Underline */
.search-input-line {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 20%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.1) 80%,
    transparent 100%
  );
}

.search-input-line::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #ef4444, #f97316);
  transform: translateX(-50%);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-input:focus ~ .search-input-line::after,
.search-input:not(:placeholder-shown) ~ .search-input-line::after {
  width: 100%;
}

/* Search Submit */
.search-submit {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-submit:hover {
  color: #ef4444;
  transform: translateY(-50%) translateX(4px);
}

/* Live Search Results */
.search-results {
  margin-top: 2rem;
  text-align: left;
  max-height: 50vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.search-results::-webkit-scrollbar {
  width: 4px;
}

.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.search-result-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  text-decoration: none;
  transition: all 0.2s ease;
  opacity: 0;
  transform: translateY(10px);
  animation: searchResultIn 0.3s ease forwards;
}

.search-result-item:nth-child(1) { animation-delay: 0s; }
.search-result-item:nth-child(2) { animation-delay: 0.05s; }
.search-result-item:nth-child(3) { animation-delay: 0.1s; }
.search-result-item:nth-child(4) { animation-delay: 0.15s; }
.search-result-item:nth-child(5) { animation-delay: 0.2s; }

@keyframes searchResultIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-result-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(239, 68, 68, 0.3);
  transform: translateX(4px);
}

.search-result-image {
  width: 80px;
  height: 60px;
  object-fit: cover;
  flex-shrink: 0;
  opacity: 0.8;
}

.search-result-content {
  flex: 1;
  min-width: 0;
}

.search-result-category {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: white;
  background: #14b8a6;
  margin-bottom: 0.375rem;
}

.search-result-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  color: white;
  line-height: 1.3;
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-meta {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
}

.search-no-results {
  padding: 2rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

.search-loading {
  display: flex;
  justify-content: center;
  padding: 2rem;
}

.search-loading-dot {
  width: 8px;
  height: 8px;
  margin: 0 4px;
  background: rgba(239, 68, 68, 0.6);
  border-radius: 50%;
  animation: searchLoadingPulse 1s ease-in-out infinite;
}

.search-loading-dot:nth-child(2) { animation-delay: 0.1s; }
.search-loading-dot:nth-child(3) { animation-delay: 0.2s; }

@keyframes searchLoadingPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
}

/* Quick Links */
.search-quick {
  margin-top: 3rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: 0.45s;
}

.search-modal.active .search-quick {
  opacity: 1;
  transform: translateY(0);
}

.search-quick-label {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.3);
  margin-bottom: 1rem;
}

.search-quick-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.search-tag {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(10px);
}

.search-modal.active .search-tag {
  opacity: 1;
  transform: translateY(0);
  transition-delay: calc(0.5s + var(--delay) * 0.05s);
}

.search-tag:hover {
  color: white;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  transform: translateY(-2px);
}

/* Keyboard Hint */
.search-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.2);
  opacity: 0;
  transition: opacity 0.5s ease;
  transition-delay: 0.6s;
}

.search-modal.active .search-hint {
  opacity: 1;
}

.search-hint kbd {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin-right: 0.25rem;
}

/* Hide quick links when showing results */
.search-quick.hidden {
  display: none;
}

/* Responsive */
@media (max-width: 640px) {
  .search-container {
    padding: 1rem;
    justify-content: flex-start;
    padding-top: 5rem;
  }

  .search-title {
    margin-bottom: 2rem;
  }

  .search-hint {
    display: none;
  }

  .search-result-image {
    width: 60px;
    height: 45px;
  }
}
