/* Holy Smocks admin — client-friendly portal */

:root {
  --hs-primary: #1c3062;
  --hs-primary-dark: #152448;
  --hs-secondary: #f17d06;
  --hs-bg: #f4f7fa;
  --hs-surface: #ffffff;
  --hs-text: #1a1a2e;
  --hs-muted: #5a5a6e;
  --hs-border: rgba(79, 107, 193, 0.15);
  --hs-radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  color: var(--hs-text);
  background: var(--hs-bg);
  line-height: 1.55;
}

a { color: var(--hs-primary); }

.admin-app { min-height: 100vh; }

.admin-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
  /* Without start alignment, the sidebar grid cell stretches to full page
     height and position:sticky has nowhere to stick. */
  align-items: start;
}

.admin-sidebar {
  background: var(--hs-primary);
  color: #fff;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: sticky;
  top: 0;
  align-self: start;
  width: 220px;
  height: 100vh;
  max-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 20;
}

.admin-brand {
  font-family: "Playlist Script", cursive;
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
  line-height: 1;
}

.admin-brand-sub {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  opacity: 0.85;
}

.admin-nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }

.admin-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  min-height: 44px;
}

.admin-nav-link:hover,
.admin-nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 1px;
}

.admin-nav-link.is-active { background: rgba(255, 255, 255, 0.22); font-weight: 700; }

.admin-badge {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--hs-secondary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-sidebar-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.admin-signed-in {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  opacity: 0.85;
  word-break: break-word;
}

.admin-main {
  min-width: 0;
  min-height: 100vh;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--hs-surface);
  border-bottom: 1px solid var(--hs-border);
}

.admin-page-title {
  margin: 0;
  font-family: "Playlist Script", cursive;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--hs-primary);
}

.admin-content { padding: 1.5rem; }

.msg {
  margin: 0 1.5rem;
  padding: 0.85rem 1rem;
  border-radius: var(--hs-radius);
  font-size: 0.95rem;
}

.msg-ok { background: #e8f5ec; border: 1px solid #9fd4ad; color: #1a5c32; }
.msg-err { background: #fdecea; border: 1px solid #e8b4ad; color: #8b2e24; }

.card {
  background: var(--hs-surface);
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.card-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--hs-primary);
}

.section-tag {
  font: 600 0.7rem/1 ui-monospace, monospace;
  color: var(--hs-muted);
  background: #eef1f8;
  border: 1px dashed #c8cfe0;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--hs-surface);
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius);
  padding: 1rem;
}

.stat-label {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--hs-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--hs-primary);
  line-height: 1;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.quick-card {
  display: block;
  padding: 1rem;
  background: var(--hs-surface);
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius);
  text-decoration: none;
  color: inherit;
  min-height: 44px;
}

.quick-card:hover,
.quick-card:focus-visible {
  border-color: var(--hs-primary);
  outline: 2px solid rgba(79, 107, 193, 0.25);
  outline-offset: 1px;
}

.quick-card strong { display: block; margin-bottom: 0.25rem; color: var(--hs-primary); }
.quick-card span { font-size: 0.9rem; color: var(--hs-muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0.6rem 1.1rem;
  border-radius: var(--hs-radius);
  border: none;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary { background: var(--hs-secondary); color: #fff; }
.btn-primary:hover { background: #ae220b; }

.btn-brand { background: var(--hs-primary); color: #fff; }
.btn-brand:hover { background: var(--hs-primary-dark); }

.btn-ghost {
  background: transparent;
  color: var(--hs-primary);
  border: 1px solid var(--hs-border);
}

.btn-ghost:hover { background: #eef1f8; }

.btn-danger { background: #fff; color: #a32; border: 1px solid #e8b4ad; }

label {
  display: block;
  margin: 0 0 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.95rem;
  min-height: 44px;
  background: #fff;
}

textarea { min-height: 120px; resize: vertical; line-height: 1.5; }

.form-row { margin-bottom: 1rem; }

.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: stretch;
}

.field-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.field-label {
  display: block;
  margin: 0 0 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.field-sync-height {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  box-sizing: border-box;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.field-current-display {
  background: #f7f9fc;
  color: var(--hs-text);
  cursor: default;
}

.field-current-display[readonly] {
  opacity: 1;
}

.field-pane--edit .field-sync-height {
  background: #fff;
  min-height: 44px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.pane-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--hs-muted);
}

.current-box {
  background: #f7f9fc;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  padding: 0.75rem;
  min-height: 3rem;
  white-space: pre-wrap;
  font-size: 0.92rem;
}

.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.page-tab {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--hs-border);
  background: #fff;
  color: var(--hs-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.page-tab.is-active {
  background: var(--hs-primary);
  border-color: var(--hs-primary);
  color: #fff;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 1rem;
  align-items: start;
}

.editor-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.editor-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  background: var(--hs-surface);
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius);
  position: sticky;
  top: 0.5rem;
  z-index: 5;
}

.editor-section-nav__label {
  width: 100%;
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hs-muted);
}

.editor-section-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--hs-border);
  background: #fff;
  color: var(--hs-text);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
}

.editor-section-nav a:hover,
.editor-section-nav a:focus-visible {
  border-color: var(--hs-primary);
  color: var(--hs-primary);
  outline: none;
}

.editor-section-nav a.is-active {
  background: var(--hs-primary);
  border-color: var(--hs-primary);
  color: #fff;
}

.editor-section-card {
  scroll-margin-top: 6rem;
}

.editor-section-card.is-active-section {
  box-shadow: 0 0 0 2px rgba(46, 74, 138, 0.28);
}

.preview-card {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0.75rem;
  max-height: calc(100vh - 1.5rem);
  background: var(--hs-surface);
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius);
  overflow: hidden;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.65rem 0.85rem;
  background: #eef1f8;
  border-bottom: 1px solid var(--hs-border);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--hs-muted);
  flex: 0 0 auto;
}

.preview-head__meta {
  font-weight: 500;
  color: var(--hs-muted);
  font-size: 0.75rem;
}

.preview-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 420px;
  height: calc(100vh - 4.5rem);
  border: 0;
  display: block;
  background: #fff;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  border: 1px solid var(--hs-border);
  padding: 0.65rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

th { background: #eef1f8; font-weight: 700; }

table th.is-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

table th.is-sortable:hover,
table th.is-sortable:focus-visible {
  color: var(--hs-primary);
  outline: none;
}

table th.is-sortable::after {
  content: '\2195';
  display: inline-block;
  margin-left: 0.35em;
  opacity: 0.45;
  font-size: 0.9em;
}

table th.is-sorted-asc::after {
  content: '\2191';
  opacity: 1;
}

table th.is-sorted-desc::after {
  content: '\2193';
  opacity: 1;
}

table .table-filter-row td {
  padding: 0.4rem 0.75rem 0.75rem;
  background: #eef1f8;
  border: 1px solid var(--hs-border);
  vertical-align: middle;
}

table .table-filter-row input {
  width: 100%;
  box-sizing: border-box;
  min-height: 36px;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.88rem;
  background: #fff;
}

table .table-filter-row input:focus {
  outline: 2px solid rgba(28, 48, 98, 0.25);
  outline-offset: 1px;
  border-color: var(--hs-primary);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.media-thumb {
  aspect-ratio: 4 / 3;
  background: #eef1f8;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  overflow: hidden;
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-caption {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--hs-muted);
  word-break: break-all;
}

.media-library-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.media-dropzone {
  position: relative;
  display: block;
  border: 2px dashed var(--hs-border);
  border-radius: 10px;
  background: #f8f9fc;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.media-dropzone:hover,
.media-dropzone:focus-visible,
.media-dropzone.is-dragover {
  border-color: var(--hs-primary);
  background: #eef2fb;
  outline: none;
}

.media-dropzone__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.media-dropzone__body {
  pointer-events: none;
}

.media-dropzone__title {
  margin: 0 0 0.35rem;
  font-weight: 700;
  color: var(--hs-text);
}

.media-dropzone__sub {
  margin: 0;
  font-size: 0.9rem;
  color: var(--hs-muted);
}

.media-dropzone__files {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--hs-primary);
  font-weight: 600;
  word-break: break-word;
}

.media-dropzone.is-uploading {
  opacity: 0.65;
  pointer-events: none;
}

.media-preview__label {
  margin: 0 0 0.65rem;
  font-weight: 700;
}

.media-preview-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}

.media-preview-card {
  border: 1px solid var(--hs-border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.media-preview-card__frame {
  aspect-ratio: 4 / 3;
  background: #e8ebf3;
  overflow: hidden;
}

.media-preview-card__frame img,
.media-preview-card__frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #e8ebf3;
}

.media-preview-card__body {
  padding: 0.65rem 0.7rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.media-preview-card__name {
  margin: 0;
  font-size: 0.75rem;
  color: var(--hs-muted);
  word-break: break-all;
}

.media-preview-card__alt-label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
}

.media-preview-card__event {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  color: inherit;
}

.media-preview-card__body input[type="text"] {
  width: 100%;
  min-height: 40px;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  font: inherit;
}

.media-preview-card__decorative {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
}

.media-preview-card__body .field-hint {
  margin: 0;
  font-size: 0.75rem;
}

.media-alt-gate {
  margin-top: 0.65rem;
  color: #8a3b12;
}

.btn-primary:disabled,
.btn-primary[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.media-upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(16, 24, 48, 0.55);
}

.media-upload-overlay[hidden] {
  display: none !important;
}

.media-upload-overlay__panel {
  width: min(26rem, 100%);
  padding: 1.5rem 1.35rem;
  border-radius: 12px;
  background: #fff;
  text-align: center;
  box-shadow: 0 12px 40px rgba(16, 24, 48, 0.28);
}

.media-upload-overlay__spinner {
  width: 2.25rem;
  height: 2.25rem;
  margin: 0 auto 1rem;
  border: 3px solid #d7dceb;
  border-top-color: var(--hs-primary);
  border-radius: 50%;
  animation: media-upload-spin 0.8s linear infinite;
}

.media-upload-overlay__title {
  margin: 0 0 0.45rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--hs-text);
}

.media-upload-overlay__sub {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--hs-muted);
}

body.is-media-uploading {
  overflow: hidden;
}

@keyframes media-upload-spin {
  to { transform: rotate(360deg); }
}

.media-library-card {
  border: 1px solid var(--hs-border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.media-library-card__preview {
  aspect-ratio: 4 / 3;
  background: #e8ebf3;
  overflow: hidden;
  position: relative;
}

.media-library-card__preview img,
.media-library-card__preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #e8ebf3;
}

.media-library-card__preview--video video {
  position: relative;
  z-index: 1;
  background: transparent;
}

.media-preview-card__frame--video {
  position: relative;
  background: #1c3062;
}

.media-video-thumb-source {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.media-video-poster {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #e8ebf3;
}

.media-video-badge {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  z-index: 2;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: rgba(16, 24, 48, 0.75);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.media-video-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.75rem;
  text-align: center;
  background: linear-gradient(160deg, #1c3062 0%, #314a7a 100%);
  color: #fff;
}

.media-library-card__preview.has-poster .media-video-fallback {
  display: none;
}

.media-video-fallback__icon {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.95rem;
  line-height: 1;
  padding-left: 0.15rem;
}

.media-video-fallback__label {
  font-weight: 700;
  font-size: 0.95rem;
}

.media-video-fallback__hint {
  font-size: 0.75rem;
  line-height: 1.35;
  opacity: 0.85;
  max-width: 16rem;
}

.media-library-card__meta {
  padding: 0.75rem;
}

.media-library-card__meta p {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
}

.media-library-card__kind {
  margin: 0;
  font-size: 0.72rem !important;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hs-muted);
}

.media-library-card__tag {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
}

.media-library-card__tag--empty {
  color: var(--hs-muted);
}

.media-library-card__contact-form {
  margin-top: 0.45rem;
}

.library-filters {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--hs-border);
  border-radius: 8px;
  background: #f8f9fc;
}

.library-filters__row {
  display: grid;
  grid-template-columns: minmax(12rem, 1.6fr) repeat(4, minmax(8rem, 1fr)) auto;
  gap: 0.65rem 0.75rem;
  align-items: end;
}

.library-filters__field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.library-filters__field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--hs-muted);
}

.library-filters__field input,
.library-filters__field select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  color: inherit;
}

.library-filters__field--actions {
  justify-content: flex-end;
}

.library-filters__status {
  margin: 0.55rem 0 0;
}

.library-filters__empty {
  margin: 0.5rem 0 0;
  color: var(--hs-muted);
}

.library-view-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.library-view-bar .library-filters__status {
  margin: 0;
}

.library-view-toggle {
  display: inline-flex;
  border: 1px solid var(--hs-border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.library-view-toggle__btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--hs-muted);
  cursor: pointer;
}

.library-view-toggle__btn + .library-view-toggle__btn {
  border-left: 1px solid var(--hs-border);
}

.library-view-toggle__btn[aria-pressed="true"] {
  background: var(--hs-primary, #1c3062);
  color: #fff;
}

.library-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--hs-border);
  border-radius: 8px;
  background: #fff;
}

.library-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.library-table th,
.library-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--hs-border);
  text-align: left;
  vertical-align: middle;
}

.library-table th {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hs-muted);
  background: #f5f7fb;
  white-space: nowrap;
}

.library-table tbody tr:last-child td {
  border-bottom: 0;
}

.library-table__thumb-cell {
  width: 3.5rem;
}

.library-table__thumb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  background: #e8ebf3;
  cursor: zoom-in;
  overflow: hidden;
}

.library-table__thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  display: block;
}

.library-table__thumb--video {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1c3062;
  color: #fff;
  font-size: 0.95rem;
}

.library-table__title {
  display: block;
  font-weight: 600;
  max-width: 18rem;
}

.library-table__meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: #a15c00;
}

.library-table__meta--muted {
  color: var(--hs-muted, #5c6675);
}

.library-table__alt-form {
  display: grid;
  gap: 0.35rem;
  min-width: 14rem;
  max-width: 22rem;
}

.library-table__alt-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.85rem;
  background: #fff;
}

.library-table__alt-input:disabled {
  opacity: 0.65;
  background: #f3f5f7;
}

.library-table__decorative {
  margin: 0;
  font-size: 0.82rem;
}

.library-table__gallery {
  margin: 0;
  font-size: 0.82rem;
  white-space: nowrap;
}

.library-table__alt-warn {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
}

.library-table__alt-warn {
  color: #8a5a00;
}

.library-table__tag-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  min-width: 11rem;
}

.library-table__select {
  flex: 1 1 8rem;
  min-width: 0;
  max-width: 16rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.85rem;
  background: #fff;
}

.library-table__select:disabled {
  opacity: 0.7;
}

.library-table__autosave {
  flex: 0 0 auto;
  min-width: 3.25rem;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--hs-muted, #5c6675);
}

.library-table__autosave.is-ok {
  color: #1f6b3a;
}

.library-table__autosave.is-error {
  color: #9b1c1c;
}

.library-table__save {
  min-height: auto !important;
  padding: 0.3rem 0.55rem !important;
  font-size: 0.8rem !important;
}

.library-table__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.library-lightbox-trigger--fill {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.library-lightbox-trigger--fill img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.library-lightbox-trigger--overlay {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  z-index: 3;
  min-height: auto;
  padding: 0.25rem 0.5rem;
  border: 0;
  border-radius: 4px;
  background: rgba(16, 24, 48, 0.8);
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: zoom-in;
}

.library-lightbox {
  width: min(92vw, 960px);
  max-width: 96vw;
  padding: 0;
  border: 1px solid var(--hs-border);
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
}

.library-lightbox::backdrop {
  background: rgba(8, 12, 24, 0.72);
}

.library-lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.06);
}

.library-lightbox__caption {
  margin: 0;
  font-size: 0.92rem;
}

.library-lightbox__bar .btn {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.library-lightbox__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  padding: 0.75rem;
}

.library-lightbox__stage img,
.library-lightbox__stage video {
  max-width: 100%;
  max-height: min(78vh, 820px);
  width: auto;
  height: auto;
  display: block;
  border-radius: 4px;
  background: #000;
}

@media (max-width: 1100px) {
  .library-filters__row {
    grid-template-columns: 1fr 1fr;
  }

  .library-filters__field--search,
  .library-filters__field--actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .library-filters__row {
    grid-template-columns: 1fr;
  }
}

.media-picker {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--hs-border);
  border-radius: 8px;
  background: #f8f9fc;
}

.media-picker legend {
  font-weight: 700;
  padding: 0 0.25rem;
}

.media-picker__preview {
  margin: 0.65rem 0 0.85rem;
}

.media-picker__preview img {
  display: block;
  width: 240px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--hs-border);
  background: #fff;
}

.media-library-select {
  width: 100%;
  max-width: 36rem;
}

.library-picker-field__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.35rem 0 0.65rem;
}

.library-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.library-picker-modal[hidden] {
  display: none !important;
}

.library-picker-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 48, 0.55);
}

.library-picker-modal__panel {
  position: relative;
  z-index: 1;
  width: min(56rem, 100%);
  max-height: min(88vh, 52rem);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(16, 24, 48, 0.28);
  overflow: hidden;
}

.library-picker-modal__head,
.library-picker-modal__foot,
.library-picker-modal__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--hs-border);
  background: #f8f9fc;
}

.library-picker-modal__foot {
  border-bottom: 0;
  border-top: 1px solid var(--hs-border);
}

.library-picker-modal__head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.library-picker-modal__toolbar input[type="search"] {
  flex: 1 1 14rem;
  min-height: 42px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--hs-border);
  border-radius: 8px;
  font: inherit;
}

.library-picker-modal__grid {
  flex: 1 1 auto;
  overflow: auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.85rem;
  align-content: start;
  background: #fff;
}

.library-picker-modal__empty {
  margin: 0;
  padding: 0 1rem 1rem;
  color: var(--hs-muted);
}

.library-picker-tile {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
  padding: 0.4rem;
  border: 2px solid var(--hs-border);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  min-height: 44px;
}

.library-picker-tile:hover,
.library-picker-tile:focus-visible {
  border-color: var(--hs-primary);
  outline: none;
}

.library-picker-tile.is-selected {
  border-color: var(--hs-primary);
  box-shadow: 0 0 0 2px rgba(28, 48, 98, 0.2);
}

.library-picker-tile__thumb {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
  background: #e8ebf3;
  position: relative;
}

.library-picker-tile__thumb img,
.library-picker-tile__thumb video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #111;
}

.library-picker-tile__badge {
  position: absolute;
  left: 0.4rem;
  bottom: 0.4rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(16, 24, 48, 0.8);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.media-orientation-hint {
  color: var(--hs-primary);
  font-weight: 600;
}

.media-picker__preview video {
  display: block;
  width: 240px;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--hs-border);
  background: #111;
}

.library-picker-tile__caption {
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--hs-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.is-library-picker-open {
  overflow: hidden;
}

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

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--hs-muted);
}

.admin-portal {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--hs-bg);
}

.admin-portal-main { width: 100%; max-width: 420px; }

.admin-portal-card {
  background: var(--hs-surface);
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius);
  padding: 1.5rem;
}

.admin-portal-card h1 {
  font-family: "Playlist Script", cursive;
  font-size: 2rem;
  margin: 0 0 0.5rem;
  color: var(--hs-primary);
}

.admin-portal-card p { margin: 0 0 1rem; color: var(--hs-muted); }

.row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

.hs-richtext {
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius);
  background: #fff;
  overflow: hidden;
}

.hs-richtext__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem;
  border-bottom: 1px solid var(--hs-border);
  background: #eef1f8;
}

.hs-richtext__btn {
  min-height: 36px;
  min-width: 36px;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  background: #fff;
  color: var(--hs-text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.hs-richtext__btn:hover,
.hs-richtext__btn:focus-visible {
  border-color: var(--hs-primary);
  color: var(--hs-primary);
  outline: none;
}

.hs-richtext__editor {
  min-height: 10rem;
  padding: 0.85rem 1rem;
  font: inherit;
  line-height: 1.55;
  color: var(--hs-text);
}

.hs-richtext__editor--compact {
  min-height: 5.5rem;
}

.hs-richtext__editor--tall {
  min-height: 16rem;
}

.hs-richtext__editor:focus {
  outline: 2px solid rgba(28, 48, 98, 0.25);
  outline-offset: -2px;
}

.hs-richtext__editor p {
  margin: 0 0 0.75rem;
}

.hs-richtext__editor ul,
.hs-richtext__editor ol {
  margin: 0 0 0.75rem;
  padding-left: 1.35rem;
}

.hs-richtext__editor li {
  margin: 0.2rem 0;
}

.hs-richtext__editor a {
  color: var(--hs-primary);
}

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    position: static;
    align-self: stretch;
    width: auto;
    height: auto;
    max-height: none;
    overflow-y: visible;
  }
  .admin-nav { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .admin-sidebar-foot { width: 100%; }
  .editor-layout { grid-template-columns: 1fr; }
  .preview-card {
    position: static;
    max-height: none;
    min-height: 0;
  }
  .preview-frame { min-height: 50vh; height: 60vh; }
  .editor-section-nav { position: static; }
  .field-pair { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
}
