@import '../../../sass/variables';

// ========================================
// Modern Header Overlays - Optimized
// ========================================
.search-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: var(--backdrop-blur);
  z-index: $z-index-search-overlay;
  display: none;
  opacity: 0;
  transition: var(--transition-overlay);
  padding: var(--spacing-md);

  &.active {
    display: flex;
    opacity: 1;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    animation: overlayFadeIn 0.4s ease-out;
  }

  .search-container {
    background: var(--glass-bg-light);
    backdrop-filter: var(--backdrop-blur-heavy);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-2xl);
    width: calc(100% - 2rem);
    max-width: 600px;
    margin: 0 auto;
    box-shadow: var(--shadow-heavy);
    transform: translateY(20px);
    animation: searchSlideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
    box-sizing: border-box;
    position: relative;
  }

  .search-form {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    z-index: 1;

    @media (max-width: 480px) {
      flex-direction: column;
      gap: var(--spacing-sm);
    }
  }

  .search-input,
  .search-submit {
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
    box-sizing: border-box;
  }

  .search-input {
    flex: 1;
    padding: 1.25rem 1.5rem;
    border: 2px solid var(--border-primary);
    font-size: 1.1rem;
    background: var(--glass-bg-secondary);
    backdrop-filter: var(--backdrop-blur);
    font-weight: 500;
    color: var(--text-primary);

    &::placeholder { color: var(--text-muted); }

    &:focus {
      border-color: var(--brand-primary);
      background: var(--surface-primary);
      transform: translateY(-2px);
      box-shadow: var(--shadow-medium);
    }

    @media (max-width: 480px) { width: 100%; }
  }

  .search-submit {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1.25rem var(--spacing-xl);
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: var(--shadow-light);
    flex-shrink: 0;

    &:hover {
      background: var(--gradient-primary-hover);
      transform: translateY(-2px);
      box-shadow: var(--shadow-hover);
    }

    @media (max-width: 480px) { width: 100%; }
  }

  .search-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: rgba(107, 114, 128, 0.1);
    border: 1px solid rgba(107, 114, 128, 0.2);
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    backdrop-filter: var(--backdrop-blur);
    transition: var(--transition-smooth);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;

    &:hover {
      background: rgba(239, 68, 68, 0.1);
      border-color: rgba(239, 68, 68, 0.3);
      color: var(--error-color);
      transform: rotate(90deg) scale(1.1);
    }

    @media (max-width: 480px) {
      top: var(--spacing-sm);
      right: var(--spacing-sm);
      width: 36px;
      height: 36px;
    }
  }
}

// Animations
@keyframes overlayFadeIn {
  from { opacity: 0; backdrop-filter: blur(0px); }
  to { opacity: 1; backdrop-filter: blur(10px); }
}

@keyframes searchSlideUp {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

// ==================
// PREVENT HORIZONTAL SCROLL
// ==================
body, html {
  overflow-x: hidden;
  max-width: 100vw;
  box-sizing: border-box;
}

*, *::before, *::after { box-sizing: border-box; }
