/* ============================================
   DESIGN SYSTEM — BLACK & WHITE FORM BUILDER
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* --- Custom Properties --- */
:root {
  --black: #000000;
  --white: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;
  --gray-950: #0a0a0a;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.18);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background: var(--black);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* --- App Container --- */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  padding: 28px 40px 20px;
  border-bottom: 1px solid var(--gray-800);
  background: var(--black);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
}

.header__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 12px;
}

.header__branding {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header__logo {
  width: 36px;
  height: 36px;
  background: var(--white);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  flex-shrink: 0;
  transition: transform var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header__logo::after {
  content: '';
  width: 18px;
  height: 18px;
  background-image: linear-gradient(135deg, #0ea5e9, #c026d3, #5227ff);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 2L3 14h9l-1 8 10-12h-9l1-8z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 2L3 14h9l-1 8 10-12h-9l1-8z'/%3E%3C/svg%3E") center/contain no-repeat;
  animation: logoPulse 2s infinite alternate ease-in-out;
}

@keyframes logoPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.15); }
}

.header__logo:hover {
  transform: rotate(45deg) scale(1.1);
}

.header__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gray-400);
}

.header__title-section {
  flex: 1;
  max-width: 600px;
}

.header__title-input {
  width: 100%;
  background-color: transparent;
  border: none;
  border-bottom: 3px solid rgba(255, 255, 255, 0.1);
  /* Dynamic Metallic Underline inspired by field select button shine */
  background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 0.8) 50%, rgba(255, 255, 255, 0) 75%, rgba(255, 255, 255, 0) 100%);
  background-size: 200% 3px;
  background-position: 150% 100%;
  background-repeat: no-repeat;
  color: var(--white);
  font-family: Impact, sans-serif;
  font-size: 2.2rem;
  letter-spacing: 1px;
  padding: 4px 0 8px;
  outline: none;
  animation: constantUnderlineShine 3s linear infinite;
}

@keyframes constantUnderlineShine {
  0% { background-position: 150% 100%; }
  100% { background-position: -50% 100%; }
}

.header__title-input::placeholder {
  color: var(--gray-600);
}

.header__title-input:focus {
  border-bottom: 3px solid rgba(255, 255, 255, 0.2);
  background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 1) 50%, rgba(255, 255, 255, 0) 75%, rgba(255, 255, 255, 0) 100%);
  background-size: 200% 3px;
  background-position: 150% 100%;
  background-repeat: no-repeat;
}

.header__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.header__url {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-weight: 400;
  letter-spacing: 0.3px;
}

.header__url span {
  color: var(--gray-300);
  font-weight: 500;
}

.header__char-count {
  font-size: 0.7rem;
  color: var(--gray-500);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: color var(--transition-fast);
}

.header__char-count.warning {
  color: var(--gray-300);
}

.header__char-count.danger {
  color: var(--white);
  font-weight: 700;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
  display: flex;
  gap: 0;
  padding: 0 40px;
  border-bottom: 1px solid var(--gray-800);
  background: var(--black);
}

.tab {
  padding: 14px 28px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: color var(--transition-base);
  font-family: var(--font-family);
}

.tab:hover {
  color: var(--gray-300);
}

.tab.active {
  color: var(--white);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--white);
  animation: tabSlide 0.3s ease;
}

@keyframes tabSlide {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ============================================
   MAIN CONTENT — TWO COLUMNS
   ============================================ */
.main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
  min-height: 0;
}

/* --- Drop Canvas (Left Panel) --- */
.canvas {
  padding: 32px 40px;
  overflow-y: auto;
  min-height: calc(100vh - 220px);
}

.canvas__dropzone {
  min-height: 400px;
  border: 2px dashed var(--gray-700);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-base);
  position: relative;
  background: transparent;
}

.canvas__dropzone.drag-over {
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.02);
}

.canvas__dropzone.has-fields {
  border-style: solid;
  border-color: var(--gray-800);
  background: rgba(255, 255, 255, 0.01);
}

/* Empty state */
.canvas__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 350px;
  text-align: center;
  animation: fadeIn 0.5s ease;
}

.canvas__empty-icon {
  width: 80px;
  height: 80px;
  border: 2px solid var(--gray-700);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  font-size: 2rem;
  color: var(--gray-600);
  animation: float 3s ease-in-out infinite;
}

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

.canvas__empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-400);
  margin-bottom: 8px;
}

.canvas__empty-hint {
  font-size: 0.82rem;
  color: var(--gray-600);
  max-width: 300px;
}

.canvas__empty-hint .arrow {
  display: inline-block;
  animation: nudge 1.5s ease-in-out infinite;
}

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}

/* --- Placed Field Cards --- */
.field-card {
  background: var(--gray-950);
  border: 1px solid var(--gray-800);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 12px;
  position: relative;
  transition: all var(--transition-base);
  animation: slideIn 0.3s ease;
  cursor: default;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.field-card:hover {
  border-color: var(--gray-600);
  background: var(--gray-900);
}

.field-card.editing {
  border-color: var(--white);
  box-shadow: 0 0 0 1px var(--white);
}

.field-card.dragging {
  opacity: 0.4;
  transform: scale(0.98);
}

.field-card.drag-above {
  border-top: 2px solid var(--white);
  margin-top: -1px;
}

.field-card.drag-below {
  border-bottom: 2px solid var(--white);
  margin-bottom: -1px;
}

.field-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.field-card__drag-handle {
  cursor: grab;
  padding: 4px 6px;
  font-size: 1.1rem;
  color: var(--gray-600);
  line-height: 1;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  letter-spacing: 2px;
}

.field-card__drag-handle:hover {
  color: var(--white);
  background: var(--gray-800);
}

.field-card__drag-handle:active {
  cursor: grabbing;
}

.field-card__info {
  flex: 1;
  margin-left: 12px;
}

.field-card__type {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gray-500);
  margin-bottom: 2px;
}

.field-card__label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--white);
}

.field-card__required {
  display: inline-block;
  margin-left: 4px;
  color: var(--gray-400);
  font-weight: 400;
  font-size: 0.75rem;
}

.field-card__actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.field-card:hover .field-card__actions {
  opacity: 1;
}

.field-card__action {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-700);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
}

.field-card__action:hover {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
  transform: scale(1.08);
}

.field-card__action.danger:hover {
  background: var(--gray-300);
  color: var(--black);
  border-color: var(--gray-300);
}

.field-card__preview {
  margin-top: 8px;
}

.field-card__preview input,
.field-card__preview textarea,
.field-card__preview select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-700);
  border-radius: var(--radius-sm);
  background: var(--gray-900);
  color: var(--gray-300);
  font-family: var(--font-family);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.field-card__preview input:focus,
.field-card__preview textarea:focus,
.field-card__preview select:focus {
  border-color: var(--gray-400);
}

.field-card__preview input::placeholder,
.field-card__preview textarea::placeholder {
  color: var(--gray-600);
}

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

.field-card__preview select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23737373' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.field-card__preview-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-card__preview-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--gray-300);
}

.field-card__preview-option input[type="radio"],
.field-card__preview-option input[type="checkbox"] {
  width: auto;
  accent-color: var(--white);
}

.field-card__preview .structural-label {
  font-size: 0.8rem;
  color: var(--gray-500);
  font-style: italic;
  padding: 6px 0;
  border-bottom: 1px dashed var(--gray-800);
}

.field-card__preview .title-preview {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-200);
  padding: 4px 0;
}

.field-card__preview .description-preview {
  font-size: 0.85rem;
  color: var(--gray-400);
  padding: 4px 0;
}

/* --- Drop Indicator Line --- */
.drop-indicator {
  height: 3px;
  background: var(--white);
  border-radius: 2px;
  margin: 4px 0;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============================================
   RIGHT PANEL — FIELD PALETTE
   ============================================ */
.panel {
  border-left: 1px solid var(--gray-800);
  background: var(--gray-950);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: calc(100vh - 180px);
  position: sticky;
  top: 140px;
}

.panel__tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--gray-800);
  position: sticky;
  top: 0;
  background: var(--gray-950);
  z-index: 10;
}

.panel__tab {
  flex: 1;
  padding: 14px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-500);
  cursor: pointer;
  border: none;
  background: none;
  text-align: center;
  position: relative;
  transition: color var(--transition-base);
  font-family: var(--font-family);
}

.panel__tab:hover {
  color: var(--gray-300);
}

.panel__tab.active {
  color: var(--white);
}

.panel__tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--white);
}

.panel__content {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

/* --- Field Type Tiles Grid --- */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--gray-800);
  border-radius: var(--radius-md);
  background: var(--black);
  cursor: grab;
  transition: all var(--transition-base);
  user-select: none;
  font-family: var(--font-family);
  position: relative;
  overflow: hidden;
}

.field-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(192, 192, 192, 0.6) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  z-index: 1;
  pointer-events: none;
}

.field-tile:hover::before {
  animation: tileShine 0.8s ease-out forwards;
}

@keyframes tileShine {
  0% { left: -100%; }
  100% { left: 200%; }
}

.field-tile:hover {
  border-color: var(--gray-500);
  background: var(--gray-900);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.field-tile:active {
  cursor: grabbing;
  transform: scale(0.97);
  opacity: 0.8;
}

.field-tile.dragging-source {
  opacity: 0.3;
  border-style: dashed;
}

.field-tile__icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--gray-900);
  font-size: 0.8rem;
  color: var(--gray-300);
  flex-shrink: 0;
  border: 1px solid var(--gray-800);
  position: relative;
  z-index: 2;
}

.field-tile:hover .field-tile__icon {
  background: var(--gray-800);
  color: var(--white);
  border-color: var(--gray-600);
}

.field-tile__label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-300);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  z-index: 2;
}

/* Full-width tile */
.field-tile.full-width {
  grid-column: 1 / -1;
}

/* ============================================
   FIELD OPTIONS PANEL
   ============================================ */
.field-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field-options__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-800);
}

.field-options__title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--white);
}

.field-options__back {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-400);
  cursor: pointer;
  border: 1px solid var(--gray-700);
  background: transparent;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-family: var(--font-family);
}

.field-options__back:hover {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
}

.field-options__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-options__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-400);
}

.field-options__input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-700);
  border-radius: var(--radius-sm);
  background: var(--black);
  color: var(--white);
  font-family: var(--font-family);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.field-options__input:focus {
  border-color: var(--white);
}

.field-options__input::placeholder {
  color: var(--gray-600);
}

.field-options__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Toggle / Checkbox */
.field-options__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.field-options__toggle-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--gray-300);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch__slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gray-700);
  border-radius: 12px;
  transition: background var(--transition-base);
}

.toggle-switch__slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform var(--transition-base);
}

.toggle-switch input:checked + .toggle-switch__slider {
  background: var(--white);
}

.toggle-switch input:checked + .toggle-switch__slider::before {
  transform: translateX(20px);
  background: var(--black);
}

/* Options List (for Dropdown/Radio/Checkbox) */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.options-list__item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.options-list__input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--gray-700);
  border-radius: var(--radius-sm);
  background: var(--black);
  color: var(--white);
  font-family: var(--font-family);
  font-size: 0.82rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.options-list__input:focus {
  border-color: var(--white);
}

.options-list__remove {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-700);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.options-list__remove:hover {
  background: var(--gray-300);
  color: var(--black);
  border-color: var(--gray-300);
}

.options-list__add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border: 1px dashed var(--gray-700);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
}

.options-list__add:hover {
  border-color: var(--white);
  color: var(--white);
  background: rgba(255, 255, 255, 0.03);
}

/* Danger Button */
.btn-danger {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--gray-600);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gray-300);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
  margin-top: 8px;
}

.btn-danger:hover {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-top: 1px solid var(--gray-800);
  background: var(--black);
  position: sticky;
  bottom: 0;
  z-index: 100;
}

.btn {
  padding: 12px 32px;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  z-index: 1;
  pointer-events: none;
}

.btn:hover::before {
  animation: metallicShine 0.8s ease-out forwards;
}

.btn-outline {
  background: transparent;
  border: 1px solid #ea580c;
  color: #ea580c;
}

.btn-outline:hover {
  background: rgba(234, 88, 12, 0.1);
  border-color: #f97316;
  color: #f97316;
}

.btn-primary {
  background: #3b82f6;
  border: 1px solid #3b82f6;
  color: var(--black);
}

.btn-primary:hover {
  background: #60a5fa;
  border-color: #60a5fa;
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ============================================
   SETTINGS TAB (placeholder)
   ============================================ */
.settings-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  color: var(--gray-500);
  gap: 16px;
}

.settings-placeholder__icon {
  font-size: 3rem;
  color: var(--gray-700);
}

.settings-placeholder__text {
  font-size: 1rem;
  font-weight: 500;
}

/* ============================================
   DELETE CONFIRMATION MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(4px);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--gray-950);
  border: 1px solid var(--gray-700);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 8px;
}

.modal__text {
  font-size: 0.85rem;
  color: var(--gray-400);
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal__actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal__actions .btn {
  padding: 10px 24px;
  font-size: 0.82rem;
}

/* ============================================
   FLUID GLASSMORPHISM PREVIEW
   ============================================ */
.glass-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
  background: #0a0f1c; /* Deep base color */
  overflow: hidden;
}

/* Fluid background blobs */
.fluid-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  pointer-events: none;
}
.fluid-blob {
  position: absolute;
  filter: blur(90px);
  border-radius: 50%;
  animation: floatBlob 12s infinite alternate cubic-bezier(0.45, 0.05, 0.55, 0.95);
  opacity: 0.7;
}
.fluid-blob-1 {
  width: 50vw; height: 50vw;
  background: #5227ff; /* The purple from the ThreeJS code */
  top: -10%; left: -10%;
}
.fluid-blob-2 {
  width: 40vw; height: 40vw;
  background: #0ea5e9;
  bottom: -20%; right: -10%;
  animation-delay: -4s;
}
.fluid-blob-3 {
  width: 45vw; height: 45vw;
  background: #c026d3;
  top: 30%; left: 30%;
  animation-delay: -8s;
}

@keyframes floatBlob {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(10vw, 5vh) scale(1.1); }
  66% { transform: translate(-5vw, 15vh) scale(0.9); }
  100% { transform: translate(-15vw, -5vh) scale(1.2); }
}

.glass-modal {
  /* Thick glass transmission effect */
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  box-shadow: 
    0 24px 40px -8px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  padding: 40px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1), electricPulse 4s infinite alternate ease-in-out;
  color: var(--white);
  position: relative;
  z-index: 1;
}

@keyframes electricPulse {
  0% {
    border-color: #0ea5e9;
    box-shadow: 
      0 0 10px rgba(14, 165, 233, 0.5),
      0 0 20px rgba(14, 165, 233, 0.3),
      inset 0 0 10px rgba(14, 165, 233, 0.2),
      0 24px 40px -8px rgba(0, 0, 0, 0.6);
  }
  50% {
    border-color: #c026d3;
    box-shadow: 
      0 0 15px rgba(192, 38, 211, 0.7),
      0 0 30px rgba(192, 38, 211, 0.4),
      inset 0 0 15px rgba(192, 38, 211, 0.3),
      0 24px 40px -8px rgba(0, 0, 0, 0.6);
  }
  100% {
    border-color: #5227ff;
    box-shadow: 
      0 0 15px rgba(82, 39, 255, 0.7),
      0 0 30px rgba(82, 39, 255, 0.5),
      inset 0 0 20px rgba(82, 39, 255, 0.3),
      0 24px 40px -8px rgba(0, 0, 0, 0.6);
  }
}

.glass-modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.glass-modal::-webkit-scrollbar {
  width: 6px;
}
.glass-modal::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.glass-modal__header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.glass-modal__title {
  font-family: Impact, sans-serif;
  font-size: 2.2rem;
  letter-spacing: 1px;
  color: var(--white);
  margin-bottom: 8px;
  display: inline-block;
  width: fit-content;
  position: relative;
  padding-bottom: 8px;
  border-bottom: 3px solid rgba(255, 255, 255, 0.1);
  /* Underline metallic shine matching input underline */
  background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 0.8) 50%, rgba(255, 255, 255, 0) 75%, rgba(255, 255, 255, 0) 100%);
  background-size: 200% 3px;
  background-position: 150% 100%;
  background-repeat: no-repeat;
  animation: constantUnderlineShine 3s linear infinite;
}

.glass-modal__desc {
  font-size: 0.9rem;
  color: var(--gray-400);
}

.glass-modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--white);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.glass-modal__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.glass-preview-field {
  margin-bottom: 24px;
}

.glass-preview-field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-300);
  margin-bottom: 8px;
}

.glass-preview-field .required-star {
  color: #ef4444;
  margin-left: 4px;
}

.glass-preview-field input[type="text"],
.glass-preview-field input[type="email"],
.glass-preview-field input[type="number"],
.glass-preview-field input[type="tel"],
.glass-preview-field input[type="date"],
.glass-preview-field textarea,
.glass-preview-field select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.glass-preview-field input:focus,
.glass-preview-field textarea:focus,
.glass-preview-field select:focus {
  outline: none;
  border-color: var(--blue);
}

.glass-preview-field .structural-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--white);
  margin-top: 10px;
  margin-bottom: -10px;
}

.glass-preview-field .structural-desc {
  font-size: 0.95rem;
  color: var(--gray-400);
  line-height: 1.5;
  margin-top: 10px;
  margin-bottom: -10px;
}

.glass-preview-field .radio-check-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.glass-preview-field .radio-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-300);
  font-size: 0.95rem;
  cursor: pointer;
}

/* ============================================
   ELECTRIC SPINNER (LOADER)
   ============================================ */
.electric-spinner {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.05);
  border-top-color: #0ea5e9;
  border-right-color: #c026d3;
  border-bottom-color: #5227ff;
  animation: spin 1s linear infinite, spinnerGlow 2s infinite alternate ease-in-out;
}

@keyframes spinnerGlow {
  0% { box-shadow: 0 0 10px rgba(14, 165, 233, 0.5), inset 0 0 10px rgba(14, 165, 233, 0.5); }
  50% { box-shadow: 0 0 20px rgba(192, 38, 211, 0.7), inset 0 0 20px rgba(192, 38, 211, 0.7); }
  100% { box-shadow: 0 0 15px rgba(82, 39, 255, 0.6), inset 0 0 15px rgba(82, 39, 255, 0.6); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulseText {
  0% { opacity: 0.5; text-shadow: 0 0 5px rgba(255, 255, 255, 0.2); }
  100% { opacity: 1; text-shadow: 0 0 15px rgba(255, 255, 255, 0.8); }
}

/* ============================================
   MOTION BLUR TRANSITIONS (60FPS HARDWARE ACCEL)
   ============================================ */
.fade-out-blur {
  animation: fadeOutBlur 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: opacity, filter, transform;
}

.fade-in-blur {
  animation: fadeInBlur 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: opacity, filter, transform;
}

@keyframes fadeOutBlur {
  0% { opacity: 1; filter: blur(0px); transform: scale(1); }
  100% { opacity: 0; filter: blur(12px); transform: scale(0.95); }
}

@keyframes fadeInBlur {
  0% { opacity: 0; filter: blur(15px); transform: scale(1.05); }
  100% { opacity: 1; filter: blur(0px); transform: scale(1); }
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */
.toast {
  position: fixed;
  bottom: 80px;
  right: 40px;
  background: var(--white);
  color: var(--black);
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 2000;
  animation: toastSlideIn 0.4s ease, toastSlideOut 0.4s ease 2.6s forwards;
  box-shadow: var(--shadow-xl);
}

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

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

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-700);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-500);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .main {
    grid-template-columns: 1fr 320px;
  }
}

@media (max-width: 768px) {
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .panel {
    border-left: none;
    border-top: 1px solid var(--gray-800);
    max-height: none;
    position: static;
  }

  .header {
    padding: 20px 20px 16px;
  }

  .header__title-input {
    font-size: 1.3rem;
  }

  .tabs {
    padding: 0 20px;
  }

  .canvas {
    padding: 20px;
  }

  .footer {
    padding: 16px 20px;
  }

  .field-grid {
    grid-template-columns: 1fr 1fr;
  }

  .btn {
    padding: 10px 20px;
    font-size: 0.82rem;
  }
}

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

  .header__top {
    flex-direction: column;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
