/* LOCAL FONT HOSTING */
@font-face {
  font-display: swap;
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400;
  src:
    url("../assets/fonts/outfit-v15-latin-regular.woff2") format("woff2"),
    url("../assets/fonts/outfit-v15-latin-regular.ttf") format("truetype");
}
@font-face {
  font-display: swap;
  font-family: "Outfit";
  font-style: normal;
  font-weight: 500;
  src:
    url("../assets/fonts/outfit-v15-latin-500.woff2") format("woff2"),
    url("../assets/fonts/outfit-v15-latin-500.ttf") format("truetype");
}
@font-face {
  font-display: swap;
  font-family: "Outfit";
  font-style: normal;
  font-weight: 700;
  src:
    url("../assets/fonts/outfit-v15-latin-700.woff2") format("woff2"),
    url("../assets/fonts/outfit-v15-latin-700.ttf") format("truetype");
}

/* JCs RESET CUSTOMIZED */
*,
*::before,
*::after {
  box-sizing: border-box;
}
*:not(dialog) {
  margin: 0;
}
@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}
body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}
input,
button,
textarea,
select {
  font: inherit;
}
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}
p {
  text-wrap: pretty;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

/* DESIGN TOKENS */
:root {
  /* colors */
  --primary-100: #ff6666;
  --primary-200: #dd474c;
  --primary-300: #8f0015;
  --accent-100: #ffcc99;
  --accent-200: #976d3f;
  --text-100: #ffffff;
  --text-200: #e0e0e0;
  --bg-100: #1a1a1a;
  --bg-200: #292929;
  --bg-300: #404040;
  /* spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.25rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  /* border radius */
  --radius: 0.25rem;
  --radius-md: 0.5rem;
  --radius-pill: 9999px;
  /* shadows */
  --box-shadow: 0 0 10px;
  --box-shadow-sm: 0 0 6px;
  /* component-specific */
  --card-bg: rgba(41, 41, 41, 0.25);
  --poster-width: 100px;
  --poster-height: 150px;
  /* z-index system: fab (10) < dialog (100) < nested dialog (200) */
  --z-fab: 10;
  --z-dialog: 100;
  --z-nested-dialog: 200;
}

/* BASE STYLES */
html {
  font-family: "Outfit", system-ui;
}
body {
  background: var(--bg-100);
  color: var(--text-200);
  max-width: 1024px;
  margin: 0 auto;
}
body.states-empty {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-100);
}
img {
  color: var(--text-200);
}

/* LOGO */
.logo {
  background: var(--primary-100);
  display: inline-block;
  padding: 0 var(--space-2);
  border-radius: var(--radius);
  box-shadow: var(--box-shadow) var(--primary-200);
}
.logo__title {
  color: var(--bg-100);
}

/* SITE HEADER */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* BUTTONS */
.btn {
  background: var(--bg-300);
  color: var(--text-100);
  border: none;
  box-shadow: var(--box-shadow) rgb(0 0 0 / 0.35);
}
.btn ion-icon {
  pointer-events: none;
}
.btn--icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-pill);
  transition: all 0.1s ease-in-out;
  cursor: pointer;
}
.btn--small {
  min-width: 36px;
  min-height: 36px;
  font-size: 1.25rem;
}
.btn--full {
  width: 100%;
  padding: var(--space-3);
  border-radius: var(--radius-md);
}
.btn--primary {
  background: var(--accent-100);
  color: var(--bg-100);
  box-shadow: var(--box-shadow) var(--accent-100);
}
.btn--secondary {
  background: var(--bg-300);
  color: var(--text-100);
  border: 1px solid var(--bg-300);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: all 0.1s ease-in-out;
  cursor: pointer;
  box-shadow: none;
}
.btn--secondary:hover {
  border-color: var(--text-200);
}
.btn--primary:hover {
  cursor: pointer;
  outline: 1px solid var(--accent-100);
  outline-offset: 2px;
}
.btn--primary:focus-visible {
  outline: 1px solid var(--accent-100);
  outline-offset: 2px;
}
.btn--primary:disabled {
  background: var(--bg-300);
  color: var(--text-100);
  box-shadow: var(--box-shadow) rgb(0 0 0 / 0.2);
  cursor: not-allowed;
  opacity: 0.5;
  outline: none;
}
.btn--form {
  align-self: flex-end;
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-4);
}
.btn--text {
  background: transparent;
  box-shadow: none;
}
.btn--text:hover,
.btn--text:focus-visible {
  background: var(--bg-300);
  outline: none;
}
.btn--text:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: transparent;
}
#fab-create {
  position: fixed;
  bottom: var(--space-3);
  right: var(--space-3);
  z-index: var(--z-fab);
}
@media (min-width: 1024px) {
  #fab-create {
    /* align with max-width container: 1024px / 2 = 512px */
    right: calc(50% - 512px + var(--space-3));
  }
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  transform: translateY(-2rem);
}
.empty-state__title {
  margin-bottom: var(--space-2);
}
.empty-state__text {
  font-size: 0.875rem;
  color: var(--text-200);
}

/* CARD */
.card-base {
  background: var(--card-bg);
  border: 1px solid var(--bg-300);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  cursor: pointer;
}
.card-base:last-of-type {
  margin: 0;
}
.watchlist-card {
  display: flex;
  flex-direction: column;
  align-self: start;
  justify-content: space-between;
  gap: var(--space-2);
}
.watchlist-card__header {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: var(--space-3);
}
.watchlist-card__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.watchlist-card__icon {
  filter: drop-shadow(var(--box-shadow-sm) var(--primary-200));
}
.watchlist-card__title {
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.watchlist-card__count {
  font-size: 0.875rem;
}
.movie-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  cursor: unset;
}
.movie-card__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}
.movie-card__header {
  display: flex;
  align-items: start;
  gap: var(--space-3);
}
.movie-card__header > img {
  width: var(--poster-width);
  height: var(--poster-height);
  object-fit: cover;
  border-radius: var(--radius);
  flex-shrink: 0;
}
.movie-card__details {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 150px;
}
.movie-card__details-top {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: var(--space-2);
}
.movie-card__title {
  font-size: 1rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.movie-card__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-1);
  margin-top: auto;
}
.movie-card__review {
  padding: var(--space-2);
  border-left: 2px solid var(--accent-100);
}
.movie-card__review-text {
  font-style: italic;
  color: var(--text-200);
}
.movie-card__review > button {
  align-self: flex-end;
}

/* BADGES */
.badge {
  font-size: 0.75rem;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  font-weight: 500;
  flex-shrink: 0;
}
.badge--watched {
  background: rgba(102, 255, 102, 0.15);
  color: #66ff66;
  border: 1px solid rgba(102, 255, 102, 0.3);
}
.badge--unwatched {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-200);
  border: 1px solid var(--bg-300);
}

/* DIALOGS */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(75px);
  z-index: 100;
}
.dialog {
  background: var(--bg-200);
  border: 1px solid var(--bg-300);
  width: 90%;
  border-radius: var(--radius-md);
  max-width: 450px;
}
.dialog--fullscreen {
  background: var(--bg-100);
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  border: none;
  border-radius: 0;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.dialog--confirm {
  max-width: 400px;
}
/* constrain fullscreen dialog content to body max-width */
.dialog--fullscreen .dialog__header,
.dialog--fullscreen .dialog__content,
.dialog--fullscreen .dialog__footer {
  width: 100%;
  max-width: 1024px;
}
.dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.dialog__content {
  flex: 1;
  overflow-y: auto;
  margin-bottom: var(--space-3);
}
.dialog__content--empty {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.dialog__content--settings {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  overflow-y: auto;
}
.dialog__form {
  display: flex;
  flex-direction: column;
}
.dialog__footer {
  display: flex;
  justify-content: flex-end;
}
.dialog__footer--confirm {
  gap: var(--space-2);
}
.form__label {
  margin: 0 0 var(--space-2) var(--space-2);
  color: var(--text-200);
}
.form__input {
  padding: var(--space-2);
  border-radius: var(--radius);
  border: 1px solid var(--bg-300);
  background: transparent;
  color: var(--text-100);
  outline-color: var(--bg-300);
  margin-bottom: var(--space-3);
}
@media (prefers-reduced-motion: no-preference) {
  .form__input {
    transition:
      border-color 0.1s ease-in-out,
      outline-offset 0.1s ease-in-out;
  }
}
.form__input:last-of-type {
  margin-bottom: var(--space-5);
}
.form__input:focus-visible {
  outline: 1px solid var(--bg-300);
  outline-offset: 3px;
}
.form__textarea {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}
/* nested dialog needs higher z-index to appear above parent dialog */
#dialog-create-movie-overlay,
#dialog-confirm-overlay,
#dialog-settings-overlay {
  z-index: var(--z-nested-dialog);
}
/* import dialog needs even higher z-index when opened from settings */
#dialog-import-overlay {
  z-index: calc(var(--z-nested-dialog) + 100);
}
#dialog-confirm-message {
  color: var(--text-200);
}

/* settings sections */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.settings-section__title {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-200);
}
.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--card-bg);
  border: 1px solid var(--bg-300);
  border-radius: var(--radius-md);
}
.settings-item__label {
  font-size: 1rem;
  margin-bottom: var(--space-1);
}
.settings-item__description {
  font-size: 0.875rem;
  color: var(--text-200);
  line-height: 1.1;
}
/* toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle__input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-300);
  transition: 0.2s;
  border-radius: var(--radius-pill);
  border: 1px solid var(--bg-300);
}
.toggle__slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-100);
  transition: 0.2s;
  border-radius: 50%;
}
.toggle__input:checked + .toggle__slider {
  background-color: var(--accent-200);
  border-color: var(--accent-100);
}
.toggle__input:focus-visible + .toggle__slider {
  outline: 2px solid var(--accent-100);
  outline-offset: 2px;
}
.toggle__input:checked + .toggle__slider:before {
  transform: translateX(20px);
}

/* UTILITY CLASSES */
.container {
  padding: var(--space-3);
}
.container--empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.display {
  display: block;
}
.hide {
  display: none;
}
