@import url("../components/header.css");
@import url("../components/card.css");
@import url("../components/search-input.css");
@import url("../responsive/search.css");

a {
  text-decoration: none;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

header.search-header {
  margin-top: 85px;
  margin-bottom: 32px;
  padding-bottom: 16px;
}

.header-top {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h1.page-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav-filters {
  width: 100%;
  display: flex;
  flex-direction: row;
  gap: 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Navegação Principal de Busca (Transformada em Pills) */
.main-nav {
  display: flex;
  gap: 12px;
  width: 100%;
  padding-bottom: 12px;
  margin-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -webkit-overflow-scrolling: touch;
}

.main-nav::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.main-nav a {
  padding: 8px 20px;
  border-radius: 30px;
  background-color: var(--tertiary-bg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.25s ease;
}

/* Estado Ativo e Hover das Pills */
.main-nav a:hover,
.main-nav a.active {
  background-color: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.3);
}

/* Botão de Filtros Avançados */
.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: 30px;
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.25s ease;
}

.action-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* Botões de Paginação */
.btn-pagination {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--tertiary-bg);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 28px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-pagination:hover:not(:disabled) {
  background-color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(229, 9, 20, 0.3);
}

.btn-pagination:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.action-btn i {
  font-size: 0.8em;
}

/* Modal de Filtros Avançados */
.filter-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.filter-overlay.active {
  opacity: 1;
  visibility: visible;
}

.filter-modal {
  background-color: var(--secondary-bg);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.filter-overlay.active .filter-modal {
  transform: translateY(0);
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.filter-close {
  background: var(--tertiary-bg);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.filter-close:hover {
  background: #333;
  color: white;
}

.filter-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.filter-body::-webkit-scrollbar {
  width: 6px;
}

.filter-body::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.filter-group h3 {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-weight: 500;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-chip {
  padding: 8px 16px;
  background-color: var(--tertiary-bg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.filter-chip:hover {
  background-color: #2a2a2a;
}

.filter-chip.active {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
}

.filter-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-clear {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  background: transparent;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.btn-clear:hover {
  color: white;
}

.btn-apply {
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  background-color: var(--accent);
  color: white;
  transition: background 0.2s;
}

.btn-apply:hover {
  background-color: #f40612;
}

.genre-container {
  position: relative;
  margin-top: 20px;
}

.genre-list {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding-bottom: 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-user-select: none;
  user-select: none;
}

.genre-list::-webkit-scrollbar {
  display: none;
}

.genre-btn {
  white-space: nowrap;
  padding: 6px 16px;
  background-color: var(--tertiary-bg);
  color: var(--text-secondary);
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  border: 1px solid transparent;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.genre-btn:hover,
.genre-btn.active {
  background-color: var(--secondary-bg);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.genre-btn.active {
  border-left: 3px solid var(--accent);
}

.genre-btn span.active-indicator {
  color: var(--accent);
  margin-right: 4px;
  font-weight: bold;
}

.scroll-indicator {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 8px;
  width: 40px;
  background: linear-gradient(to left, var(--primary-bg), transparent);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
}

.movie-grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(130px, 1fr)
  ); /* Colunas menores para mobile */
  gap: 15px;
  justify-items: center;
}

.pagination-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 40px 0 20px;
  width: 100%;
}

.btn-pagination {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--tertiary-bg);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-pagination:hover:not(:disabled) {
  background-color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.btn-pagination:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.pagination-info {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

@media (min-width: 900px) {
  .movie-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 600px) {
  .nav-filters {
    flex-direction: column;
  }
}