@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700&family=Manrope:wght@400;500;600;700&family=Playfair+Display:wght@500;600;700&display=swap");

:root {
  color-scheme: dark;
  --bg-1: #0b1120;
  --bg-2: #0f172a;
  --bg-3: #111827;
  --glass: rgba(15, 23, 42, 0.75);
  --glass-strong: rgba(30, 41, 59, 0.78);
  --border: rgba(148, 163, 184, 0.16);
  --text: #f8fafc;
  --text-soft: rgba(248, 250, 252, 0.78);
  --text-muted: rgba(248, 250, 252, 0.55);
  --cyan: #38bdf8;
  --pink: #f472b6;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --shadow: 0 30px 80px rgba(2, 6, 23, 0.6);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", system-ui, sans-serif;
  background: radial-gradient(circle at top, #1e293b 0%, var(--bg-2) 30%, var(--bg-1) 80%);
  color: var(--text);
  min-height: 100vh;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(65px);
  opacity: 0.6;
  z-index: 0;
  pointer-events: none;
}

.orb-1 {
  width: 380px;
  height: 380px;
  background: rgba(56, 189, 248, 0.35);
  top: -140px;
  left: -120px;
}

.orb-2 {
  width: 460px;
  height: 460px;
  background: rgba(244, 114, 182, 0.3);
  bottom: -180px;
  right: -140px;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  padding: 40px 32px 60px;
  max-width: 1280px;
  margin: 0 auto;
}

h1,
h2,
h3 {
  font-family: "Playfair Display", serif;
  margin: 0 0 8px;
}

p {
  margin: 0;
  color: var(--text-soft);
}

.brand {
  display: flex;
  gap: 18px;
  align-items: center;
}

.brand h1 {
  font-size: clamp(1.8rem, 2.6vw, 2.4rem);
}

.brand-pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(56, 189, 248, 0.18), rgba(244, 114, 182, 0.2));
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

.user-chip {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--glass);
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.user-name {
  font-weight: 600;
  display: block;
}

.user-role {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(380px, 1.2fr);
  gap: 28px;
}

.panel {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.auto-generator {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  display: grid;
  gap: 14px;
}

.auto-help {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.12);
  padding: 12px;
  border-radius: 16px;
}

.auto-help summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-soft);
}

.auto-sample {
  display: none;
}

.auto-sample.active {
  display: block;
}

.code-sample {
  margin: 12px 0 0;
  padding: 12px;
  background: rgba(2, 6, 23, 0.6);
  border-radius: 12px;
  font-family: "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  color: rgba(248, 250, 252, 0.86);
}

.panel-header {
  margin-bottom: 20px;
}

.panel-header p {
  color: var(--text-muted);
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.tab {
  flex: 1;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-soft);
  cursor: pointer;
  font-weight: 600;
}

.tab.active {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.12);
  color: var(--text);
}

.tab-content {
  display: none;
  gap: 16px;
}

.tab-content.active {
  display: grid;
}

.field {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.primary {
  background: linear-gradient(120deg, var(--cyan), var(--pink));
  color: #071018;
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.35);
}

.btn.ghost {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.btn.small {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.btn:hover {
  transform: translateY(-1px);
}

.slides {
  display: grid;
  gap: 16px;
}

.slide-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(2, 6, 23, 0.5);
  display: grid;
  gap: 12px;
}

.slide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.slide-header h4 {
  margin: 0;
  font-size: 1rem;
  font-family: "Manrope", sans-serif;
}

.slide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.image-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.image-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
}

.image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-thumb span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.65rem;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.8);
}

.image-thumb.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text);
  background: rgba(56, 189, 248, 0.12);
  border: 1px dashed rgba(56, 189, 248, 0.4);
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
}

.preview-block {
  display: grid;
  gap: 10px;
}

.preview-phone {
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  padding: 12px;
  background: rgba(2, 6, 23, 0.35);
  min-height: 280px;
  display: grid;
  place-items: center;
}

.preview-frame {
  position: relative;
  width: min(260px, 100%);
  background: #000;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
}

.preview-frame.ratio-1-1 {
  aspect-ratio: 1 / 1;
}

.preview-frame.ratio-4-3 {
  aspect-ratio: 4 / 3;
}

.preview-frame.ratio-3-4 {
  aspect-ratio: 3 / 4;
}

.preview-frame.reel {
  width: min(300px, 100%);
}

.frame-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  align-items: center;
  justify-items: center;
  color: #fff;
  overflow: hidden;
  background: #000;
}

.frame-inner img.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame-text {
  position: absolute;
  z-index: 4;
  padding: 22px;
  font-weight: 700;
  text-transform: none;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  text-align: left;
  line-height: 0.95;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  text-shadow: 0 14px 30px rgba(0, 0, 0, 0.65);
  max-height: 100%;
  height: 100%;
  display: grid;
  align-content: center;
  justify-items: start;
  top: 0;
  bottom: 0;
  overflow: hidden;
}

.frame-text.shrink-words .word {
  display: inline-block;
  white-space: nowrap;
}

.icon-layer {
  position: absolute;
  --icon-base: 28%;
  --icon-scale: 1;
  --icon-opacity: 0.6;
  --icon-blur: 0px;
  width: calc(var(--icon-base) * var(--icon-scale));
  aspect-ratio: 1 / 1;
  color: #ffffff;
  opacity: var(--icon-opacity);
  filter: blur(var(--icon-blur)) drop-shadow(0 10px 24px rgba(0, 0, 0, 0.5));
  pointer-events: none;
  z-index: 3;
}

.icon-layer svg {
  width: 100%;
  height: 100%;
}

.icon-layer.mode-inline {
  --icon-base: 26%;
  z-index: 3;
}

.icon-layer.mode-big {
  --icon-base: 48%;
  z-index: 2;
}

.icon-layer.mode-blur {
  --icon-base: 70%;
  z-index: 1;
}

.icon-layer.mode-corner {
  --icon-base: 22%;
  z-index: 3;
}

.icon-layer.pos-left {
  left: 6%;
  top: 50%;
  transform: translateY(-50%);
}

.icon-layer.pos-right {
  right: 6%;
  top: 50%;
  transform: translateY(-50%);
}

.icon-layer.pos-top {
  top: 8%;
  left: 50%;
  transform: translateX(-50%);
}

.icon-layer.pos-bottom {
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
}

.icon-layer.pos-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.icon-layer.pos-corner-tr {
  top: 6%;
  right: 6%;
}

.icon-layer.pos-corner-tl {
  top: 6%;
  left: 6%;
}

.icon-layer.pos-corner-br {
  bottom: 6%;
  right: 6%;
}

.icon-layer.pos-corner-bl {
  bottom: 6%;
  left: 6%;
}

.frame-text.align-left {
  text-align: left;
  left: 0;
  right: auto;
  justify-items: start;
}

.frame-text.align-center {
  text-align: center;
  left: 50%;
  transform: translateX(-50%);
  justify-items: center;
}

.frame-text.align-right {
  text-align: right;
  right: 0;
  left: auto;
  justify-items: end;
}

.frame-text.half {
  width: 50%;
  max-width: 50%;
}

.frame-text.full {
  width: 80%;
  max-width: 80%;
}

.frame-overlay {
  position: absolute;
  z-index: 2;
  width: 58%;
  max-width: 160px;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.45);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.frame-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: #000;
  position: relative;
}

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

.mini-preview .mini-text {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  color: #fff;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.65);
}

.reel-player {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.reel-scene {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.reel-scene.active {
  opacity: 1;
}

.reel-text-stack {
  position: relative;
  z-index: 2;
  width: min(85%, 320px);
  display: grid;
  gap: 12px;
  text-align: center;
  align-content: center;
  justify-items: center;
  height: 70%;
  overflow: hidden;
}

.reel-text-stack .frame-text {
  display: block;
  padding: 0;
  position: relative;
  height: auto;
  width: 100%;
  top: auto;
  bottom: auto;
  left: auto;
  right: auto;
  transform: none;
  text-align: center;
  justify-items: initial;
  align-content: initial;
}

.reel-text-stack .frame-text.secondary {
  font-size: 1rem;
  opacity: 0.85;
  font-family: "Manrope", sans-serif;
  letter-spacing: 0.02em;
}

.preview-phone.reel {
  padding: 0;
  background: transparent;
  border: none;
  min-height: 520px;
}

.ig-post {
  width: min(360px, 100%);
  background: #ffffff;
  color: #0f172a;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(2, 6, 23, 0.35);
  display: grid;
}

.ig-post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  font-family: "Manrope", sans-serif;
}

.ig-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.ig-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(120deg, #38bdf8, #f472b6);
}

.ig-post-media {
  position: relative;
  width: 100%;
  background: #000;
  overflow: hidden;
}

.ig-post-media.ratio-1-1 {
  aspect-ratio: 1 / 1;
}

.ig-post-media.ratio-4-3 {
  aspect-ratio: 4 / 3;
}

.ig-post-media.ratio-3-4 {
  aspect-ratio: 3 / 4;
}

.ig-post-media img.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ig-post-media .frame-text {
  color: #fff;
}

.carousel-controls {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 3;
  background: rgba(2, 6, 23, 0.6);
  border-radius: 999px;
  padding: 4px 8px;
  color: #fff;
  font-size: 0.75rem;
}

.carousel-btn {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1rem;
  cursor: pointer;
  padding: 0 4px;
}

.carousel-count {
  font-weight: 600;
}

.ig-post-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
}

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

.ig-icon {
  width: 20px;
  height: 20px;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ig-icon.light {
  color: #fff;
}

.ig-icon svg {
  width: 100%;
  height: 100%;
}

.card-footer .btn {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.ig-post-caption {
  padding: 0 12px 14px;
  font-size: 0.85rem;
  display: grid;
  gap: 6px;
  font-family: "Manrope", sans-serif;
}

.ig-post-caption .username {
  font-weight: 700;
  margin-right: 6px;
}

.ig-post-caption .likes {
  font-weight: 600;
}

.ig-post-caption .caption {
  display: block;
  color: #111827;
}

.ig-post-caption .placeholder {
  color: rgba(15, 23, 42, 0.5);
}

.ig-post-caption .meta {
  color: rgba(15, 23, 42, 0.6);
  font-size: 0.75rem;
}

.ig-reel {
  width: min(340px, 100%);
  aspect-ratio: 9 / 16;
  background: #000;
  position: relative;
  overflow: hidden;
  border-radius: 0;
  box-shadow: 0 20px 40px rgba(2, 6, 23, 0.45);
}

.ig-reel img.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ig-reel .frame-text {
  color: #fff;
}

.ig-reel-right {
  position: absolute;
  right: 10px;
  bottom: 90px;
  display: grid;
  gap: 16px;
  z-index: 3;
}

.ig-reel-right .ig-icon {
  color: #fff;
}

.ig-reel-top {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
}

.ig-reel-top .ig-icon {
  color: #fff;
}

.ig-reel-bottom {
  position: absolute;
  left: 12px;
  bottom: 16px;
  z-index: 3;
  color: #fff;
  display: grid;
  gap: 6px;
  width: 75%;
  font-family: "Manrope", sans-serif;
  font-size: 0.85rem;
}

.ig-reel-bottom .username {
  font-weight: 700;
}

.ig-reel-bottom .audio {
  font-size: 0.75rem;
  opacity: 0.85;
}

.ig-reel .reel-text-stack {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 80%;
  height: 60%;
  display: grid;
  align-content: center;
  justify-items: center;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.7);
}

.modal-card {
  position: relative;
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  width: min(560px, 92vw);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  display: grid;
  gap: 16px;
}

.modal-card.preview-card {
  width: min(820px, 94vw);
}

.modal-card.preview-card .modal-body {
  display: grid;
  place-items: center;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  display: grid;
  gap: 16px;
}

.crop-preview {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: #000;
  display: grid;
  place-items: center;
  min-height: 240px;
  overflow: hidden;
}

.crop-preview .preview-frame {
  width: min(420px, 100%);
}

.crop-controls {
  display: grid;
  gap: 10px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.board-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.board-tab {
  flex: 1;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-soft);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  opacity: 0.55;
}

.board-tab.active {
  border-color: rgba(244, 114, 182, 0.6);
  background: rgba(244, 114, 182, 0.12);
  color: var(--text);
  opacity: 1;
  box-shadow: 0 12px 26px rgba(244, 114, 182, 0.22);
}

.board-panels {
  display: grid;
}

.board-panel {
  display: none;
}

.board-panel.active {
  display: block;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

@media (min-width: 1100px) {
  .board-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card-mini {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(2, 6, 23, 0.55);
  display: grid;
  gap: 8px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.card-mini.clickable {
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease;
}

.card-mini.clickable:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.4);
}

.card-mini .meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-mini .title {
  font-weight: 600;
}

.card-mini .actions {
  gap: 8px;
}

.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.post {
  background: rgba(56, 189, 248, 0.15);
  color: var(--cyan);
}

.badge.reel {
  background: rgba(244, 114, 182, 0.15);
  color: var(--pink);
}

.login-wrapper {
  max-width: 900px;
  margin: 80px auto 0;
  display: grid;
  gap: 32px;
}

.login-card {
  max-width: 420px;
  padding: 28px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.hint {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.error {
  background: rgba(251, 113, 133, 0.12);
  color: var(--red);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
}

@media (max-width: 1000px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}
