/* ============================================================
   Media AI Box — Views (Cinema Atelier)
   ============================================================ */

/* ===== Home ===== */
.home {
  max-width: 1180px;
  margin: 0 auto;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-8) 0 var(--s-6);
  margin-bottom: var(--s-5);
}

.home-greeting h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.15;
}

.home-count {
  display: block;
  font-size: 13px;
  color: var(--text-3);
  margin-top: 3px;
}

/* "קבוצה חדשה" - a tonal accent button. As a plain btn-secondary it turned
   flat grey on hover, which read as disabled next to the teal the rest of the
   app uses for its actions. */
.home-new-group {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-soft-2);
  border-radius: var(--r-pill);
  font-weight: 600;
  padding: 6px 14px;
}

.home-new-group:hover:not(:disabled) {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.home-new-group:active:not(:disabled) {
  background: var(--accent-pressed);
  border-color: var(--accent-pressed);
  box-shadow: none;
  transform: none;
}

/* Empty state for Home */
.home-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--s-16) var(--s-6);
  gap: var(--s-3);
}

.home-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--accent);
  margin-bottom: var(--s-3);
  box-shadow: var(--shadow-xs);
}

.home-empty h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.home-empty p {
  font-size: 14px;
  color: var(--text-3);
  max-width: 420px;
  line-height: 1.55;
  margin-bottom: var(--s-3);
}

/* ── Cloud restore box (empty home state) ── */
.cloud-restore-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-6);
  width: 100%;
  max-width: 360px;
}

.cloud-restore-divider {
  font-size: 12px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
}

.cloud-restore-divider::before,
.cloud-restore-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.cloud-restore-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.cloud-restore-hint {
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.5;
  margin: 0 !important;
}

.cloud-restore-row {
  display: flex;
  gap: var(--s-2);
  width: 100%;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-4);
}

.project-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.project-card-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-2);
}

.project-thumb {
  aspect-ratio: 16/9;
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
}

.project-thumb-bg.media-thumb--video {
  overflow: hidden;
}

.project-thumb-bg .media-thumb-video-el,
.project-thumb-bg .media-thumb-img-el {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.project-thumb-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.3s var(--ease-out);
  overflow: hidden;
}

.project-card:hover .project-thumb-bg {
  transform: scale(1.03);
}

.project-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.2s;
}

.project-card:hover .project-thumb-overlay {
  background: rgba(0, 0, 0, 0.06);
}

.project-body {
  padding: var(--s-4);
}

.project-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 4px;
}

.project-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
  flex-wrap: wrap;
}

.meta-dot {
  color: var(--text-muted);
}

.project-delete-btn,
.project-group-btn {
  opacity: 0;
  transition: opacity 0.15s;
}

.project-card:hover .project-delete-btn,
.project-card:hover .project-group-btn {
  opacity: 1;
}

/* ===== Home: group sections ===== */
.home-section {
  margin-bottom: var(--s-7);
}

.home-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding-bottom: var(--s-3);
  margin-bottom: var(--s-4);
  border-bottom: 1px solid var(--divider);
}

.home-section-toggle {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: start;
  color: inherit;
}

.home-section-caret {
  display: inline-flex;
  color: var(--text-3);
  transition: transform 0.15s;
}

.home-section-caret.collapsed {
  /* RTL: a folded section points at the content it hides. */
  transform: rotate(90deg);
}

.home-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.home-section-meta {
  font-size: 12px;
  color: var(--text-3);
}

.home-section-empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: var(--s-4) 0 var(--s-6);
}

/* ===== Group settings screen =====
   Everything below the header is the project style tab, and it has to size and
   scroll EXACTLY as it does there - same panels, same proportions, same
   internal scrolling. That layout fills the viewport, which needs an unbroken
   flex-height chain from .content-area down; the workspace supplies it through
   `.workspace-root:has(.style-tab)` (settings.css) and this screen supplies the
   identical one. Without it the panels overflow their box and nothing scrolls.
   Below 960px the tab relaxes itself to page scrolling, and this screen follows
   it there too. */
.group-settings {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.group-settings > .project-header {
  flex-shrink: 0;
}

.group-settings-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ── Group header row ── */
/* Wraps: the member chips below take as many lines as the group needs. */
.group-header {
  flex-wrap: wrap;
  align-items: flex-start;
}

.group-header > .project-header-title {
  flex: 0 1 auto;
}

/* Leading back arrow: its own control, aligned with the title block rather
   than crammed into the name row. */
.group-header-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition:
    background 0.15s,
    color 0.15s;
}

.group-header-back:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.group-header-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface-pressed);
  border-radius: var(--r-pill);
  padding: 2px 9px;
  flex-shrink: 0;
}

/* The projects this group covers. Every one of them is listed, wrapping onto as
   many lines as needed - the row is capped in height rather than in count, so a
   group with thirty projects can still be scrolled through here instead of
   pushing the style panels off the screen. */
.group-header-members {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  min-width: 0;
  flex: 1 1 auto;
  justify-content: flex-end;
}

.group-header-members-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  flex-shrink: 0;
  padding-top: 7px;
}

.group-header-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  max-height: 106px; /* ~3 rows */
  overflow-y: auto;
  padding: 1px;
}

.group-header-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 3px 11px 3px 4px;
  cursor: pointer;
  max-width: 190px;
  min-width: 0;
  box-shadow: var(--shadow-xs);
  transition:
    background 0.15s var(--ease-out),
    border-color 0.15s var(--ease-out),
    box-shadow 0.15s var(--ease-out),
    transform 0.15s var(--ease-out);
}

.group-header-chip:hover {
  color: var(--text);
  border-color: var(--accent-soft-2);
  background: var(--accent-soft);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.group-header-chip-thumb {
  width: 26px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 5px;
  overflow: hidden;
  background: var(--surface-pressed);
  display: block;
}

.group-header-chip-thumb .media-thumb-img-el,
.group-header-chip-thumb .media-thumb-video-el {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.group-header-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

@media (max-width: 960px) {
  /* Mirrors the workspace's own relaxation at this width. */
  .group-settings {
    flex: none;
    height: auto;
    overflow: visible;
  }

  .group-settings-body {
    flex: none;
    min-height: 0;
  }

  .group-header {
    flex-wrap: wrap;
  }

  .group-header-members {
    flex-wrap: wrap;
    width: 100%;
  }
}

/* ===== Group picker =====
   A board of round faces rather than a list of rows: the groups are few, and
   a group is recognised by its people long before its name is read. Lives in
   the shared .form-sheet shell (styles/settings.css). */
.modal:has(.gpick-modal),
.modal.modal-lg:has(.gpick-modal) {
  width: min(560px, 96vw);
  max-width: min(560px, 96vw);
}

.gpick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px 8px;
  align-content: start;
}

.gpick-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 10px 6px 9px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: none;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  text-align: center;
  transition:
    background 0.15s var(--ease-out),
    border-color 0.15s var(--ease-out);
}

.gpick-tile:hover {
  background: var(--surface-hover);
}

.gpick-tile.active {
  background: var(--accent-soft);
  border-color: var(--accent-soft-2);
}

.gpick-avatar-wrap {
  position: relative;
  display: block;
  flex-shrink: 0;
}

.gpick-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-xs);
  /* Stable per-group colour: --gpick-hue is set inline from the group id. */
  background: linear-gradient(
    150deg,
    hsl(var(--gpick-hue, 190) 58% 58%),
    hsl(calc(var(--gpick-hue, 190) + 24) 52% 42%)
  );
  transition:
    border-color 0.15s var(--ease-out),
    transform 0.15s var(--ease-out);
}

.gpick-tile:hover .gpick-avatar {
  transform: translateY(-1px);
}

.gpick-tile.active .gpick-avatar {
  border-color: var(--accent);
}

.gpick-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gpick-initial {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.gpick-avatar--none {
  background: var(--surface-2);
  border-style: dashed;
  color: var(--text-3);
  font-size: 20px;
}

.gpick-avatar--new {
  background: none;
  border: 2px dashed var(--border-strong);
  color: var(--text-3);
}

.gpick-tile--new:hover .gpick-avatar--new {
  border-color: var(--accent);
  color: var(--accent);
}

/* Chosen group: a check on the rim, so the name stays readable. */
.gpick-check {
  position: absolute;
  inset-block-end: -2px;
  inset-inline-end: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--surface);
  font-size: 11px;
}

.gpick-name {
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.25;
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  /* Two lines, then ellipsis - a long group name must not push the grid. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gpick-tile.active .gpick-name {
  color: var(--accent);
}

.gpick-sub {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.2;
}

/* ===== New group =====
   The same circle the picker will show, drawn live beside the name field. */
.ngroup-identity {
  display: flex;
  justify-content: center;
  padding: 6px 0 0;
}

.ngroup-avatar {
  width: 72px;
  height: 72px;
}

.ngroup-avatar .gpick-initial {
  font-size: 28px;
}

.ngroup-initial--empty {
  color: var(--text-muted) !important;
  text-shadow: none !important;
  font-weight: 600;
}

.ngroup-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ===== Sidebar group labels ===== */
.sidebar-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: var(--s-3) var(--s-3) var(--s-1);
  cursor: pointer;
}

.sidebar-group-label:hover {
  color: var(--text-2);
}

.sidebar-group-label.muted {
  cursor: default;
}

.sidebar-group-label.muted:hover {
  color: var(--text-muted);
}

/* ===== Inheritance markers (style tab of a project inside a group) ===== */
.style-section-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
}

/* Inherited reference photo: a ring in the accent colour, no label. */
.style-panel--refs .elem-tile--inherited .elem-tile-img {
  border-color: var(--accent-soft-2);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
