/*
 * Lo Pati - Media · Theme stylesheet (colours/typography from lopati.cat).
 * Copyright (c) Miquel Sancho, MiKi <miki@MKEngineering.org>
 */

:root {
  --lp-accent:        #FF004E;
  --lp-accent-hover:  #CC003E;
  --lp-accent-subtle: #FFCCDC;
  --lp-dark:          #151920;
  --lp-muted:         #78838C;
  --lp-text:          #212529;
  --lp-bg:            #FFFFFF;
  --lp-border:        #DEE2E6;
  --lp-radius:        0.375rem;
  --lp-font: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--lp-font);
  color: var(--lp-text);
  background: var(--lp-bg);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--lp-accent); text-decoration: underline; }
a:hover { color: var(--lp-accent-hover); }

/* ---- Header / nav ---- */
.lp-header {
  background: var(--lp-dark);
  color: #fff;
}
.lp-header__inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.lp-logo img { height: 34px; display: block; }
.lp-nav {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
  flex-wrap: wrap;
  align-items: center;
}
.lp-nav a {
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  padding-bottom: 4px;
  border-bottom: solid 5px transparent;
}
.lp-nav a:hover { color: #fff; border-bottom-color: var(--lp-accent); }
.lp-nav a.is-active { border-bottom-color: var(--lp-accent); }
.lp-nav__search { color: var(--lp-accent) !important; }

/* ---- Nav radio player ---- */
.lp-radio { display: inline-flex; align-items: center; gap: 0.5rem; }
.lp-radio__btn {
  width: 2.6rem; height: 2.6rem; padding: 0; border-radius: 50%;
  border: 2px solid var(--lp-accent); cursor: pointer; line-height: 0;
  display: inline-flex; align-items: center; justify-content: center;
  /* Blink red <-> white while idle to draw attention. */
  animation: lp-radio-blink 1s ease-in-out infinite;
}
.lp-radio__btn svg { width: 1.2rem; height: 1.2rem; fill: currentColor; display: block; }
.lp-radio.is-playing .lp-radio__btn {
  animation: none; background: var(--lp-accent); color: #fff; border-color: #fff;
}
.lp-radio__status { color: #fff; font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
@keyframes lp-radio-blink {
  0%, 100% { background: var(--lp-accent); color: #fff; }
  50%      { background: #fff; color: var(--lp-accent); }
}
/* "Audio is flowing" equalizer: only animates while the stream is playing. */
.lp-radio__eq { display: none; align-items: flex-end; gap: 2px; height: 0.95rem; }
.lp-radio.is-playing .lp-radio__eq { display: inline-flex; }
.lp-radio__eq i {
  width: 3px; height: 100%; background: var(--lp-accent); border-radius: 1px;
  transform-origin: bottom; transform: scaleY(0.3);
  animation: lp-eq 0.9s ease-in-out infinite;
}
.lp-radio__eq i:nth-child(1) { animation-delay: -0.60s; }
.lp-radio__eq i:nth-child(2) { animation-delay: -0.15s; }
.lp-radio__eq i:nth-child(3) { animation-delay: -0.45s; }
.lp-radio__eq i:nth-child(4) { animation-delay: -0.05s; }
@keyframes lp-eq { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) {
  .lp-radio__btn { animation: none; background: var(--lp-accent); color: #fff; }
  .lp-radio__eq i { animation: none; transform: scaleY(0.6); }
}
@media (max-width: 575px) { .lp-radio__status { display: none; } }
/* Subtle dim while a boosted navigation is in flight. */
body.is-boosting .lp-main { opacity: 0.6; transition: opacity 0.15s ease; }

/* ---- Account dropdown ---- */
.lp-account { position: relative; }
.lp-account > summary {
  list-style: none; cursor: pointer; color: #fff; font-weight: 600;
  text-transform: uppercase; font-size: 0.9rem; letter-spacing: 0.02em;
  padding-bottom: 4px; border-bottom: solid 5px transparent;
}
.lp-account > summary::-webkit-details-marker { display: none; }
.lp-account[open] > summary { border-bottom-color: var(--lp-accent); }
.lp-account__menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--lp-border); border-radius: var(--lp-radius);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  min-width: 190px; padding: 0.4rem; z-index: 50;
  display: flex; flex-direction: column; gap: 0.15rem;
}
.lp-account__menu a,
.lp-account__menu button {
  display: block; width: 100%; text-align: left; padding: 0.5rem 0.6rem;
  color: var(--lp-text); text-decoration: none; border-radius: var(--lp-radius);
  background: none; border: 0; font: inherit; cursor: pointer;
}
.lp-account__menu a:hover,
.lp-account__menu button:hover { background: var(--lp-accent-subtle); color: var(--lp-accent-hover); }

/* ---- Layout ---- */
.lp-main { flex: 1 0 auto; max-width: 1140px; width: 100%; margin: 0 auto; padding: 1.5rem 1rem; }

.lp-section-title {
  font-weight: 700;
  display: inline-block;
  border-bottom: solid 5px var(--lp-accent);
  padding-bottom: 0.25rem;
  margin: 1.5rem 0 1rem;
}

/* ---- Cards ---- */
.lp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.25rem;
}

/* ---- Home feed (row list) ---- */
.lp-feed { display: flex; flex-direction: column; gap: 1.1rem; }
.lp-row {
  display: grid;
  grid-template-columns: 340px 1fr 220px;
  gap: 1.25rem;
  align-items: stretch;
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius);
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.15s ease;
}
.lp-row:hover { box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1); }
.lp-row__media { display: block; line-height: 0; }
.lp-row__media img, .lp-row__noimg {
  width: 100%; height: 100%; min-height: 100%; aspect-ratio: 16 / 9;
  object-fit: cover; background: var(--lp-dark); display: block;
}
.lp-row__body { padding: 1rem 0; min-width: 0; }
.lp-row__title { margin: 0 0 0.5rem; font-size: 1.25rem; font-weight: 700; line-height: 1.25; }
.lp-row__title a { color: var(--lp-text); text-decoration: none; }
.lp-row__title a:hover { color: var(--lp-accent); }
.lp-row__summary { margin: 0 0 0.5rem; color: var(--lp-text); }
.lp-row__date { margin: 0; color: var(--lp-muted); font-size: 0.85rem; }
.lp-row__aside {
  padding: 1rem 1rem 1rem 0; display: flex; flex-wrap: wrap; gap: 0.4rem;
  align-content: flex-start;
}
.lp-badge--tag { background: transparent; color: var(--lp-muted); border: 1px solid var(--lp-border); }
.lp-feed__sentinel { height: 1px; }
@media (max-width: 768px) {
  .lp-row { grid-template-columns: 1fr; }
  .lp-row__media img, .lp-row__noimg { aspect-ratio: 16 / 9; height: auto; }
  .lp-row__body { padding: 0 1rem; }
  .lp-row__aside { padding: 0 1rem 1rem; }
}
.lp-card {
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius);
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s ease;
}
.lp-card:hover { box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.12); }
.lp-card__thumb-link { display: block; line-height: 0; }
.lp-card__thumb { aspect-ratio: 16 / 9; background: var(--lp-dark); object-fit: cover; width: 100%; display: block; transition: opacity 0.15s ease; }
.lp-card__thumb-link:hover .lp-card__thumb { opacity: 0.9; }
.lp-card__body { padding: 0.85rem 1rem; }
.lp-card__title { font-weight: 600; font-size: 1.02rem; margin: 0 0 0.35rem; }
.lp-card__title a { text-decoration: none; color: var(--lp-text); }
.lp-card__title a:hover { color: var(--lp-accent); }
.lp-card__meta { color: var(--lp-muted); font-size: 0.82rem; }

.lp-badge {
  display: inline-block;
  background: var(--lp-accent-subtle);
  color: var(--lp-accent-hover);
  border-radius: 50rem;
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

/* ---- Buttons ---- */
.lp-btn {
  display: inline-block;
  background: var(--lp-accent);
  color: #fff;
  border: 1px solid var(--lp-accent);
  border-radius: var(--lp-radius);
  padding: 0.5rem 1rem;
  /* Force inheritance so <button> matches the <a> buttons (native buttons
     default to a smaller UA font and don't inherit the page font). */
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.lp-btn:hover { background: var(--lp-accent-hover); color: #fff; }
.lp-btn--danger { background: #b3261e; border-color: #b3261e; }
.lp-btn--danger:hover { background: #8c1d17; }
/* Secondary actions: same size as .lp-btn, neutral outline (e.g. Cancel·la). */
.lp-btn--ghost { background: #fff; color: var(--lp-text); border-color: var(--lp-border); }
.lp-btn--ghost:hover { background: #fff; border-color: var(--lp-accent); color: var(--lp-accent); }
.lp-btn:disabled, .lp-btn[disabled] {
  opacity: 0.5; cursor: not-allowed; pointer-events: none;
  background: var(--lp-muted); border-color: var(--lp-muted);
}

/* ---- Embeds ---- */
.lp-embed { position: relative; aspect-ratio: 16 / 9; }
.lp-embed iframe, .lp-embed video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---- Custom media player (video + audio) ---- */
.lp-player { position: relative; background: #000; border-radius: var(--lp-radius); overflow: hidden; }
.lp-player:focus { outline: 2px solid var(--lp-accent); outline-offset: 2px; }
.lp-player--video video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.lp-player--audio { background: var(--lp-dark); }
.lp-player--audio audio { display: none; }
.lp-player__bar {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.75rem;
  background: var(--lp-dark); color: #fff;
}
/* The bar sits below the video (not overlaid) so it never covers subtitles. */
.lp-player__bar button {
  background: none; border: 0; color: #fff; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center;
}
.lp-player__bar button svg { width: 1.4rem; height: 1.4rem; fill: currentColor; }
.lp-player__bar .ic { display: inline-flex; }
.lp-player__play .ic-pause { display: none; }
.lp-player__play.is-playing .ic-play { display: none; }
.lp-player__play.is-playing .ic-pause { display: inline-flex; }
.lp-player__mute .ic-muted { display: none; }
.lp-player__mute.is-muted .ic-on { display: none; }
.lp-player__mute.is-muted .ic-muted { display: inline-flex; }
.lp-player__cur, .lp-player__dur { font-size: 0.8rem; font-variant-numeric: tabular-nums; min-width: 2.6rem; }
.lp-player__dur { text-align: right; }
.lp-player__seek {
  flex: 1; height: 0.4rem; background: rgba(255, 255, 255, 0.25);
  border-radius: 50rem; position: relative; cursor: pointer;
}
.lp-player__buffered, .lp-player__played {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 50rem; width: 0;
}
.lp-player__buffered { background: rgba(255, 255, 255, 0.3); }
.lp-player__played { background: var(--lp-accent); }
.lp-player__vol { width: 5rem; accent-color: var(--lp-accent); }
@media (max-width: 575px) { .lp-player__vol { display: none; } }

/* ---- Filters ---- */
.lp-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1.5rem; }

/* ---- Backoffice top-level navigation (clear section tabs) ---- */
.lp-managenav {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  margin: 0 0 1.75rem; padding-bottom: 0.85rem;
  border-bottom: 2px solid var(--lp-border);
}
.lp-managenav__item {
  display: inline-flex; align-items: center;
  padding: 0.6rem 1.15rem; border-radius: var(--lp-radius);
  font-weight: 700; font-size: 1.02rem; line-height: 1.1;
  text-decoration: none; color: var(--lp-text);
  background: #fff; border: 1px solid var(--lp-border); cursor: pointer;
}
.lp-managenav__item:hover { border-color: var(--lp-accent); color: var(--lp-accent); }
.lp-managenav__item.is-active {
  background: var(--lp-accent); border-color: var(--lp-accent); color: #fff;
}
.lp-managenav__logout { margin: 0 0 0 auto; }        /* push "Surt" to the right */
.lp-managenav__item--logout { color: var(--lp-muted); font-weight: 600; }
.lp-managenav__item--logout:hover { border-color: #b3261e; color: #b3261e; }
@media (max-width: 575px) {
  .lp-managenav__item { padding: 0.5rem 0.85rem; font-size: 0.95rem; }
  .lp-managenav__logout { margin-left: 0; }
}

/* ---- Footer ---- */
.lp-footer {
  background: var(--lp-dark);
  color: #cbcfd1;
  padding: 1.5rem 1rem;
  margin-top: 2rem;
}
.lp-footer__inner { max-width: 1140px; margin: 0 auto; font-size: 0.85rem; }
.lp-footer a { color: #fff; }

/* ---- Search box ---- */
.lp-searchbox { display: flex; gap: 0.5rem; margin: 1rem 0; }
.lp-searchbox input[type="search"] {
  flex: 1; padding: 0.55rem 0.75rem;
  border: 1px solid var(--lp-border); border-radius: var(--lp-radius);
}

/* ---- Forms ---- */
.lp-form-card {
  max-width: 580px;
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius);
  padding: 1.75rem;
  background: #fff;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.04);
}
.lp-form-card--wide { max-width: 780px; }
.lp-auth { max-width: 420px; margin: 2.5rem auto; }

.lp-form__group { margin-bottom: 1.15rem; }
.lp-form__group > label {
  display: block; font-weight: 600; font-size: 0.9rem;
  margin-bottom: 0.4rem; color: var(--lp-text);
}
.lp-field {
  width: 100%; padding: 0.6rem 0.75rem;
  border: 1px solid var(--lp-border); border-radius: var(--lp-radius);
  font-family: inherit; font-size: 1rem; color: var(--lp-text);
  background: #fff; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lp-field:focus {
  outline: none; border-color: var(--lp-accent);
  box-shadow: 0 0 0 0.2rem rgba(255, 0, 78, 0.18);
}
textarea.lp-field { min-height: 5rem; resize: vertical; }
.lp-field--select {
  appearance: none; -webkit-appearance: none; padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2378838C'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center;
}
select[multiple].lp-field { min-height: 7rem; background-image: none; padding-right: 0.75rem; }
.lp-file { display: block; font-size: 0.9rem; }
.lp-check { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.95rem; cursor: pointer; }
.lp-check__input { width: 1.1rem; height: 1.1rem; accent-color: var(--lp-accent); }
.lp-form__help { margin: 0.35rem 0 0; color: var(--lp-muted); font-size: 0.82rem; }
.lp-form__error { margin: 0.35rem 0 0; color: var(--lp-accent); font-size: 0.82rem; font-weight: 600; }
.has-error .lp-field { border-color: var(--lp-accent); }
.lp-form__alert {
  background: var(--lp-accent-subtle); color: var(--lp-accent-hover);
  border-radius: var(--lp-radius); padding: 0.75rem 1rem; margin-bottom: 1rem; font-size: 0.9rem;
}
.lp-form__req { color: var(--lp-accent); }
.lp-form__actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.25rem; }

/* ---- Chunked uploader ---- */
.lp-uploader__bar {
  height: 0.6rem; background: var(--lp-border); border-radius: 50rem;
  overflow: hidden; margin: 0.5rem 0;
}
.lp-uploader__bar span {
  display: block; height: 100%; width: 0; background: var(--lp-accent);
  transition: width 0.2s ease;
}
.lp-uploader__status { margin: 0.3rem 0 0; font-size: 0.85rem; color: var(--lp-muted); }

/* ---- Checkbox multi-select (categories / labels) ---- */
.lp-checklist {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1rem;
  border: 1px solid var(--lp-border); border-radius: var(--lp-radius);
  padding: 0.6rem 0.75rem; max-height: 220px; overflow-y: auto;
}
.lp-checklist > div { margin: 0; }
.lp-checklist label {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-weight: 400; font-size: 0.92rem; cursor: pointer;
}
.lp-checklist input[type="checkbox"] { width: 1rem; height: 1rem; accent-color: var(--lp-accent); }
.lp-checklist:empty::after,
.lp-checklist:not(:has(label))::after { content: "Encara no n'hi ha cap."; color: var(--lp-muted); font-size: 0.85rem; }

/* ---- Kind choice tiles ---- */
.lp-kinds {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem; max-width: 780px;
}
.lp-kind-tile {
  display: block; border: 1px solid var(--lp-border); border-radius: var(--lp-radius);
  padding: 1.75rem 1.25rem; text-align: center; text-decoration: none;
  color: var(--lp-text); font-weight: 600; background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.lp-kind-tile:hover {
  border-color: var(--lp-accent); box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
  transform: translateY(-2px); color: var(--lp-accent);
}
.lp-kind-tile__icon { font-size: 2.25rem; display: block; margin-bottom: 0.5rem; }
.lp-kind-tile__hint { display: block; font-weight: 400; font-size: 0.82rem; color: var(--lp-muted); margin-top: 0.35rem; }

/* ---- Two-column item form ---- */
.lp-item-form { max-width: 1040px; }
.lp-cols {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.lp-col--main {
  border: 1px solid var(--lp-border); border-radius: var(--lp-radius);
  padding: 1.5rem; background: #fff;
}
.lp-col--side {
  border: 1px solid var(--lp-border); border-radius: var(--lp-radius);
  padding: 1.25rem; background: #f8f9fa;
}

/* ---- Rich-text editor ---- */
.lp-rt__bar { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.4rem; }
.lp-rt__btn {
  min-width: 2rem; padding: 0.3rem 0.55rem; cursor: pointer; font-weight: 600;
  border: 1px solid var(--lp-border); border-radius: var(--lp-radius);
  background: #fff; color: var(--lp-text);
}
.lp-rt__btn:hover { background: var(--lp-accent-subtle); color: var(--lp-accent-hover); }
.lp-rt__area { min-height: 12rem; overflow-y: auto; }
.lp-rt__area:focus {
  outline: none; border-color: var(--lp-accent);
  box-shadow: 0 0 0 0.2rem rgba(255, 0, 78, 0.18);
}
.lp-rt__area p { margin: 0 0 0.6rem; }

@media (max-width: 768px) {
  .lp-cols { grid-template-columns: 1fr; }
}

@media (max-width: 575px) {
  .lp-nav { gap: 0.85rem; width: 100%; margin-left: 0; }
  .lp-form-card { padding: 1.25rem; }
}
