/* =========================================================
   Flexbox Generator — Plugin Styles
   ========================================================= */

#fbg-app {
  --fbg-bg:        #0f1117;
  --fbg-surface:   #181c27;
  --fbg-surface2:  #1e2436;
  --fbg-border:    #2a3050;
  --fbg-accent:    #4f8cff;
  --fbg-accent2:   #7c5cfc;
  --fbg-text:      #e2e8f8;
  --fbg-text-dim:  #7a869c;
  --fbg-green:     #22d3a5;
  --fbg-red:       #ff5370;
  --fbg-pill-bg:   #232a3d;
  --fbg-pill-act:  #4f8cff;
  --fbg-radius:    8px;
  --fbg-font:      'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --fbg-sans:      'Inter', 'Segoe UI', sans-serif;

  font-family: var(--fbg-sans);
  background: var(--fbg-bg);
  color: var(--fbg-text);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--fbg-border);
  box-shadow: 0 8px 48px rgba(0,0,0,.55);
  max-width: 550px;
  margin: 24px auto;
}

/* ---- HEADER ---- */
.fbg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--fbg-surface);
  border-bottom: 1px solid var(--fbg-border);
}
.fbg-logo {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--fbg-accent);
}
.fbg-header-actions { display: flex; gap: 8px; }

/* ---- BODY ---- */
.fbg-body {
  display: flex;
  min-height: 520px;
}

/* ---- SIDEBAR ---- */
.fbg-sidebar {
  width: 320px;
  min-width: 280px;
  background: var(--fbg-surface);
  border-right: 1px solid var(--fbg-border);
  overflow-y: auto;
  max-height: 80vh;
}

.fbg-section {
  padding: 16px 16px 20px;
  border-bottom: 1px solid var(--fbg-border);
}
.fbg-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--fbg-text-dim);
  margin-bottom: 14px;
}

/* ---- BADGES ---- */
.fbg-badge {
  display: inline-block;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-right: 6px;
}
.fbg-badge-container { background: rgba(79,140,255,.18); color: #4f8cff; }
.fbg-badge-item      { background: rgba(124,92,252,.18); color: #9b7bff; }

/* ---- FIELDS ---- */
.fbg-field {
  margin-bottom: 14px;
}
.fbg-field label {
  display: block;
  font-size: 11px;
  font-family: var(--fbg-font);
  color: var(--fbg-accent);
  margin-bottom: 6px;
  letter-spacing: .02em;
}
.fbg-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.fbg-field-row label {
  margin-bottom: 0;
  min-width: 80px;
}
.fbg-hint {
  font-size: 10px;
  color: var(--fbg-text-dim);
}
.fbg-input-pair {
  display: flex;
  align-items: center;
  gap: 4px;
}
.fbg-unit {
  font-size: 11px;
  color: var(--fbg-text-dim);
  font-family: var(--fbg-font);
}

/* ---- PILLS ---- */
.fbg-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.fbg-pill {
  background: var(--fbg-pill-bg);
  border: 1px solid var(--fbg-border);
  color: var(--fbg-text-dim);
  font-family: var(--fbg-font);
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 5px;
  cursor: pointer;
  transition: all .15s;
  outline: none;
}
.fbg-pill:hover {
  border-color: var(--fbg-accent);
  color: var(--fbg-text);
}
.fbg-pill.active {
  background: var(--fbg-pill-act);
  border-color: var(--fbg-pill-act);
  color: #fff;
  font-weight: 600;
}

/* ---- INPUTS ---- */
.fbg-input {
  background: var(--fbg-surface2);
  border: 1px solid var(--fbg-border);
  color: var(--fbg-text);
  font-family: var(--fbg-font);
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 5px;
  width: 70px;
  outline: none;
  transition: border-color .15s;
}
.fbg-input-sm { width: 60px; }
.fbg-input:focus { border-color: var(--fbg-accent); }

/* ---- BUTTONS ---- */
.fbg-btn {
  font-family: var(--fbg-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all .15s;
  outline: none;
}
.fbg-btn-primary {
  background: var(--fbg-accent);
  color: #fff;
}
.fbg-btn-primary:hover { background: #3a78f5; }
.fbg-btn-ghost {
  background: transparent;
  color: var(--fbg-text-dim);
  border: 1px solid var(--fbg-border);
}
.fbg-btn-ghost:hover { color: var(--fbg-text); border-color: var(--fbg-text-dim); }
.fbg-btn-sm {
  padding: 4px 10px;
  font-size: 11px;
  background: var(--fbg-surface2);
  color: var(--fbg-text-dim);
  border: 1px solid var(--fbg-border);
}
.fbg-btn-sm:hover { color: var(--fbg-text); border-color: var(--fbg-text-dim); }
.fbg-btn-danger { color: var(--fbg-red) !important; border-color: rgba(255,83,112,.3) !important; }
.fbg-btn-danger:hover { background: rgba(255,83,112,.1) !important; }

/* ---- ITEM TABS ---- */
.fbg-item-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}
.fbg-item-tab {
  background: var(--fbg-pill-bg);
  border: 1px solid var(--fbg-border);
  color: var(--fbg-text-dim);
  font-family: var(--fbg-font);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all .15s;
}
.fbg-item-tab.active {
  background: var(--fbg-accent2);
  border-color: var(--fbg-accent2);
  color: #fff;
}

/* ---- MAIN ---- */
.fbg-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

/* ---- PREVIEW ---- */
.fbg-preview-wrap {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--fbg-border);
  flex: 0 0 auto;
}
.fbg-preview-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--fbg-text-dim);
  margin-bottom: 10px;
}
.fbg-preview-outer {
  background: #13172000;
  border: 2px dashed var(--fbg-border);
  border-radius: 8px;
  padding: 10px;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255,255,255,.013) 10px,
    rgba(255,255,255,.013) 20px
  );
}
.fbg-preview {
  display: flex;
  min-height: 200px;
  transition: all .2s;
  position: relative;
}
.fbg-item {
  background: linear-gradient(135deg, #4f8cff22, #7c5cfc33);
  border: 2px solid #4f8cff55;
  color: var(--fbg-accent);
  font-family: var(--fbg-font);
  font-size: 12px;
  font-weight: 600;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all .2s;
  cursor: default;
  user-select: none;
}
.fbg-item.selected {
  border-color: #7c5cfc;
  background: linear-gradient(135deg, #7c5cfc33, #7c5cfc55);
  color: #b49bff;
  box-shadow: 0 0 0 2px #7c5cfc55;
}

/* ---- CSS OUTPUT ---- */
.fbg-output-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 20px 16px;
  position: relative;
  overflow: hidden;
}
.fbg-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.fbg-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fbg-text-dim);
  cursor: pointer;
}
.fbg-checkbox-label input { accent-color: var(--fbg-accent); cursor: pointer; }
.fbg-code {
  background: var(--fbg-surface2);
  border: 1px solid var(--fbg-border);
  color: var(--fbg-green);
  font-family: var(--fbg-font);
  font-size: 12px;
  line-height: 1.7;
  padding: 14px 16px;
  border-radius: 8px;
  margin: 0;
  overflow-y: auto;
  flex: 1;
  white-space: pre;
  tab-size: 2;
}
.fbg-copy-toast {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: var(--fbg-green);
  color: #0f1117;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 18px;
  border-radius: 20px;
  opacity: 0;
  transform: translateY(8px);
  transition: all .25s;
  pointer-events: none;
}
.fbg-copy-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---- SCROLLBAR ---- */
.fbg-sidebar::-webkit-scrollbar,
.fbg-code::-webkit-scrollbar { width: 5px; height: 5px; }
.fbg-sidebar::-webkit-scrollbar-track,
.fbg-code::-webkit-scrollbar-track { background: transparent; }
.fbg-sidebar::-webkit-scrollbar-thumb,
.fbg-code::-webkit-scrollbar-thumb { background: var(--fbg-border); border-radius: 3px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 720px) {
  .fbg-body { flex-direction: column; }
  .fbg-sidebar { width: 100%; max-height: none; border-right: none; border-bottom: 1px solid var(--fbg-border); }
  .fbg-code { font-size: 11px; }
}
