/* AMANTER — стили админ-панели */

:root {
  --bordeaux: #8B1A2F;
  --bordeaux-dark: #3D0A14;
  --pink: #F2C4CE;
  --pink-soft: #FADDE3;
  --cream: #F5E6C8;
  --white: #FFFAF8;
  --gold: #C9A84C;
  --gold-light: #E3CE96;
  --text: #4A2530;
  --text-light: #8A6670;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* атрибут hidden должен побеждать display:flex у классов */
[hidden] { display: none !important; }

body {
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  background: #FBF3F0;
  color: var(--text);
  min-height: 100vh;
}

h1, h2 { font-family: 'Playfair Display', serif; color: var(--bordeaux); }

/* ── Вход ── */

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 20%, #5A0F1F, var(--bordeaux-dark) 75%);
  padding: 20px;
}

.login__card {
  background: var(--white);
  border-radius: 28px 28px 36px 36px;
  padding: 46px 42px;
  width: min(100%, 400px);
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
}

.login__logo {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  margin-bottom: 18px;
  box-shadow: 0 6px 22px rgba(61, 10, 20, .25);
}

.login__card h1 { font-size: 1.6rem; margin-bottom: 8px; }
.login__card p { font-size: .88rem; color: var(--text-light); margin-bottom: 22px; }

.login__card input {
  width: 100%;
  padding: 14px 18px;
  border: 1.5px solid var(--pink);
  border-radius: 16px;
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 16px;
  outline: none;
  transition: border-color .25s ease;
}

.login__card input:focus { border-color: var(--gold); }

.login__error { color: #C0392B !important; font-size: .82rem !important; margin: -6px 0 12px !important; }

.login__card button {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 18px 18px 24px 24px;
  background: linear-gradient(135deg, var(--bordeaux), #A62841);
  color: var(--white);
  font-family: inherit;
  font-size: 1rem;
  letter-spacing: .06em;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.login__card button:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(139, 26, 47, .35); }
.login__card button:active { transform: translateY(1px) scale(.97); }

.login__back {
  display: inline-block;
  margin-top: 18px;
  color: var(--text-light);
  font-size: .84rem;
  text-decoration: none;
}
.login__back:hover { color: var(--bordeaux); }

/* ── Панель ── */

.panel__head {
  background: var(--white);
  padding: 20px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: 0 4px 20px rgba(139, 26, 47, .08);
}

.panel__brand { display: flex; align-items: center; gap: 16px; }

.panel__brand img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(61, 10, 20, .2);
}

.panel__brand h1 { font-size: 1.35rem; }
.panel__brand p { font-size: .78rem; color: var(--text-light); }

.panel__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.pbtn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 16px 16px 22px 22px;
  font-family: inherit;
  font-size: .86rem;
  letter-spacing: .04em;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.pbtn:active { transform: scale(.96); }

.pbtn--primary {
  background: linear-gradient(135deg, var(--bordeaux), #A62841);
  color: var(--white);
  box-shadow: 0 8px 20px rgba(139, 26, 47, .3);
}
.pbtn--primary:hover { transform: translateY(-2px); }

.pbtn--ghost {
  background: var(--white);
  color: var(--bordeaux);
  border: 1.5px solid var(--pink);
}
.pbtn--ghost:hover { border-color: var(--gold); }

.pbtn--danger {
  background: #FDECEA;
  color: #C0392B;
  border: 1.5px solid #F3C1BB;
}
.pbtn--danger:hover { background: #C0392B; color: #fff; }

.panel__tabs {
  display: flex;
  gap: 10px;
  padding: 22px 30px 0;
  max-width: 1100px;
  margin: 0 auto;
}

.tab {
  padding: 12px 26px;
  border: none;
  border-radius: 18px 18px 0 0;
  background: rgba(242, 196, 206, .4);
  color: var(--text);
  font-family: inherit;
  font-size: .92rem;
  cursor: pointer;
  transition: background .25s ease;
}

.tab:hover { background: var(--pink); }
.tab.is-active { background: var(--white); color: var(--bordeaux); font-weight: 500; box-shadow: 0 -4px 14px rgba(139, 26, 47, .07); }

.panel__body {
  max-width: 1100px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 0 22px 22px 22px;
  padding: 26px 30px 40px;
  box-shadow: 0 10px 40px rgba(139, 26, 47, .07);
  margin-bottom: 50px;
}

.panel__toolbar {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.panel__saved { color: #2E7D32; font-size: .88rem; }

/* ── Список товаров ── */

.plist { display: flex; flex-direction: column; gap: 16px; }

.pitem {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 20px;
  align-items: center;
  background: #FFFDF9;
  border: 1px solid rgba(201, 168, 76, .25);
  border-radius: 20px;
  padding: 14px 18px;
  transition: box-shadow .25s ease;
}

.pitem:hover { box-shadow: 0 10px 30px rgba(139, 26, 47, .1); }

.pitem__img {
  width: 96px;
  height: 76px;
  object-fit: cover;
  border-radius: 14px;
  background: var(--pink-soft);
}

.pitem__info h3 { font-family: 'Playfair Display', serif; font-size: 1.05rem; color: var(--bordeaux); }
.pitem__info .tagline { font-size: .74rem; color: var(--gold); letter-spacing: .08em; text-transform: uppercase; }
.pitem__info p { font-size: .82rem; color: var(--text-light); }
.pitem__info .price { font-weight: 500; color: var(--text); font-size: .95rem; margin-top: 3px; }

.pitem__btns { display: flex; flex-direction: column; gap: 8px; }

/* ── Галерея ── */

.ggrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

.gcell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(139, 26, 47, .12);
}

.gcell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gcell__del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(61, 10, 20, .65);
  color: #fff;
  font-size: .95rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background .25s ease, transform .2s ease;
}

.gcell__del:hover { background: #C0392B; transform: scale(1.08); }

/* ── Модал ── */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(61, 10, 20, .55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal__card {
  background: var(--white);
  border-radius: 24px;
  padding: 34px 32px;
  width: min(100%, 480px);
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .35);
}

.modal__card h2 { margin-bottom: 20px; font-size: 1.4rem; }

.modal__card label {
  display: block;
  font-size: .82rem;
  color: var(--text-light);
  margin-bottom: 14px;
}

.modal__card input,
.modal__card textarea {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1.5px solid var(--pink);
  border-radius: 14px;
  font-family: inherit;
  font-size: .95rem;
  outline: none;
  transition: border-color .25s ease;
  resize: vertical;
}

.modal__card input:focus,
.modal__card textarea:focus { border-color: var(--gold); }

.modal__preview { margin-bottom: 16px; }

.modal__preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(139, 26, 47, .15);
}

.modal__row { display: flex; gap: 12px; }
.modal__row .pbtn { flex: 1; padding: 14px; }

/* ── Мобильная адаптация ── */

@media (max-width: 768px) {
  .panel__tabs {
    padding: 18px 14px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .panel__tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 11px 18px; font-size: .86rem; white-space: nowrap; flex-shrink: 0; }
}

@media (max-width: 640px) {
  .login__card { padding: 34px 24px; border-radius: 24px 24px 30px 30px; }
  .login__logo { width: 68px; height: 68px; }
  .login__card h1 { font-size: 1.4rem; }
  /* 16px, чтобы iOS не зумил при фокусе */
  .login__card input { font-size: 16px; }

  .panel__head {
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .panel__brand { gap: 12px; }
  .panel__brand img { width: 44px; height: 44px; }
  .panel__brand h1 { font-size: 1.1rem; }
  .panel__brand p { font-size: .72rem; }

  .panel__actions { gap: 8px; flex-wrap: nowrap; }
  .panel__actions .pbtn {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    padding: 11px 6px;
    font-size: .78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .panel__body {
    padding: 18px 14px 28px;
    margin: 0 8px 30px;
    border-radius: 0 18px 18px 18px;
  }

  .panel__toolbar { flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
  .panel__toolbar .pbtn--primary { width: 100%; text-align: center; padding: 14px; }

  .pitem {
    grid-template-columns: 72px 1fr;
    gap: 12px;
    padding: 12px 14px;
  }
  .pitem__img { width: 72px; height: 58px; border-radius: 10px; }
  .pitem__info h3 { font-size: .98rem; }
  .pitem__info p { font-size: .78rem; }
  .pitem__btns {
    grid-column: 1 / -1;
    flex-direction: row;
    gap: 8px;
  }
  .pitem__btns .pbtn { flex: 1; text-align: center; padding: 11px 10px; font-size: .82rem; }

  .ggrid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .gcell { border-radius: 14px; }
  .gcell__del { width: 38px; height: 38px; }

  /* модал как нижняя шторка */
  .modal { padding: 0; align-items: flex-end; }
  .modal__card {
    width: 100%;
    max-height: 90dvh;
    border-radius: 24px 24px 0 0;
    padding: 26px 20px calc(22px + env(safe-area-inset-bottom));
  }
  .modal__card h2 { font-size: 1.25rem; margin-bottom: 16px; }
  /* 16px, чтобы iOS не зумил при фокусе */
  .modal__card input,
  .modal__card textarea { font-size: 16px; padding: 13px 14px; }
  .modal__row { position: sticky; bottom: 0; background: var(--white); padding-top: 8px; }
  .modal__row .pbtn { padding: 15px; }
}

@media (max-width: 340px) {
  .ggrid { grid-template-columns: 1fr; }
}
