/* === Desktop: show delete button on hover === */
@media (min-width: 481px) {
  .movie-card:hover .delete-btn {
    display: inline-block;
  }
}

/* === Small mobile (<480px) === */
@media (max-width: 480px) {
  .delete-btn {
    display: inline-block;
    position: static;
    margin-top: 0.5rem;
  }

  .movie-card {
    width: 100%;
  }

  .movie-card h4 {
    font-size: 0.95rem;
  }

  #toggleFilters {
    display: block;
    width: 100%;
    margin: 0.5rem auto;
    padding: 0.6rem 1rem;
    background: #300040;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
  }

  #filterPanel.hidden {
    display: none;
  }

  #filterPanel {
    padding: 1rem 0;
  }

  .filters {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .mobile-only {
    display: block;
    margin-bottom: 1rem;
  }
}

/* === Small screens (<600px) === */
@media (max-width: 600px) {
  .modal {
    align-items: flex-start;
    padding: 0;
  }

  .modal-content {
    width: 100vw;
    height: 100vh;
    max-width: 100%;
    max-height: 100%;
    padding: 1rem;
    overflow-y: auto;
    font-size: 0.9rem;
    border-radius: 0;
    box-shadow: none;
    border: none;
    background: var(--bg-light);
    color: var(--text);
  }

  .modal-content img {
    max-height: 240px;
    object-fit: contain;
    margin: 0 auto 1rem;
    display: block;
  }

  .movie-details img {
    max-width: 100%;
    height: auto;
    margin: 0 auto 1rem;
    display: block;
  }

  .movie-details {
    text-align: left;
  }

  .details-card {
    flex-direction: column;
    align-items: center;
  }

  .movie-details img,
  .details-info img {
    float: none;
    margin-right: 0;
    margin-bottom: 1rem;
  }

  .detail-actions {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
    justify-content: center;
  }

  .detail-actions button {
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
    border-radius: 8px;
  }

  .modal-flex {
    flex-direction: row;
  }
}

/* === Tablet (<768px) === */
@media (max-width: 768px) {
  .movie-card {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
    background-color: #111;
    border-radius: 12px;
    overflow: hidden;
  }

  .movie-card img {
    width: 100px;
    height: auto;
    border-radius: 0;
  }

  .movie-card h3 {
    font-size: 1rem;
    margin: 0.5rem 0 0.2rem;
  }

  .movie-card p {
    font-size: 0.85rem;
    margin: 0;
  }

  #collectionList {
    gap: 1rem;
  }

  #collectionList.grid-view {
    justify-content: center;
  }

  #collectionList.list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .movie-card.list {
    flex-direction: row;
    align-items: flex-start;
  }

  .movie-card.list img {
    width: 70px;
  }

  .movie-card.list .info {
    font-size: 0.95rem;
  }

  #searchForm,
  #manualAddForm {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }

  #searchForm input,
  #manualAddForm input {
    width: 100%;
  }

  header {
    padding: 0.5rem 1rem;
  }

  .logo {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .logo img {
    width: 24px;
    height: 24px;
  }

  .modal-content {
    width: 95%;
    max-height: 90%;
  }

  .nav-buttons {
    display: none;
  }
}

/* === Desktop (>=769px) === */
@media (min-width: 769px) {
  #filterPanel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    position: sticky;
    top: 4.5rem;
    z-index: 900;
    width: 100%;
    padding: 1rem;
    background-color: var(--bg, #1a1a1a);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }

  .close-filter,
  #filterOverlay {
    display: none !important;
  }

  #filterPanel label,
  #filterPanel select,
  #filterPanel input,
  #filterPanel button {
    width: auto;
  }

  .mobile-only {
    display: none !important;
  }

  #filterPanel.filters {
    display: flex;
    justify-content: center;
    padding: 1rem 2rem;
  }

  #filterPanel fieldset {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem 1rem;
    padding: 1.2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-light);
    width: 100%;
    max-width: 1800px;
  }

  #filterPanel fieldset label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
    color: var(--text);
  }

  #filterPanel select,
  #filterPanel input[type='text'] {
    width: 100%;
    font-size: 0.95rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    color: var(--text);
  }

  #filterPanel button#resetBtn {
    grid-column: span 4;
    justify-self: start;
    padding: 0.5rem 1.25rem;
    margin-top: 0.3rem;
  }

  #filterPanel legend {
    font-weight: bold;
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 0.8rem;
    grid-column: span 4;
  }
}
