/* =====================================================================
   PublishPages Admin — GALLERY MANAGER styles
   Scoped with the .ga- prefix so nothing else in the panel is affected.
===================================================================== */

.ga {
  --ga-ink: #0f172a;
  --ga-ink-2: #475569;
  --ga-ink-3: #94a3b8;
  --ga-line: #e5e7eb;
  --ga-soft: #f8fafc;
  --ga-accent: var(--primary, #ff7a3d);
  --ga-accent-2: #e63980;
  --ga-ring: linear-gradient(135deg, #ff9f1c 0%, #e63980 55%, #7c3aed 100%);
}

/* ---------- header ---------- */
.ga-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 22px;
}
.ga-header-text p a { color: var(--ga-accent); font-weight: 600; text-decoration: none; }
.ga-header-text p a:hover { text-decoration: underline; }
.ga-header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.ga-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--ga-line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ga-ink-2);
  white-space: nowrap;
}
.ga-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ga-ink-3); flex: 0 0 auto; }
.ga-live[data-state="live"] { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.ga-live[data-state="live"] .ga-live-dot { background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); animation: gaPulse 2s infinite; }
.ga-live[data-state="pending"] { color: #92400e; border-color: #fde68a; background: #fffbeb; }
.ga-live[data-state="pending"] .ga-live-dot { background: #f59e0b; animation: gaBlink 1s infinite; }
.ga-live[data-state="offline"] { color: #64748b; }
.ga-live[data-state="error"] { color: #991b1b; border-color: #fecaca; background: #fef2f2; }
.ga-live[data-state="error"] .ga-live-dot { background: #ef4444; }
@keyframes gaPulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
@keyframes gaBlink { 50% { opacity: .35; } }

/* ---------- tabs ---------- */
.ga-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  margin-bottom: 4px;
  scrollbar-width: none;
}
.ga-tabs::-webkit-scrollbar { display: none; }
.ga-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--ga-line);
  background: #fff;
  color: var(--ga-ink-2);
  font-weight: 600;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s, color .2s, transform .15s;
}
.ga-tab i { font-size: 16px; }
.ga-tab b {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--ga-soft);
  border: 1px solid var(--ga-line);
  font-size: 12px;
  color: var(--ga-ink-2);
  text-align: center;
}
.ga-tab:hover { border-color: #fdba74; color: var(--ga-ink); }
.ga-tab:active { transform: scale(.97); }
.ga-tab.active {
  color: #fff;
  border-color: transparent;
  background: var(--ga-accent);
  box-shadow: 0 8px 20px rgba(255, 122, 61, .28);
}
.ga-tab.active b { background: rgba(255, 255, 255, .22); border-color: transparent; color: #fff; }

/* ---------- panel + toolbar ---------- */
.ga-panel { border-radius: 16px; overflow: hidden; }
.ga-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--ga-line);
  background: #fff;
}
.ga-search { position: relative; flex: 1 1 240px; }
.ga-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ga-ink-3); pointer-events: none; }
.ga-search .form-control { padding-left: 36px; }
#ga-filter { flex: 0 1 200px; }
.ga-add-btn { flex: 0 0 auto; white-space: nowrap; }

.ga-hint {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--ga-ink-2);
  background: var(--ga-soft);
  border-bottom: 1px solid var(--ga-line);
}
.ga-hint:empty { display: none; }
.ga-hint > i { color: #f59e0b; margin-top: 1px; }
.ga-hint em { color: var(--ga-ink-3); font-style: normal; }

/* ---------- list rows ---------- */
.ga-list { padding: 8px; min-height: 160px; background: #fff; }
.ga-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background .2s, border-color .2s, opacity .2s;
}
.ga-row + .ga-row { margin-top: 2px; }
.ga-row:hover { background: var(--ga-soft); border-color: var(--ga-line); }
.ga-row.is-hidden .ga-thumb,
.ga-row.is-hidden .ga-row-main { opacity: .5; }
.ga-ghost { opacity: .35; background: #fff7ed !important; border: 1px dashed #fdba74 !important; }
.ga-chosen { box-shadow: 0 12px 30px rgba(15, 23, 42, .12); background: #fff; }

.ga-handle {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ga-ink-3);
  cursor: grab;
  font-size: 18px;
}
.ga-handle:hover, .ga-handle:focus-visible { color: var(--ga-ink); background: #fff; outline: none; box-shadow: 0 0 0 2px #fed7aa; }
.ga-handle:active { cursor: grabbing; }
.ga-handle.is-disabled { opacity: .3; cursor: not-allowed; }

.ga-thumb {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f1f5f9;
  color: var(--ga-ink-3);
  font-weight: 800;
}
.ga-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ga-thumb-story { width: 48px; height: 84px; border-radius: 10px; }
.ga-thumb-story::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08); }
.ga-thumb-badge {
  position: absolute; left: 4px; bottom: 4px;
  display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 6px;
  background: rgba(15, 23, 42, .78); color: #fff; font-size: 11px;
}
.ga-thumb-round { width: 52px; height: 52px; border-radius: 50%; padding: 2px; background: var(--ga-ring); }
.ga-thumb-round img { border-radius: 50%; border: 2px solid #fff; }
.ga-thumb-round.ga-initials { color: #fff; font-size: 16px; }
.ga-thumb-square { width: 56px; height: 56px; border-radius: 12px; border-bottom: 3px solid var(--acc, #ff9f1c); }
.ga-thumb-square .ga-initials { color: var(--acc, #ff9f1c); font-size: 18px; }
.ga-thumb-book { width: 44px; height: 62px; border-radius: 4px 8px 8px 4px; box-shadow: 0 6px 14px rgba(15, 23, 42, .15); font-size: 20px; }

.ga-row-main { flex: 1 1 auto; min-width: 0; }
.ga-row-title { font-weight: 700; color: var(--ga-ink); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ga-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ga-ink-2);
}
.ga-row-meta i { opacity: .7; }
.ga-row-desc {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ga-ink-3);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ga-row-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.ga-row-actions .form-switch .form-check-input { width: 2.4em; height: 1.3em; cursor: pointer; margin: 0 6px 0 0; float: none; }
.ga-row-actions .form-check-input:checked { background-color: #22c55e; border-color: #22c55e; }

.ga-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--ga-ink-2);
  border: 1px solid #e2e8f0;
}
.ga-chip-tag { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.ga-chip-ok { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.ga-chip-feat { background: #0f172a; color: #fff; border-color: #0f172a; }
.ga-chip-feat i { color: #ff9f1c; opacity: 1 !important; }
.ga-chip-hidden { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.ga-chip-muted { background: #f8fafc; color: #64748b; }
.ga-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--acc); margin-right: -6px; }
.ga-stars { color: #f59e0b; letter-spacing: 1px; font-size: 13px; }
.ga-stars i { color: #e2e8f0; font-style: normal; opacity: 1 !important; }

/* ---------- empty / error ---------- */
.ga-empty { text-align: center; padding: 56px 20px; color: var(--ga-ink-2); }
.ga-empty > i {
  display: inline-grid; place-items: center;
  width: 72px; height: 72px; border-radius: 22px;
  font-size: 32px; color: #fff;
  background: var(--ga-ring);
  box-shadow: 0 14px 30px rgba(230, 57, 128, .25);
  margin-bottom: 16px;
}
.ga-empty h3 { font-size: 18px; font-weight: 800; color: var(--ga-ink); margin-bottom: 6px; }
.ga-empty p { max-width: 440px; margin: 0 auto; }
.ga-empty small { color: var(--ga-ink-3); }
.ga-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.ga-empty-sm { padding: 36px 20px; }
.ga-empty-sm > i { width: auto; height: auto; background: none; box-shadow: none; color: var(--ga-ink-3); font-size: 26px; margin-bottom: 6px; }
.ga-error {
  display: flex; gap: 14px; align-items: flex-start;
  margin: 12px; padding: 18px; border-radius: 12px;
  background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d;
}
.ga-error > i { font-size: 26px; }
.ga-error p { margin: 4px 0 10px; font-size: 14px; }

/* ---------- settings tab ---------- */
.ga-settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 20px; padding: 14px; }
.ga-settings-form { padding: 6px; }
.ga-howto { padding: 18px 20px; border-radius: 14px; background: var(--ga-soft); border: 1px solid var(--ga-line); font-size: 13.5px; color: var(--ga-ink-2); }
.ga-howto ul { padding-left: 18px; margin: 10px 0 0; }
.ga-howto li + li { margin-top: 8px; }

/* ---------- modal + form ---------- */
.ga-modal .modal-content { border-radius: 18px; border: 0; }
.ga-modal .modal-header { border-bottom-color: var(--ga-line, #e5e7eb); }
.ga-modal .modal-footer { gap: 10px; }
.ga-modal .form-label { font-weight: 600; font-size: 14px; color: #334155; }
.ga-progress { flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; min-width: 160px; margin-right: auto; }
.ga-progress .progress { height: 6px; border-radius: 999px; }
.ga-progress .progress-bar { background: linear-gradient(90deg, #ff9f1c, #e63980); transition: width .2s; }
.ga-progress small { color: #64748b; font-size: 12px; }

.ga-seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: #f1f5f9; }
.ga-seg .btn { border: 0; border-radius: 9px; font-weight: 600; font-size: 14px; color: #475569; padding: 7px 14px; }
.ga-seg .btn-check:checked + .btn { background: #fff; color: #0f172a; box-shadow: 0 2px 8px rgba(15, 23, 42, .1); }
.ga-seg .btn i { margin-right: 4px; }
.ga-seg .btn-check:checked + .btn .bi-youtube { color: #ef4444; }
.ga-seg .btn-check:checked + .btn .bi-image { color: #7c3aed; }
.ga-yt-status code { font-size: 12px; color: #0f172a; background: #f1f5f9; padding: 1px 6px; border-radius: 6px; }
.ga-switch .form-check-input { cursor: pointer; }
.ga-switch .form-check-input:checked { background-color: #22c55e; border-color: #22c55e; }

.ga-details { border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px 14px; }
.ga-details summary { cursor: pointer; font-weight: 600; font-size: 14px; color: #334155; }
.ga-details[open] summary { margin-bottom: 10px; }
.ga-details .ga-img > .form-label { display: none; }

/* image widget */
.ga-img-drop {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  padding: 0;
}
.ga-img-square .ga-img-drop { aspect-ratio: 1 / 1; }
.ga-img-portrait .ga-img-drop { aspect-ratio: 9 / 16; max-height: 360px; max-width: 210px; }
.ga-img-book .ga-img-drop { aspect-ratio: 2 / 3; max-width: 240px; }
.ga-img-drop:hover, .ga-img-drop.drag { border-color: var(--primary, #ff7a3d); background: #fff7ed; }
.ga-img-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.ga-img-drop.has-img { border-style: solid; border-color: #e5e7eb; }
.ga-img-drop.has-img .ga-img-preview { display: block; }
.ga-img-drop.has-img .ga-img-empty { display: none; }
.ga-img-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; color: #64748b; text-align: center; }
.ga-img-empty i { font-size: 30px; color: var(--primary, #ff7a3d); }
.ga-img-empty b { color: #0f172a; font-size: 14px; }
.ga-img-empty small { font-size: 12px; }
.ga-img-change {
  position: absolute; right: 8px; bottom: 8px;
  display: none; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(15, 23, 42, .78); color: #fff; font-size: 12px; font-weight: 600;
}
.ga-img-drop.has-img:hover .ga-img-change { display: inline-flex; }
.ga-img-bar { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; }
.ga-img-info { color: #64748b; font-size: 12px; line-height: 1.4; }

/* rating */
.ga-rating { display: flex; align-items: center; gap: 2px; }
.ga-star { border: 0; background: none; font-size: 28px; line-height: 1; color: #e2e8f0; padding: 0 2px; transition: transform .12s, color .12s; }
.ga-star.on { color: #f59e0b; }
.ga-star:hover { transform: scale(1.15); }

/* accent swatches */
.ga-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ga-swatch { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #fff; background: var(--c); box-shadow: 0 0 0 1px #e2e8f0; transition: transform .15s; }
.ga-swatch:hover { transform: scale(1.1); }
.ga-swatch.on { box-shadow: 0 0 0 2px var(--c); }
.ga-swatches .form-control-color { width: 40px; height: 32px; padding: 3px; border-radius: 8px; }

/* live preview (story) */
.ga-preview-label { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #94a3b8; margin-bottom: 10px; text-align: center; }
.ga-phone {
  width: 230px;
  margin: 0 auto;
  padding: 8px;
  border-radius: 34px;
  background: #0f172a;
  box-shadow: 0 30px 60px rgba(15, 23, 42, .25), inset 0 0 0 2px #334155;
  position: sticky;
  top: 0;
}
.ga-phone-screen { position: relative; aspect-ratio: 9 / 16; border-radius: 26px; overflow: hidden; background: #1e293b; color: #fff; }
.ga-phone-bg { position: absolute; inset: -20px; background-size: cover; background-position: center; filter: blur(18px) saturate(1.3) brightness(.7); }
.ga-phone-media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.ga-phone-media img { width: 100%; height: 100%; object-fit: cover; }
.ga-phone.is-landscape .ga-phone-media img { height: auto; aspect-ratio: 16 / 9; }
.ga-phone.is-photo .ga-phone-media img { object-fit: contain; }
.ga-phone.is-empty .ga-phone-media img { display: none; }
.ga-phone.is-empty .ga-phone-screen { background: linear-gradient(160deg, #ff9f1c, #e63980 55%, #7c3aed); }
.ga-phone-bars { position: absolute; top: 9px; left: 9px; right: 9px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .35); }
.ga-phone-bars span { display: block; width: 35%; height: 100%; border-radius: inherit; background: #fff; }
.ga-phone-head { position: absolute; top: 18px; left: 10px; right: 10px; display: flex; align-items: center; gap: 7px; text-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.ga-phone-av { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-size: 10px; font-weight: 800; background: linear-gradient(135deg, #ff9f1c, #e63980); border: 1.5px solid #fff; }
.ga-phone-av img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.ga-phone-who { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.ga-phone-who b { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ga-phone-who small { font-size: 9.5px; opacity: .8; }
.ga-phone-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #ff9f1c, #e63980); box-shadow: 0 8px 20px rgba(230, 57, 128, .45); font-size: 20px; }
.ga-phone.is-photo .ga-phone-play, .ga-phone.is-empty .ga-phone-play { display: none; }
.ga-phone-foot { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 12px 14px; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .72)); }
.ga-phone-foot b { display: block; font-size: 12.5px; line-height: 1.25; }
.ga-phone-foot p { margin: 4px 0 0; font-size: 10.5px; line-height: 1.4; opacity: .9; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- toasts ---------- */
.ga-toasts {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(440px, calc(100vw - 24px));
  transform: translateX(-50%);
  pointer-events: none;
}
.ga-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .3);
  transform: translateY(-12px);
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
  pointer-events: auto;
}
.ga-toast.show { transform: none; opacity: 1; }
.ga-toast > i { font-size: 17px; margin-top: 1px; }
.ga-toast-success > i { color: #4ade80; }
.ga-toast-error { background: #7f1d1d; }
.ga-toast-error > i { color: #fecaca; }
.ga-toast-info > i { color: #93c5fd; }
.ga-toast .spinner-border { margin-top: 3px; color: #fdba74; }
.ga-toast-msg { flex: 1 1 auto; line-height: 1.45; }
.ga-toast-x { border: 0; background: none; color: rgba(255, 255, 255, .6); font-size: 20px; line-height: 1; padding: 0 2px; }
.ga-toast-x:hover { color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 991.98px) {
  .ga-settings { grid-template-columns: 1fr; }
  .ga-phone { width: 200px; position: static; }
}
@media (max-width: 767.98px) {
  .ga-header-actions { width: 100%; justify-content: space-between; }
}
@media (max-width: 575.98px) {
  .ga-toolbar { padding: 12px; }
  #ga-filter { flex: 1 1 auto; }
  .ga-add-btn { flex: 1 1 100%; }
  .ga-row { flex-wrap: wrap; gap: 10px 12px; padding: 12px 8px; border-color: var(--ga-line); margin-bottom: 8px; }
  .ga-row + .ga-row { margin-top: 0; }
  .ga-row-main { flex: 1 1 calc(100% - 140px); }
  .ga-row-title { white-space: normal; }
  .ga-row-actions { flex: 1 1 100%; justify-content: flex-end; padding-top: 8px; border-top: 1px dashed var(--ga-line); }
  .ga-tab { padding: 9px 13px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .ga-live-dot { animation: none !important; }
  .ga-toast, .ga-tab, .ga-row { transition: none; }
}
