/* ============================================================
   Admin CMS overlay styles
   ============================================================ */

/* --- Toolbar --- */
.adm-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  translate: -50% 0;
  z-index: 9000;
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(9, 9, 15, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06);
}
.admin-mode .adm-bar { display: flex; }

.adm-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: oklch(0.74 0.19 350);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid oklch(0.74 0.19 350 / .3);
  background: oklch(0.74 0.19 350 / .08);
  white-space: nowrap;
}

.adm-sep { width: 1px; height: 22px; background: rgba(255,255,255,.1); margin: 0 2px; }

.adm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: #f3f1fb;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  white-space: nowrap;
  font-family: inherit;
}
.adm-btn:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); }
.adm-btn:active { transform: scale(.96); }
.adm-btn svg { flex-shrink: 0; }

.adm-btn.adm-save {
  background: oklch(0.74 0.19 350);
  border-color: oklch(0.74 0.19 350);
  color: #fff;
  font-weight: 600;
}
.adm-btn.adm-save:hover { background: oklch(0.78 0.19 350); }
.adm-btn.adm-save.saving { opacity: .6; pointer-events: none; }

.adm-btn.adm-works { color: oklch(0.85 0.14 195); border-color: oklch(0.85 0.14 195 / .3); }
.adm-btn.adm-works:hover { background: oklch(0.85 0.14 195 / .1); border-color: oklch(0.85 0.14 195 / .5); }

.adm-btn.adm-contact { color: oklch(0.86 0.18 130); border-color: oklch(0.86 0.18 130 / .3); }
.adm-btn.adm-contact:hover { background: oklch(0.86 0.18 130 / .1); border-color: oklch(0.86 0.18 130 / .5); }

.adm-btn.adm-exit { color: #9192ab; }

/* --- Editable text highlight --- */
.admin-mode [data-i18n]:not(button):not(a),
.admin-mode [data-i18n-html]:not(button):not(a) {
  cursor: text;
  border-radius: 4px;
  transition: outline .15s, background .15s;
  outline: 1.5px dashed transparent;
}
.admin-mode [data-i18n]:not(button):not(a):hover,
.admin-mode [data-i18n-html]:not(button):not(a):hover {
  outline: 1.5px dashed oklch(0.74 0.19 350 / .5);
  background: oklch(0.74 0.19 350 / .06);
}
[contenteditable="true"] {
  outline: 2px solid oklch(0.74 0.19 350) !important;
  background: oklch(0.74 0.19 350 / .1) !important;
  border-radius: 4px;
  min-width: 40px;
  min-height: 1em;
}

/* --- Password dialog --- */
.adm-dialog-overlay {
  position: fixed; inset: 0; z-index: 9100;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.adm-dialog {
  background: #11111b;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  padding: 32px;
  width: min(90vw, 380px);
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
}
.adm-dialog h2 {
  font-size: 20px;
  font-weight: 700;
  color: #f3f1fb;
  margin: 0 0 6px;
}
.adm-dialog p {
  font-size: 13px;
  color: #9192ab;
  margin: 0 0 20px;
}
.adm-input-row { display: flex; gap: 8px; }
.adm-input {
  flex: 1;
  height: 42px;
  padding: 0 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  color: #f3f1fb;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.adm-input:focus { border-color: oklch(0.74 0.19 350 / .6); }
.adm-input::placeholder { color: #9192ab; }
.adm-dialog-err {
  margin-top: 10px;
  font-size: 12.5px;
  color: oklch(0.74 0.19 350);
  min-height: 18px;
}
.adm-dialog .adm-btn { height: 42px; border-radius: 10px; }

/* --- Works panel --- */
.adm-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(90vw, 560px);
  z-index: 9050;
  background: #09090f;
  border-left: 1px solid rgba(255,255,255,.1);
  box-shadow: -20px 0 60px rgba(0,0,0,.6);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.25,.8,.25,1);
}
.adm-panel.is-open { transform: none; }
body.rtl .adm-panel { right: auto; left: 0; border-left: none; border-right: 1px solid rgba(255,255,255,.1); transform: translateX(-100%); }
body.rtl .adm-panel.is-open { transform: none; }

.adm-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.adm-panel-head h3 {
  font-size: 16px; font-weight: 700; color: #f3f1fb; margin: 0;
}
.adm-panel-close {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.07); border: none;
  cursor: pointer; color: #9192ab;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.adm-panel-close:hover { background: rgba(255,255,255,.14); color: #f3f1fb; }

.adm-panel-body {
  flex: 1; overflow-y: auto;
  padding: 16px 24px 100px;
}
.adm-panel-body::-webkit-scrollbar { width: 4px; }
.adm-panel-body::-webkit-scrollbar-track { background: transparent; }
.adm-panel-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

/* --- Add work form --- */
.adm-add-btn {
  width: 100%; height: 42px;
  border: 1.5px dashed rgba(255,255,255,.18);
  border-radius: 10px;
  background: none;
  color: oklch(0.85 0.14 195);
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-bottom: 16px;
  transition: border-color .15s, background .15s;
}
.adm-add-btn:hover { border-color: oklch(0.85 0.14 195 / .5); background: oklch(0.85 0.14 195 / .06); }

.adm-form {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}
.adm-form h4 { font-size: 13px; font-weight: 700; color: oklch(0.85 0.14 195); margin: 0 0 16px; text-transform: uppercase; letter-spacing: .08em; }
.adm-field { margin-bottom: 12px; }
.adm-field label { display: block; font-size: 11px; color: #9192ab; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .06em; }
.adm-field input, .adm-field textarea, .adm-field select {
  width: 100%; box-sizing: border-box;
  padding: 9px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  color: #f3f1fb; font-size: 13px; font-family: inherit;
  outline: none; transition: border-color .15s;
}
.adm-field input:focus, .adm-field textarea:focus, .adm-field select:focus { border-color: oklch(0.85 0.14 195 / .6); }
.adm-field textarea { resize: vertical; min-height: 60px; }
.adm-field select option { background: #11111b; }
.adm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.adm-form-actions { display: flex; gap: 8px; margin-top: 16px; }
.adm-form-actions .adm-btn { height: 36px; font-size: 12px; }
.adm-cancel-btn { background: none; border: 1px solid rgba(255,255,255,.12); color: #9192ab; }

/* --- Work item in panel --- */
.adm-work-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 4px;
  transition: background .15s;
  cursor: grab;
}
.adm-work-item:hover { background: rgba(255,255,255,.05); }
.adm-work-item:active { cursor: grabbing; }
.adm-work-item.dragging { opacity: .4; }
.adm-work-item.drag-over { background: oklch(0.85 0.14 195 / .1); outline: 1px solid oklch(0.85 0.14 195 / .3); }

.adm-work-thumb {
  width: 44px; height: 30px; border-radius: 5px;
  object-fit: cover; flex-shrink: 0;
  background: rgba(255,255,255,.08);
}
.adm-work-info { flex: 1; min-width: 0; }
.adm-work-title { font-size: 13px; font-weight: 600; color: #f3f1fb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-work-meta { font-size: 11px; color: #9192ab; margin-top: 1px; }

.adm-work-actions { display: flex; gap: 4px; flex-shrink: 0; }
.adm-work-action-btn {
  width: 28px; height: 28px; border-radius: 7px;
  background: none; border: 1px solid rgba(255,255,255,.1);
  color: #9192ab; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.adm-work-action-btn:hover { background: rgba(255,255,255,.1); color: #f3f1fb; border-color: rgba(255,255,255,.2); }
.adm-work-action-btn.del:hover { background: oklch(0.74 0.19 350 / .15); color: oklch(0.74 0.19 350); border-color: oklch(0.74 0.19 350 / .3); }

.adm-drag-handle { color: rgba(255,255,255,.2); cursor: grab; flex-shrink: 0; }
.adm-drag-handle:hover { color: rgba(255,255,255,.5); }

/* --- Section tabs in works panel --- */
.adm-tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  background: rgba(255,255,255,.04);
  border-radius: 10px; padding: 4px;
}
.adm-tab {
  flex: 1; height: 32px; border-radius: 7px;
  background: none; border: none;
  color: #9192ab; font-size: 12px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background .15s, color .15s;
}
.adm-tab.is-active { background: rgba(255,255,255,.1); color: #f3f1fb; }

/* --- Contact panel --- */
.adm-contact-form .adm-field { margin-bottom: 14px; }

/* --- Toast notification --- */
.adm-toast {
  position: fixed; bottom: 88px; left: 50%;
  translate: -50% 0;
  z-index: 9200;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s, translate .2s;
  white-space: nowrap;
}
.adm-toast.show {
  opacity: 1;
  translate: -50% 0;
}
.adm-toast.success { background: oklch(0.86 0.18 130); color: #09090f; }
.adm-toast.error { background: oklch(0.74 0.19 350); color: #fff; }

/* --- Upload poster button on film cards (admin only) --- */
.admin-mode .ha-film:not(.ha-film-soon) .ha-film-poster {
  position: relative;
}
.admin-mode .ha-film .adm-poster-upload {
  display: flex;
}
.adm-poster-upload {
  display: none;
  position: absolute; inset: 0;
  align-items: center; justify-content: center;
  background: rgba(9,9,15,.7);
  border-radius: 14px;
  opacity: 0;
  transition: opacity .2s;
  cursor: pointer;
  border: 2px dashed rgba(255,255,255,.3);
}
.ha-film:hover .adm-poster-upload { opacity: 1; }
.adm-poster-upload input[type="file"] { display: none; }
.adm-poster-upload span {
  font-size: 12px; color: #fff; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}

/* --- Edit work button on tiles (admin only) --- */
.admin-mode .ha-tile { position: relative; }
.admin-mode .ha-tile .adm-tile-edit {
  display: flex;
}
.adm-tile-edit {
  display: none;
  position: absolute; top: 6px; right: 6px; z-index: 10;
  width: 28px; height: 28px; border-radius: 7px;
  background: rgba(9,9,15,.8); border: 1px solid rgba(255,255,255,.2);
  color: #f3f1fb; cursor: pointer;
  align-items: center; justify-content: center;
  transition: background .15s;
}
.adm-tile-edit:hover { background: oklch(0.85 0.14 195); }

/* --- Poster upload button in work item --- */
.adm-work-action-btn.poster:hover {
  background: oklch(0.86 0.18 130 / .15);
  color: oklch(0.86 0.18 130);
  border-color: oklch(0.86 0.18 130 / .3);
}
.adm-work-thumb.has-custom { outline: 2px solid oklch(0.86 0.18 130 / .5); }

/* --- Poster preview in edit form --- */
.adm-poster-preview {
  position: relative;
  width: 100%; height: 120px;
  border-radius: 8px; overflow: hidden;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  margin-bottom: 8px;
}
.adm-poster-preview img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.adm-poster-custom-badge {
  position: absolute; top: 6px; right: 6px;
  background: oklch(0.86 0.18 130); color: #09090f;
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
}
.adm-poster-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- Stills editor --- */
.adm-stills-editor {
  margin-top: 4px; margin-bottom: 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px; padding: 14px;
}
.adm-stills-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.adm-stills-head label {
  display: block; font-size: 11px; color: #9192ab;
  text-transform: uppercase; letter-spacing: .06em;
}
.adm-stills-head .adm-btn { height: 28px; font-size: 11px; padding: 0 10px; }
.adm-stills-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.adm-stills-empty { font-size: 12px; color: #9192ab; padding: 8px 0; }
.adm-still-item {
  position: relative; width: 80px; height: 52px;
  border-radius: 6px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  cursor: grab; flex-shrink: 0;
  transition: outline .15s;
}
.adm-still-item:hover { outline: 2px solid oklch(0.85 0.14 195 / .5); }
.adm-still-item img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.adm-still-del {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(9,9,15,.8); border: none;
  color: #f3f1fb; font-size: 12px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.adm-still-item:hover .adm-still-del { opacity: 1; }

/* --- ha-film-still as real image --- */
.ha-film-still { border-radius: 6px; object-fit: cover; }
