/* หน้าจัดการรูปภาพ ใช้สีและปุ่มชุดเดียวกับหน้าเว็บวันเกิด (css/style.css) */
body.admin {
  padding-left: max(16px, var(--safe-left));
  padding-right: max(16px, var(--safe-right));
  padding-bottom: calc(var(--safe-bottom) + 120px);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.admin-header {
  max-width: 760px;
  margin: 0 auto;
  padding-top: calc(var(--safe-top) + 14px);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}
.admin-header .btn { font-size: .95rem; padding: .55rem 1.1rem; }

.admin-main {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 18px;
}
.admin-intro { text-align: center; padding-block: 8px 4px; }
.admin-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 6.5vw, 2.1rem);
  line-height: 1.3;
  text-wrap: balance;
}
.admin-lead { margin: .4rem auto 0; max-width: 34rem; color: var(--ink-soft); text-wrap: pretty; }
.loading-note { text-align: center; color: var(--ink-soft); }

.card {
  background: var(--paper);
  border: 1px solid var(--gold-soft);
  border-radius: 14px;
  padding: clamp(16px, 4vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.card-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
}
.count { font-family: var(--font-body); font-size: .95rem; color: var(--ink-soft); font-weight: 500; }
.muted { margin: 0; color: var(--ink-soft); }
.small { font-size: .92rem; }

label { font-weight: 600; font-size: .98rem; }
input[type="password"], input[type="url"], input[type="text"], textarea {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: .65rem .85rem;
  font: inherit;
  font-size: 1rem; /* 16px ขึ้นไป: iPhone จะไม่ซูมอัตโนมัติ */
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--sand);
  border-radius: 10px;
}
textarea { resize: vertical; line-height: 1.5; min-height: 64px; }
input:focus-visible, textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--latte); }

.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-form .btn { align-self: flex-start; }
.password-row { display: flex; gap: 8px; }
.password-row input { flex: 1 1 auto; }
.login-form .password-row .btn { align-self: stretch; flex: none; min-width: 72px; padding: 0 1rem; }

.form-msg { margin: 0; font-size: .95rem; line-height: 1.5; }
.form-msg:empty { display: none; }
.form-msg.is-error { color: #a33a22; }
.form-msg.is-ok { color: #2f6b3a; }

.notice {
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 1.55;
}
.notice-error { background: #fbeee9; border: 1px solid #e8b9a8; color: #7e2f1c; }
.notice ul { margin: .3rem 0 0; padding-left: 1.2rem; }

/* พื้นที่เลือกไฟล์ */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 22px 16px;
  text-align: center;
  border: 2px dashed var(--latte);
  border-radius: 12px;
  background: #fbf3e4;
  cursor: pointer;
  font-weight: 400;
}
.dropzone:hover, .dropzone.is-over { background: #f7ead3; }
.dropzone:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.dz-title { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; color: var(--ink); }
.dz-hint { font-size: .9rem; color: var(--ink-soft); line-height: 1.5; }

.empty-note { margin: 0; color: var(--ink-soft); text-align: center; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* รายการรูป */
.photo-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pitem {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--sand);
  border-radius: 12px;
  background: #fffefb;
}
.pitem.is-error { border-color: #e8b9a8; background: #fdf6f3; }
.pthumb {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--sand);
  display: grid;
  place-items: center;
}
.pthumb img { width: 100%; height: 100%; object-fit: contain; }
.pbody { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.pnum {
  font-family: var(--font-display);
  font-weight: 600;
  min-width: 2ch;
}
.badge {
  font-size: .82rem;
  padding: .1rem .55rem;
  border-radius: 999px;
  background: var(--sand);
  color: var(--ink);
  white-space: nowrap;
}
.badge.is-saved { background: #e5efe1; color: #2f5a35; }
.badge.is-pending { background: #f6ead2; color: #6a4e22; }
.badge.is-uploading { background: #e9e6f3; color: #3f3a68; }
.badge.is-error { background: #f6d9cf; color: #7e2f1c; }
.pname { font-size: .82rem; color: var(--ink-soft); min-width: 0; overflow-wrap: anywhere; }
.perror { margin: 0; font-size: .9rem; color: #a33a22; }
.progress { height: 6px; border-radius: 99px; background: var(--sand); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--latte); transition: width .2s; }
.pactions { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-btn {
  min-width: 44px;
  min-height: 44px;
  padding: .3rem .8rem;
  border-radius: 10px;
  border: 1.5px solid var(--gold-soft);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: .95rem;
  cursor: pointer;
  touch-action: manipulation;
}
.icon-btn:hover:not([disabled]) { background: #fff7ea; }
.icon-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.icon-btn[disabled] { opacity: .4; cursor: default; }
.icon-btn.is-danger { border-color: #e8b9a8; color: #8a321e; }
.icon-btn.is-confirm { background: #8a321e; border-color: #8a321e; color: #fff; }

@media (min-width: 560px) {
  .pitem { grid-template-columns: 132px minmax(0, 1fr); }
  .pthumb { width: 132px; height: 132px; }
}

.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
#yt-test-player { margin-top: 4px; }
.file-btn { align-self: flex-start; cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--gold); outline-offset: 3px; }
.music-file-info { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.music-preview { width: 100%; max-width: 420px; }

/* ผลการบันทึก */
.result-card { border-color: #b9d3b2; background: #fbfdf9; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.share-row input { flex: 1 1 220px; }
.share-row .btn { flex: none; text-decoration: none; display: inline-flex; align-items: center; }

/* แถบบันทึกด้านล่าง */
.save-bar {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px max(16px, var(--safe-right)) calc(var(--safe-bottom) + 10px) max(16px, var(--safe-left));
  background: rgba(255, 253, 248, .96);
  border-top: 1px solid var(--gold-soft);
  box-shadow: 0 -6px 18px rgba(74, 55, 40, .08);
}
.save-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
}
.save-status { margin: 0; flex: 1 1 200px; min-width: 0; font-size: .95rem; line-height: 1.45; color: var(--ink-soft); }
.save-status.is-error { color: #a33a22; }
.save-status.is-ok { color: #2f6b3a; }
.save-bar .btn-primary { font-size: 1rem; padding: .75rem 1.3rem; flex: 1 1 auto; max-width: 100%; }
@media (min-width: 560px) { .save-bar .btn-primary { flex: none; } }
.btn[disabled] { opacity: .55; }
