/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --purple-900: #2b1450;
  --purple-800: #3a1c6e;
  --purple-700: #4b2a8f;
  --purple-500: #7c4dff;
  --purple-300: #b39dff;
  --teal-400: #26e0c9;
  --teal-300: #6bf0de;
  --bg-light: #f6f5fb;
  --bg-card: #ffffff;
  --text-dark: #201a3a;
  --text-mid: #5c5478;
  --text-light: #8b84a3;
  --danger: #ff5470;
  --shadow-soft: 0 10px 30px rgba(43, 20, 80, 0.12);
  --shadow-hover: 0 16px 40px rgba(43, 20, 80, 0.2);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.5;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 26px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple-500), var(--teal-400));
  color: #fff;
  box-shadow: 0 8px 20px rgba(124, 77, 255, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(124, 77, 255, 0.45);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(4px);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
}

#select-create .btn-ghost,
#drag-create .btn-ghost {
  background: #eee9ff;
  color: var(--purple-700);
  border: 1.5px solid #d9ccff;
}

#select-create .btn-ghost:hover,
#drag-create .btn-ghost:hover {
  background: #e0d4ff;
}

.btn-block {
  width: 100%;
}

.btn-danger-ghost {
  background: #fff0f3;
  color: var(--danger);
  border: 1.5px solid #ffd3dc;
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-danger-ghost:hover {
  background: var(--danger);
  color: #fff;
}

/* ===== Navbar ===== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 6vw 0;
  position: relative;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
  letter-spacing: 0.3px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--teal-400);
  box-shadow: 0 0 12px 3px rgba(38, 224, 201, 0.7);
  display: inline-block;
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: var(--teal-300);
}

/* ===== Hero ===== */
.hero {
  background: radial-gradient(circle at 20% 0%, var(--purple-700) 0%, var(--purple-900) 55%, #1a0f38 100%);
  padding-bottom: 70px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -120px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(38, 224, 201, 0.35), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: -160px;
  left: -100px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(124, 77, 255, 0.35), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-content {
  max-width: 780px;
  margin: 70px auto 0;
  padding: 0 6vw;
  text-align: center;
  position: relative;
  z-index: 2;
}

.hero-content h1 {
  color: #fff;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 18px;
  animation: fadeUp 0.8s ease both;
}

.accent {
  background: linear-gradient(135deg, var(--teal-300), var(--purple-300));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.08rem;
  max-width: 620px;
  margin: 0 auto 30px;
  animation: fadeUp 0.8s ease 0.1s both;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
  animation: fadeUp 0.8s ease 0.2s both;
}

.disclaimer {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.82rem;
  animation: fadeUp 0.8s ease 0.3s both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Sections ===== */
.section {
  padding: 70px 6vw;
  max-width: 1200px;
  margin: 0 auto;
}

.section-alt {
  background: #efeaff;
  max-width: 100%;
  border-radius: 40px 40px 0 0;
}

.section-alt > * {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

#dashboard.section-alt {
  padding-bottom: 90px;
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.section-sub {
  text-align: center;
  color: var(--text-mid);
  margin-bottom: 40px;
  font-size: 1.02rem;
}

/* ===== Gallery ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 26px;
}

.gallery-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  cursor: default;
}

.gallery-card:hover {
  transform: translateY(-8px) scale(1.015);
  box-shadow: var(--shadow-hover);
}

.gallery-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #ece7fb;
  transition: transform 0.4s ease;
}

.gallery-card:hover img {
  transform: scale(1.06);
}

.gallery-card-body {
  padding: 16px 18px 20px;
}

.gallery-card-body h3 {
  font-size: 1.05rem;
  margin-bottom: 4px;
  color: var(--purple-800);
}

.gallery-card-body p {
  font-size: 0.88rem;
  color: var(--text-mid);
}

/* ===== Select & Create ===== */
.select-panel {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: start;
}

.select-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.select-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 3px solid transparent;
  background: var(--bg-card);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.select-item img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
}

.select-item:hover {
  transform: translateY(-4px);
}

.select-item.selected {
  border-color: var(--teal-400);
  box-shadow: 0 0 0 4px rgba(38, 224, 201, 0.25), var(--shadow-hover);
}

.select-item .check-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--teal-400);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.select-item.selected .check-badge {
  opacity: 1;
  transform: scale(1);
}

.select-item .select-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(0deg, rgba(43, 20, 80, 0.75), transparent);
  text-align: center;
}

.select-controls {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-soft);
}

.control-group {
  margin-bottom: 20px;
}

.control-group label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-mid);
  margin-bottom: 8px;
}

.control-group input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid #e1dcf5;
  font-size: 0.95rem;
  background: #faf9ff;
  transition: border-color 0.15s ease;
}

.control-group input[type="text"]:focus {
  outline: none;
  border-color: var(--purple-500);
}

.test-type-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.test-type-btn {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid #e1dcf5;
  background: #faf9ff;
  color: var(--text-mid);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.test-type-btn:hover {
  border-color: var(--purple-300);
}

.test-type-btn.active {
  background: linear-gradient(135deg, var(--purple-500), var(--teal-400));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 14px rgba(124, 77, 255, 0.3);
}

.hint {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-light);
  text-align: center;
}

/* ===== Drag & Drop ===== */
.dragdrop-panel {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 30px;
}

.palette {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  height: fit-content;
}

.palette h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: 14px;
}

.palette-items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.palette-item {
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: grab;
  border: 2px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
  background: #f2effc;
}

.palette-item img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  pointer-events: none;
}

.palette-item:hover {
  transform: translateY(-3px);
  border-color: var(--purple-300);
}

.palette-item.dragging {
  opacity: 0.4;
}

.dropzone {
  border: 3px dashed #cbb9ff;
  border-radius: var(--radius-lg);
  background: #faf8ff;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.dropzone.dragover {
  border-color: var(--teal-400);
  background: #eafffb;
}

.dropzone-empty {
  text-align: center;
  color: var(--text-light);
}

.dropzone-icon {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 10px;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.dropzone-filled {
  display: flex;
  align-items: center;
  gap: 26px;
  width: 100%;
  flex-wrap: wrap;
  justify-content: center;
}

.dropzone-filled img {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: var(--shadow-soft);
  animation: popIn 0.3s ease;
}

@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.drag-agent-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 220px;
}

.drag-agent-form input,
.drag-agent-form select {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid #e1dcf5;
  font-size: 0.9rem;
  background: #fff;
}

.drag-agent-form input:focus,
.drag-agent-form select:focus {
  outline: none;
  border-color: var(--purple-500);
}

.drag-agent-form-actions {
  display: flex;
  gap: 10px;
}

.drag-agent-form-actions .btn {
  padding: 9px 18px;
  font-size: 0.85rem;
}

/* ===== Dashboard ===== */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.dashboard-header .section-title,
.dashboard-header .section-sub {
  text-align: left;
  margin-bottom: 4px;
}

.agents-empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-light);
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  border: 2px dashed #d9ccff;
}

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.agent-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-soft);
  display: flex;
  gap: 14px;
  align-items: center;
  position: relative;
  animation: cardIn 0.35s ease both;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.agent-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.agent-card img {
  width: 62px;
  height: 62px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  background: #ece7fb;
}

.agent-card-info {
  flex: 1;
  min-width: 0;
}

.agent-card-info h4 {
  font-size: 0.95rem;
  color: var(--text-dark);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eafffb;
  color: #0d9488;
  margin-top: 2px;
}

.agent-badge.source-drag {
  background: #f3ecff;
  color: var(--purple-700);
}

.agent-delete-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: #fff0f3;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}

.agent-delete-btn:hover {
  background: var(--danger);
  color: #fff;
  transform: scale(1.1);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-dark);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Footer ===== */
.footer {
  background: #efeaff;
  text-align: center;
  padding: 26px 6vw 34px;
  color: var(--text-light);
  font-size: 0.82rem;
}

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .select-panel,
  .dragdrop-panel {
    grid-template-columns: 1fr;
  }

  .nav-links {
    display: none;
  }
}

@media (max-width: 560px) {
  .section {
    padding: 50px 5vw;
  }

  .select-gallery {
    grid-template-columns: repeat(2, 1fr);
  }

  .palette-items {
    grid-template-columns: repeat(4, 1fr);
  }

  .hero-content {
    margin-top: 50px;
  }

  .dashboard-header {
    flex-direction: column;
  }
}
