/*
 * Shared brand-assets modal styles.
 * Used by both editor-brand-modal.html and player-brand-modal.html.
 * Requires ../../airtime-design-system-main/generated/tokens.css for
 * --font-size-button-default / --font-weight-button-default / --line-height-button-default.
 */

/* Local tokens — values that recur across editor.css / player.css /
   header.css / modal.css. Defined here because modal.css is loaded by
   every page. The DS tokens.css covers typography/spacing/radii; these
   cover the page chrome surfaces and the Airtime brand color which the
   DS doesn't expose as named tokens. */
:root {
  --surface-overlay-1:    rgba(255,255,255,0.08); /* default chrome surface */
  --surface-overlay-2:    rgba(255,255,255,0.12); /* hover state of overlay-1 */
  --surface-overlay-soft: rgba(255,255,255,0.06); /* dividers, subtle borders */
  --color-bg-page:        #0d0e10;
  --color-bg-chrome:      #12181a;
  --color-brand:          #79DDE8;
  --color-brand-hover:    #6dd0db;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Register --mask-pos as an animatable length so keyframes can tween it */
@property --mask-pos {
  syntax: '<length>';
  inherits: true;
  initial-value: 240px;
}

/* ════════════════════════════════
   OVERLAY
════════════════════════════════ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.scrim {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.50);
}

/* ════════════════════════════════
   COMPARISON MODAL (before/after slider)
════════════════════════════════ */
.modal-card {
  position: relative;
  background: var(--color-bg-chrome);
  border: 1px solid var(--surface-overlay-1);
  border-radius: 16px;
  width: 480px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 32px rgba(0,0,0,0.72);
  --mask-pos: 240px;
}

.comparison-area {
  position: relative;
  width: 480px;
  height: 270px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.comparison-bottom,
.comparison-top {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.comparison-bottom img,
.comparison-top img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  display: block;
  -webkit-user-drag: none;
}

.comparison-top {
  clip-path: inset(0 calc(100% - var(--mask-pos)) 0 0);
  -webkit-clip-path: inset(0 calc(100% - var(--mask-pos)) 0 0);
}

.comparison-handle {
  position: absolute;
  top: 0;
  left: var(--mask-pos);
  transform: translateX(-50%);
  width: 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  z-index: 10;
  touch-action: none;
}
.comparison-handle-bar {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 100%;
  background: rgba(230, 230, 230, 0.16);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  pointer-events: none;
}
.comparison-handle-grip {
  position: relative;
  width: 16px;
  height: 48px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.48);
  pointer-events: none;
}

/* Intro wobble — animate --mask-pos so handle and clip move together */
@keyframes comparison-wobble {
  0%   { --mask-pos: 240px; }
  20%  { --mask-pos: 270px; }
  40%  { --mask-pos: 210px; }
  60%  { --mask-pos: 270px; }
  80%  { --mask-pos: 210px; }
  100% { --mask-pos: 240px; }
}
.modal-card.wobble {
  animation: comparison-wobble 2.5s cubic-bezier(0.45, 0.05, 0.55, 0.95) 1;
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}
.modal-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px;
  text-align: center;
}
.modal-title {
  font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  font-size: 16px;
  line-height: 24px;
  color: #ffffff;
  font-variation-settings: 'wdth' 100;
}
.modal-description {
  font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  font-size: 12px;
  line-height: 16px;
  color: #d2d5d6;
  font-variation-settings: 'wdth' 100;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Modal buttons */
.modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: var(--font-weight-button-default);
  font-size: var(--font-size-button-default);
  line-height: var(--line-height-button-default);
  white-space: nowrap;
  font-variation-settings: 'wdth' 100;
}
.modal-btn-skip {
  width: 69px;
  background: var(--surface-overlay-1);
  border: 1px solid var(--surface-overlay-1);
  color: #ffffff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-btn-skip:hover { background: var(--surface-overlay-2); }
.modal-btn-primary {
  background: var(--color-brand);
  color: #000000;
}
.modal-btn-primary:hover { background: var(--color-brand-hover); }

/* ════════════════════════════════
   EDIT BRAND MODAL
════════════════════════════════ */
.edit-modal {
  position: relative;
  background: var(--color-bg-chrome);
  border: 1px solid var(--surface-overlay-1);
  border-radius: 18px;
  width: 480px;
  height: 410px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 32px rgba(0,0,0,0.72);
}
.edit-body {
  flex: 1 0 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px;
  overflow: auto;
}

.edit-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.edit-label {
  font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 590;
  font-size: var(--font-size-button-default);
  line-height: 16px;
  color: #ffffff;
  font-variation-settings: 'wdth' 100;
}
.edit-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  line-height: 16px;
}
.edit-sublabel {
  font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  font-size: 11px;
  color: #B0B1B2;
  font-variation-settings: 'wdth' 100;
}

.edit-name-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  width: 100%;
}
.edit-input {
  flex: 1 0 0;
  min-width: 0;
  background: #0a0d0e;
  border: 1px solid var(--surface-overlay-1);
  border-radius: 6px;
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.edit-input svg {
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.edit-input input {
  flex: 1 0 0;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  font-size: var(--font-size-button-default);
  line-height: 16px;
  color: #ffffff;
  font-variation-settings: 'wdth' 100;
}
.edit-input input::placeholder { color: #B0B1B2; }

.edit-search-btn {
  padding: 6px 8px;
  background: var(--surface-overlay-1);
  border: 1px solid var(--surface-overlay-1);
  border-radius: 6px;
  color: #ffffff;
  font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: var(--font-weight-button-default);
  font-size: var(--font-size-button-default);
  line-height: var(--line-height-button-default);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-variation-settings: 'wdth' 100;
}
.edit-search-btn:hover { background: var(--surface-overlay-2); }

.edit-swatch-row {
  display: flex;
  align-items: flex-start;
  width: 100%;
}
.edit-swatch {
  position: relative;
  padding: 4px;
  border-radius: 8px;
  display: flex;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  background: transparent;
}
.edit-swatch:hover { background: rgba(255,255,255,0.04); }
.edit-swatch-fill {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.16);
  box-sizing: border-box;
  position: relative;
}
.edit-swatch-add {
  background: var(--surface-overlay-1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.edit-swatch-add svg {
  width: 11px;
  height: 11px;
  display: block;
}

.edit-logo-row {
  display: grid;
  /* Fixed 4 columns so tiles keep their size when the count exceeds 4 and
     wraps onto new rows (otherwise flex-grow stretched the last row). */
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
}
.edit-logo-tile {
  width: 100%;
  aspect-ratio: 84.8 / 47.7;
  max-height: 72px;
  background: var(--surface-overlay-1);
  border: 1px solid var(--surface-overlay-1);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}
.edit-logo-tile:hover { background: var(--surface-overlay-2); }
.edit-logo-tile img { display: block; pointer-events: none; }
.edit-logo-tile .logo-wide { width: 72px; height: 12px; object-fit: contain; }
.edit-logo-tile .logo-brand { width: 40px; height: 40px; object-fit: contain; }
/* Used for fetched brand logos — fits a 72x40 box, scaling on whichever
   dimension is constraining (wide marks fit width, square marks fit height). */
.edit-logo-tile .logo-fetched { width: 72px; height: 40px; object-fit: contain; }
.edit-logo-tile.add {
  border-style: dashed;
  border-color: var(--surface-overlay-1);
}
.edit-logo-tile.add svg {
  width: 11px;
  height: 11px;
  display: block;
}

.edit-font-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}
.edit-font-chip {
  position: relative;
  flex: 1 0 0;
  min-width: 160px;
  padding: 6px 8px;
  background: var(--surface-overlay-1);
  border: 1px solid var(--surface-overlay-1);
  border-radius: 6px;
  color: #ffffff;
  font-size: var(--font-size-button-default);
  line-height: 16px;
  text-align: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Hover-to-delete control on swatches / logo tiles / font chips.
   The icon is the SF-Symbol minus.circle.fill character — renders
   natively on macOS via SF Pro; harmless tofu fallback elsewhere. */
.asset-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1;
  color: #ffffff;
  cursor: pointer;
  user-select: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
  z-index: 1;
}
.edit-swatch:hover .asset-delete,
.edit-logo-tile:hover .asset-delete,
.edit-font-chip:hover .asset-delete {
  opacity: 1;
  pointer-events: auto;
}

/* HEX-color tooltip on swatches — sits above the swatch with a down arrow.
   Stays clear of the top-right .asset-delete icon (which is inside the swatch). */
.swatch-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 2;
}
.edit-swatch:hover .swatch-tooltip { opacity: 1; }
.edit-font-chip.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.edit-font-chip.ff-neue   { font-family: 'Neue Haas Grotesk Display Pro', 'Helvetica Neue', sans-serif; font-weight: 500; }
.edit-font-chip.ff-henju  { font-family: 'Henju', 'SF Pro', sans-serif; font-weight: 500; }
.edit-font-chip.ff-sfpro  { font-family: 'SF Pro', -apple-system, sans-serif; font-weight: 510; font-variation-settings: 'wdth' 100; }

.edit-footer {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  width: 100%;
}
.edit-footer::before {
  content: '';
  position: absolute;
  inset: 0;
  border-top: 1px solid var(--surface-overlay-1);
  pointer-events: none;
}

.edit-agree {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}
.edit-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.edit-checkbox svg { width: 10px; height: 10px; display: none; }
.edit-agree input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.edit-agree input:checked ~ .edit-checkbox {
  background: var(--color-brand);
  border-color: var(--color-brand);
}
.edit-agree input:checked ~ .edit-checkbox svg { display: block; }
.edit-agree-label {
  font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  font-size: var(--font-size-button-default);
  line-height: var(--line-height-button-default);
  color: #B0B1B2;
  font-variation-settings: 'wdth' 100;
}

.edit-actions {
  flex: 1 0 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
