/* === START: styles.css === */
/* === 0. Fargevariabler for tema (default) === */
:root {
  --bg: #121212;
  --bg-light: #1e1e1e;
  --text: #e0e0e0;
  --text-muted: #cccccc;
  --accent: #00bcd4;
  --accent-hover: #00acc1;
  --border: #444;
  --shadow: rgba(0, 188, 212, 0.2);
  --highlight: rgba(0, 188, 212, 0.7);
}
.theme-neon {
  --bg: #0a0a0a;
  --bg-light: #1f0030;
  --text: #e0e0ff;
  --text-muted: #aaaadd;
  --accent: #ff00ff;
  --accent-hover: #ff66ff;
  --border: #660066;
  --shadow: rgba(255, 0, 255, 0.2);
  --highlight: rgba(255, 0, 255, 0.5);
}
.theme-sunset {
  --bg: #2d1a1a;
  --bg-light: #402020;
  --text: #ffe5d0;
  --text-muted: #ffb899;
  --accent: #ff6f00;
  --accent-hover: #ff8800;
  --border: #aa4400;
  --shadow: rgba(255, 111, 0, 0.2);
  --highlight: rgba(255, 111, 0, 0.4);
}
.theme-frost {
  --bg: #e9f5ff;
  --bg-light: #ffffff;
  --text: #00334d;
  --text-muted: #336680;
  --accent: #007acc;
  --accent-hover: #0099ff;
  --border: #a3cde8;
  --shadow: rgba(0, 122, 204, 0.2);
  --highlight: rgba(0, 122, 204, 0.4);
}
.theme-cyberpunk {
  --bg: #0d0d0d;
  --bg-light: #1a001a;
  --text: #f0f0f0;
  --text-muted: #aa88cc;
  --accent: #ff0099;
  --accent-hover: #ff33bb;
  --border: #660066;
  --shadow: rgba(255, 0, 153, 0.2);
  --highlight: rgba(255, 0, 153, 0.4);
}
.theme-aurora {
  --bg: #091a1f;
  --bg-light: #12333f;
  --text: #c8f0ff;
  --text-muted: #7fd9ff;
  --accent: #6effb5;
  --accent-hover: #32ffaa;
  --border: #1ee6b2;
  --shadow: rgba(110, 255, 181, 0.2);
  --highlight: rgba(110, 255, 181, 0.5);
}
.theme-bloodmoon {
  --bg: #0c0004;
  --bg-light: #1a000a;
  --text: #ffeaea;
  --text-muted: #ffb3b3;
  --accent: #ff0033;
  --accent-hover: #ff3366;
  --border: #800020;
  --shadow: rgba(255, 0, 51, 0.2);
  --highlight: rgba(255, 0, 51, 0.5);
}
.theme-void {
  --bg: #0a0a1a;
  --bg-light: #121232;
  --text: #d0d0ff;
  --text-muted: #8888cc;
  --accent: #4444ff;
  --accent-hover: #6666ff;
  --border: #333388;
  --shadow: rgba(68, 68, 255, 0.2);
  --highlight: rgba(68, 68, 255, 0.4);
}

/* === 1. Grunnstruktur og bakgrunn === */
body {
  font-family: sans-serif;
  margin: 0;
  padding: 1rem;
  background-color: var(--bg);
  color: var(--text);
}

/* === 2. Typografi === */
h1 {
  font-weight: normal;
  font-size: 2rem;
  margin-top: 0;
  color: var(--text);
  font-style: italic;
}

h2,
h3 {
  font-weight: normal;
  margin-top: 0;
  color: var(--accent);
}

.filters label {
  font-weight: 500;
}

/* === 3. Header og footer === */
header,
footer {
  background: #222;
  color: white;
  padding: 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* === 4. Seksjoner (bokser) === */
section {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--bg-light);
  border-radius: 8px;
  box-shadow: 0 2px 6px var(--shadow);
}
.is-hidden {
  display: none !important;
}

/* === 5. Inputs og knapper === */
input,
select,
button {
  padding: 0.5rem;
  margin: 0.5rem 0;
  font-size: 1rem;
  border-radius: 4px;
  background-color: var(--bg-light);
  color: var(--text);
  border: 1px solid var(--accent);
}

button {
  background-color: var(--bg-light);
  cursor: pointer;
}

button:hover {
  background-color: var(--accent);
  color: var(--bg);
}
.detail-actions {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* === 6. Filter-seksjon === */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  background: var(--bg-light);
  padding: 1rem;
  border-radius: 8px;
}

/* === 7. Filmliste (samling) === */
#collectionList {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}
#collectionList.shelf-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 2rem 1rem;
  padding: 3rem 1rem;
  justify-items: center;
  align-items: end;
  position: relative;
  z-index: 1;
}

#collectionList.shelf-view::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.4) 0, rgba(0, 0, 0, 0.4) 2px, transparent 2px, transparent 180px);
  z-index: 0;
  pointer-events: none;
}

.movie-card {
  background: var(--bg-light);
  padding: 0.5rem;
  border-radius: 8px;
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.6);
  transform: perspective(800px) rotateX(1deg);
  transition: transform 0.2s ease;
  position: relative;
  z-index: 1;
  text-align: center;
  width: 150px;
}
.movie-card:hover {
  transform: perspective(800px) rotateX(0deg) scale(1.03);
  z-index: 2;
}

.poster {
  border-radius: 8px 8px 0 0;
}

/* === 8. Søkeboks og resultater === */
.search-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 2rem;
}

.search-left {
  flex: 1;
  min-width: 220px;
}

.search-right {
  flex: 2;
  min-width: 300px;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}

#searchResults {
  background-color: var(--bg-light);
  color: var(--text);
  border-radius: 6px;
  padding: 0.5rem;
  margin-top: 0.5rem;
  box-shadow: 0 0 10px var(--shadow);
  max-height: 300px;
  overflow-y: auto;
}

#searchResults div {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

#searchResults div:hover {
  background-color: var(--accent);
  color: var(--bg);
}
.search-result {
  display: flex;
  gap: 1rem;
  align-items: center;
  border: 1px solid #444;
  padding: 0.5rem;
  background: #111;
  border-radius: 0.5rem;
  max-width: 500px;
}
.search-result img {
  width: 80px;
  border-radius: 0.25rem;
}
.search-result button {
  margin-top: 0.5rem;
}

/* === 9. Modal for filminfo === */
.modal {
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: var(--bg-light);
  color: var(--text);
  padding: 2rem;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 12px;
  border: 2px solid var(--accent);
  box-shadow: 0 0 20px var(--shadow);
}

.modal-content img {
  width: 100%;
  margin-bottom: 1rem;
}

/* === 10. Movie details kort (søkeresultat til høyre) === */
.movie-details {
  background-color: var(--bg-light);
  padding: 1rem;
  border-radius: 8px;
  color: var(--text);
  box-shadow: 0 0 10px var(--shadow);
}

.movie-details h3 {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.movie-details p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
  line-height: 1.4;
}

.movie-details img {
  max-width: 160px;
  height: auto;
  float: left;
  margin-right: 1.2rem;
  margin-bottom: 0.5rem;
  border-radius: 8px;
  box-shadow: 0 0 8px var(--shadow);
}

.manual-entry {
  margin: 2rem 0;
  padding: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.manual-entry input {
  padding: 0.6rem;
  font-size: 1rem;
  width: 60%;
  margin-right: 1rem;
}

.manual-entry button {
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
}
.delete-btn {
  display: none;
  width: auto;
  padding: 4px 8px;
  font-size: 0.9rem;
  background-color: crimson;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 0.5rem;
  z-index: 2;
}
.tmdb-details {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  margin-top: 1rem;
}

.tmdb-details .poster-thumb {
  max-width: 120px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.tmdb-details .movie-meta {
  flex: 1;
}
.details-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
  background: var(--bg-light);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px var(--shadow);
  margin: 1rem auto;
  max-width: 800px;
}
.details-info {
  flex: 1;
}
.details-info h3 {
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.details-info p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
  line-height: 1.4;
}
.details-info img {
  max-width: 160px;
  height: auto;
  float: left;
  margin-right: 1.2rem;
  margin-bottom: 0.5rem;
  border-radius: 8px;
  box-shadow: 0 0 8px var(--shadow);
}
.edit-panel {
  margin-top: 1em;
  padding: 1em;
  background-color: #111;
  border: 1px solid #444;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}
.edit-panel input,
.edit-panel textarea {
  width: 100%;
  padding: 6px;
  background: #222;
  border: 1px solid #555;
  color: #eee;
  border-radius: 5px;
}
.add-panel fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--bg-light);
}

.add-panel legend {
  padding: 0 0.5rem;
  font-weight: bold;
  color: var(--accent);
}

.add-panel input,
.add-panel button {
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

.collection {
  background-color: var(--bg-light);
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 0 10px var(--shadow);
}

.collection h2 {
  position: sticky;
  top: 0;
  background: var(--bg-light);
  z-index: 5;
  padding: 0.5rem;
  border-radius: 8px;
}

#tmdbResults {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
#sortSelect {
  margin-left: 1rem;
}

/* === Temaer === */
body.theme-neon {
  background: linear-gradient(to bottom, #0f0c29, #302b63, #24243e);
  color: #fff;
}
body.theme-sunset {
  background: linear-gradient(to bottom, #ff7e5f, #feb47b);
  color: #222;
}
body.theme-frost {
  background: linear-gradient(to bottom, #e0eafc, #cfdef3);
  color: #222;
}
/* === Generelt === */
#collectionList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
}

.movie-card {
  background: #240038;
  border-radius: 10px;
  padding: 0.5rem;
  text-align: center;
  color: white;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.movie-card img {
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: cover;
  border-radius: 6px;
}

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

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

.movie-card button {
  margin-top: 0.5rem;
  background: purple;
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 5px;
  font-size: 0.8rem;
  cursor: pointer;
}

/* === Kortvisning (grid) === */
#collectionList.grid-view {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
}

.movie-card {
  width: 180px;
  background: #1e1e1e;
  border-radius: 10px;
  padding: 0.5rem;
  text-align: center;
  box-shadow: 0 0 10px #0004;
}

.movie-card img {
  width: 100%;
  border-radius: 6px;
}

/* === Listevisning (mobil) === */
#collectionList.list-view {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

.movie-card.list {
  display: flex;
  gap: 1rem;
  background: #1a1a1a;
  border-radius: 10px;
  padding: 1rem;
  align-items: center;
}

.movie-card.list img {
  width: 80px;
  height: auto;
  border-radius: 8px;
}

.movie-card.list .info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: white;
}

/* === Navigasjonsknapper i modalen === */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin: 1rem 0;
}

.nav-buttons button {
  padding: 0.5rem 1rem;
  font-size: 1.2rem;
}

/* === START: responsive.css === */
/* === Grunnoppsett for filmkort === */
#collectionList {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  padding: 1rem;
}

.movie-card {
  width: 160px;
  background-color: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 0.5rem;
  text-align: center;
  position: relative;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
  cursor: pointer;
}

.movie-card:hover {
  transform: scale(1.03);
  box-shadow: 0 0 15px var(--highlight, #8800ff);
}

.movie-card .poster {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

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

/* === Slett-knapp (desktop hover og mobil alltid synlig) === */
.delete-btn {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.85rem;
  padding: 4px 6px;
  background-color: crimson;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  z-index: 2;
}

/* Vis slett-knapp på hover (desktop) */

/* Vis slett-knapp alltid på mobil og plasser den statisk */

/* === Responsive Justeringer === */

/* === Ekstra mobilvennlig (<480px) === */

/* === Mobilvisning === */

/* === FORBEDRET LISTEVISNING (MOBIL) === */

/* === SLIDE-OVER FILTERPANEL (MOBIL) === */
#filterPanel {
  position: fixed;
  top: 0;
  left: 0;
  width: 90vw; /* Mindre bredde */
  max-width: 280px; /* Tydelig maksgrense */
  height: 100%;
  background-color: #1a1a1a;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  padding: 1.2rem; /* Litt bedre luft */
  overflow-y: auto;
  box-sizing: border-box; /* Viktig: sikrer at padding ikke overstyrer bredden */
}

#filterPanel.open {
  transform: translateX(0);
}

#filterOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 900;
}

#filterOverlay.active {
  display: block;
}

#filterPanel .close-filter {
  display: block;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.mobile-only {
  display: inline-block;
}
#filterPanel label,
#filterPanel select,
#filterPanel input,
#filterPanel button {
  width: 100%;
  box-sizing: border-box;
}

/* === DEAKTIVER SLIDEOVER PÅ DESKTOP === */
.modal-flex {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.modal-flex img {
  width: 40%;
  max-width: 140px;
  border-radius: 8px;
  object-fit: cover;
}

.modal-flex .movie-meta {
  flex: 1;
  font-size: 0.9rem;
}
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  padding: 1rem;
}

.filters fieldset {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.8rem;
  background-color: var(--bg-light);
}

.filters legend {
  font-weight: bold;
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
