/* ==========================================================================
   FLOWNODES AI • FASHION DIRECTOR & UGC STUDIO (APPLE DARK MODE WORKSPACE)
   ========================================================================== */

:root {
  --bg: #090a0f;
  --bg-sidebar: #10121a;
  --surface: rgba(22, 25, 34, 0.85);
  --surface-hover: rgba(30, 34, 46, 0.95);
  --surface-border: rgba(255, 255, 255, 0.08);
  --surface-border-active: rgba(41, 151, 255, 0.5);

  --text-primary: #ffffff;
  --text-secondary: #9ea3ae;
  --text-tertiary: #6b7280;

  --apple-blue: #2997ff;
  --apple-teal: #14b8a6;
  --apple-purple: #a855f7;
  --apple-green: #22c55e;
  --apple-orange: #f97316;

  --font-system: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-system);
  min-height: 100vh;
  overflow-x: hidden;
}

/* TOP TOOLBAR */
.app-toolbar {
  position: sticky;
  top: 0;
  height: 64px;
  background: rgba(10, 11, 16, 0.85);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 1000;
}

.toolbar-left, .toolbar-right, .toolbar-center {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 1.5rem;
}

.logo-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.logo-title span {
  color: var(--apple-blue);
}

.logo-sub {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.preset-pill-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--surface-border);
  padding: 4px 8px;
  border-radius: 980px;
  margin-left: 12px;
}

.preset-lbl {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-right: 4px;
}

.preset-pill {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 980px;
  cursor: pointer;
  transition: all 0.15s;
}

.preset-pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.preset-pill.active {
  background: rgba(41, 151, 255, 0.18);
  color: var(--apple-blue);
  font-weight: 600;
  border: 1px solid rgba(41, 151, 255, 0.3);
}

.mcp-status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  padding: 5px 12px;
  border-radius: 980px;
  font-size: 0.75rem;
  color: #e2e8f0;
}

.mcp-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--apple-green);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.btn-master-render {
  background: linear-gradient(135deg, #2997ff, #0077ed);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 980px;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(41, 151, 255, 0.35);
  transition: all 0.2s ease;
}

.btn-master-render:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(41, 151, 255, 0.5);
}

.btn-tool-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 980px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--surface-border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-tool-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* STUDIO SPLIT LAYOUT */
.studio-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  min-height: calc(100vh - 64px);
}

/* LEFT COLUMN: DIRECTOR SIDEBAR */
.director-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--surface-border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  height: calc(100vh - 64px);
  overflow-y: auto;
  position: sticky;
  top: 64px;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--surface-border);
}

.sidebar-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.badge-active {
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(41, 151, 255, 0.15);
  color: var(--apple-blue);
  padding: 3px 8px;
  border-radius: 980px;
  border: 1px solid rgba(41, 151, 255, 0.3);
}

.director-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-icon {
  font-size: 1.1rem;
}

.card-title-row h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  flex: 1;
}

.badge-lock {
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(34, 197, 94, 0.12);
  color: var(--apple-green);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

/* MODEL PREVIEW BOX */
.model-preview-box {
  width: 100%;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #000;
}

.model-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.model-upload-btn {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  padding: 6px;
  border-radius: 8px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.2s;
}

.model-upload-btn:hover {
  background: rgba(41, 151, 255, 0.85);
}

/* INPUT GROUPS */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.studio-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 7px 10px;
  color: #fff;
  font-size: 0.8rem;
  font-family: var(--font-system);
  outline: none;
  transition: border-color 0.2s;
}

.studio-input:focus {
  border-color: var(--apple-blue);
}

/* POSE TAGS */
.pose-tag-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pose-tag {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--surface-border);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.pose-tag:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.pose-tag.active {
  background: rgba(168, 85, 247, 0.15);
  color: var(--apple-purple);
  border-color: rgba(168, 85, 247, 0.4);
  font-weight: 600;
}

/* SCENE CHIPS LIST */
.scene-chips-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 160px;
  overflow-y: auto;
}

.scene-chip {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* YAML ACCORDION */
.yaml-accordion {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.yaml-accordion summary {
  cursor: pointer;
  font-weight: 600;
  color: #d1d5db;
  outline: none;
}

.raw-yaml-area {
  width: 100%;
  height: 200px;
  margin-top: 8px;
  background: #090a0d;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 8px;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  resize: vertical;
  outline: none;
  line-height: 1.4;
}

/* RIGHT COLUMN: 2K CAMPAIGN GRID */
.campaign-main {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.campaign-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 1.25rem;
}

.campaign-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.campaign-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.campaign-metrics {
  display: flex;
  gap: 12px;
}

.metric-box {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 8px 16px;
  text-align: center;
}

.metric-val {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--apple-blue);
  display: block;
}

.metric-lbl {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-weight: 600;
}

/* UGC CARDS GRID (4x2 responsive) */
.ugc-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

@media (max-width: 1300px) {
  .ugc-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 990px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }
  .director-sidebar {
    height: auto;
    position: relative;
    top: 0;
  }
  .ugc-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .ugc-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* UGC CARD */
.ugc-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.ugc-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
}

.ugc-card-header {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--surface-border);
}

.ugc-var-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: #e2e8f0;
}

.ugc-status-pill {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--apple-green);
  background: rgba(34, 197, 94, 0.1);
  padding: 2px 6px;
  border-radius: 980px;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.ugc-image-wrap {
  width: 100%;
  height: 320px;
  position: relative;
  background: #000;
  cursor: pointer;
  overflow: hidden;
}

.ugc-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.ugc-image-wrap:hover img {
  transform: scale(1.06);
}

.ugc-scene-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  color: #d1d5db;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ugc-card-footer {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--surface-border);
}

.btn-card-render {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--surface-border);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s;
}

.btn-card-render:hover {
  background: var(--apple-blue);
  border-color: var(--apple-blue);
}

.btn-card-icon {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--surface-border);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-card-icon:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* BUTTONS & MODALS */
.btn-tool-primary {
  background: #ffffff;
  color: #000000;
  padding: 8px 16px;
  border-radius: 980px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-tool-primary:hover {
  background: #e2e8f0;
  transform: scale(1.02);
}

/* LIGHTBOX MODAL */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(35px);
  -webkit-backdrop-filter: blur(35px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 1rem;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-card {
  background: #14161d;
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.9);
}

.lightbox-header {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--surface-border);
}

.lightbox-image-wrap {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  padding: 1rem;
}

.lightbox-image-wrap img {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  border-radius: 12px;
}

.lightbox-footer {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--surface-border);
}

.close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* PIN CARD */
.pin-card {
  background: rgba(28, 28, 30, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.form-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 8px 12px;
  color: #fff;
  outline: none;
}

.form-input:focus {
  border-color: var(--apple-blue);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 32, 38, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 18px;
  border-radius: 980px;
  font-size: 0.82rem;
  display: none;
  z-index: 10000;
}
