@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@500;600&display=swap");

/* COLORES */
:root {
  --pink: #9b3769;
  --ink: #402837;
  --muted: #886f80;
  --line: #eadde5;
}

/* BASE */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #faf7f9;
  color: var(--ink);
  font: 15px "DM Sans", "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a,
input,
textarea,
select {
  outline-offset: 4px;
}

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 11px 18px;
  border-radius: 10px;
  color: var(--ink);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.primary {
  background: var(--pink);
  color: #ffffff;
  border-color: var(--pink);
}

.danger {
  color: #a32d3d;
}

[hidden] {
  display: none !important;
}

/* MENÚ LATERAL */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  padding: 32px 26px;
  background: #f0e3ed;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  align-self: center;
  flex-shrink: 0;
}

.sidebar p {
  font-size: 13px;
  margin-bottom: 28px;
}

.sidebar small {
  margin-top: auto;
  color: var(--muted);
  line-height: 1.8;
}

.nav {
  display: block;
  padding: 14px 12px;
  margin-bottom: 7px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
}

.nav:hover {
  background: #ffffff80;
}

.nav.active {
  background: #ffffff;
}

/* CONTENIDO */
main {
  margin-left: 260px;
  padding: 35px 42px;
  max-width: 1550px;
}

header,
.toolbar,
.editor-head,
.editor-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

header {
  margin-bottom: 30px;
}

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--pink);
}

h1 {
  font-size: 28px;
  margin: 8px 0;
}

h2 {
  font: 28px "Playfair Display", Georgia, serif;
  margin: 14px 0;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
}

/* INICIO DE SESIÓN */
.login {
  max-width: 490px;
  margin: 65px auto;
  padding: 36px;
}

.login h2 {
  font-size: 29px;
}

.lock-icon {
  font-size: 40px;
  color: var(--pink);
  margin-bottom: 20px;
}

.login button {
  width: 100%;
  margin: 10px 0;
}

.login small,
.hint {
  font-size: 12px;
  color: var(--muted);
}

/* FORMULARIOS */
label {
  display: block;
  margin: 14px 0;
  font-size: 13px;
  font-weight: 600;
}

input:not([type="checkbox"]),
textarea,
select {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
  color: var(--ink);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--pink);
}

input[readonly] {
  background: #f4eef2;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* INDICADORES */
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.stats small {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
}

.stats strong {
  display: block;
  font-size: 33px;
  margin-top: 13px;
}

/* BÚSQUEDA Y FILTROS */
.toolbar {
  margin: 26px 0 16px;
}

.toolbar p {
  margin: 0;
}

.tools {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

/* TARJETAS DE PRODUCTOS */
.collection {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(240px, 1fr)
  );
  gap: 20px;
}

.product-card {
  min-width: 0;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

/* FOTO VERTICAL QUE LLENA LA TARJETA */
.product-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center;
  padding: 0;
  background: #f4eef2;
}

.product-info {
  padding: 18px;
}

.product-info h3 {
  margin: 12px 0 6px;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.product-info p {
  margin: 8px 0;
  min-height: 38px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.badge {
  padding: 5px 8px;
  background: #f5e9f1;
  border-radius: 20px;
  color: var(--pink);
  font-size: 10px;
}

.badge.hidden {
  background: #eeeeee;
  color: #777777;
}

.price {
  font-size: 21px;
  font-weight: 600;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.card-actions button {
  padding: 8px 12px;
  font-size: 12px;
}

/* VENTANAS DE EDICIÓN */
dialog {
  width: calc(100% - 32px);
  max-width: 900px;
  max-height: 92vh;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #ffffff;
  color: var(--ink);
  overflow: auto;
}

dialog::backdrop {
  background: #30212d99;
  backdrop-filter: blur(4px);
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 28px;
}

.editor-grid > div {
  min-width: 0;
}

.editor-foot {
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* CARGA Y VISTA PREVIA DE FOTOGRAFÍAS */
.upload {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  background: #faf3f7;
  border: 2px dashed #d4b6c9;
  border-radius: 14px;
  overflow: hidden;
  text-align: center;
  color: var(--pink);
  cursor: pointer;
}

.upload img {
  display: block;
  width: 100%;
  height: 300px;
  object-fit: contain;
  object-position: center;
}

.upload small {
  font-size: 11px;
  line-height: 2;
}

/* AVISOS */
#notice {
  position: fixed;
  bottom: 22px;
  right: 24px;
  max-width: min(480px, calc(100vw - 32px));
  padding: 16px 24px;
  background: var(--ink);
  color: #ffffff;
  border-radius: 12px;
  z-index: 10;
}

#notice:empty {
  display: none;
}

#loginError,
#editorError {
  color: #a32d3d;
}

/* PANTALLAS MEDIANAS */
@media (max-width: 1150px) {
  .sidebar {
    width: 220px;
  }

  main {
    margin-left: 220px;
    padding: 28px;
  }
}

/* TABLETAS Y TELÉFONOS */
@media (max-width: 760px) {
  .sidebar {
    position: static;
    width: 100%;
    padding: 12px 20px;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    overflow-y: visible;
  }

  .sidebar img {
    width: 65px;
    height: 65px;
  }

  .sidebar h2,
  .sidebar p,
  .sidebar > .eyebrow,
  .sidebar > small {
    display: none;
  }

  .nav {
    margin: 0;
    padding: 8px;
    font-size: 11px;
  }

  main {
    margin: 0;
    padding: 22px 16px;
  }

  h1 {
    font-size: 21px;
  }

  .stats {
    gap: 8px;
  }

  .stats .card {
    padding: 14px;
  }

  .stats small {
    font-size: 8px;
  }

  .stats strong {
    font-size: 25px;
  }

  .tools {
    grid-template-columns: 1fr 1fr;
  }

  .tools input {
    grid-column: 1 / -1;
  }

  .collection {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .product-info {
    padding: 12px;
  }

  .product-info h3 {
    font-size: 16px;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .upload {
    min-height: 200px;
  }

  .upload img {
    height: 200px;
  }

  .login {
    margin: 30px auto;
  }

  .toolbar {
    align-items: flex-start;
  }

  .toolbar h2 {
    font-size: 24px;
  }

  .toolbar .primary {
    font-size: 12px;
  }

  .row {
    grid-template-columns: 1fr;
  }

  dialog {
    padding: 20px;
  }
}

/* TELÉFONOS PEQUEÑOS */
@media (max-width: 430px) {
  .collection {
    grid-template-columns: 1fr;
  }
}