/* public/css/dev.css */

/* DevZone Root Container */
.dev-zone-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: #0b1329;
  color: #e2e8f0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow: hidden;
  box-sizing: border-box;
}

/* Header Bar */
.dev-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #111e38;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
  gap: 16px;
}

.dev-header-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dev-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.3);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 9999px;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dev-header-title h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.01em;
}

.dev-subtext {
  margin: 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.dev-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dev-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.dev-btn-primary {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
}

.dev-btn-primary:hover {
  background: #0369a1;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.dev-btn-secondary {
  background: #1e293b;
  color: #cbd5e1;
  border-color: #334155;
}

.dev-btn-secondary:hover {
  background: #334155;
  color: #f8fafc;
}

.dev-btn-danger {
  background: #450a0a;
  color: #fca5a5;
  border-color: #7f1d1d;
}

.dev-btn-danger:hover {
  background: #7f1d1d;
  color: #ffffff;
}

.dev-btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #1e293b;
  border: 1px solid #38bdf8;
  color: #38bdf8;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.dev-btn-sm:hover {
  background: #0284c7;
  color: #ffffff;
}

/* Layout Split */
.dev-main-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Sidebar List Pane */
.dev-sidebar-pane {
  width: 320px;
  min-width: 300px;
  max-width: 360px;
  background: #0e172a;
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dev-search-wrapper {
  position: relative;
  padding: 12px 14px;
  border-bottom: 1px solid #1e293b;
}

.dev-search-icon {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 0.85rem;
}

.dev-search-wrapper input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #f8fafc;
  font-size: 0.8rem;
  box-sizing: border-box;
}

.dev-search-wrapper input:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.dev-filter-bar {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid #1e293b;
  background: #09101f;
}

.dev-filter-bar label {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dev-filter-bar select {
  padding: 6px 10px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
}

.dev-item-count-bar {
  padding: 6px 14px;
  font-size: 0.68rem;
  color: #64748b;
  background: #0b1329;
  border-bottom: 1px solid #1e293b;
}

.dev-item-list-container {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.dev-item-list-container::-webkit-scrollbar {
  width: 5px;
}
.dev-item-list-container::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

.dev-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #162033;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.dev-item-row:hover {
  background: #1e293b;
}

.dev-item-row.active {
  background: #0369a1;
  border-left: 4px solid #38bdf8;
}

.dev-row-icon {
  font-size: 1.4rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e293b;
  border-radius: 6px;
  flex-shrink: 0;
}

.dev-item-row.active .dev-row-icon {
  background: #0284c7;
}

.dev-row-info {
  flex: 1;
  min-width: 0;
}

.dev-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.dev-row-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dev-row-badge {
  font-size: 0.62rem;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 700;
  background: #1e293b;
  color: #94a3b8;
}

.rarity-common .rarity-badge { color: #94a3b8; border: 1px solid #334155; }
.rarity-uncommon .rarity-badge { color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.4); }
.rarity-rare .rarity-badge { color: #60a5fa; border: 1px solid rgba(96, 165, 250, 0.4); }
.rarity-epic .rarity-badge { color: #c084fc; border: 1px solid rgba(192, 132, 252, 0.4); }
.rarity-legendary .rarity-badge { color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.4); }
.rarity-masterwork .rarity-badge { color: #f472b6; border: 1px solid rgba(244, 114, 182, 0.4); }

.dev-row-sub {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 2px;
}

.dev-row-key code {
  font-family: 'Fira Code', monospace;
  color: #7dd3fc;
}

.dev-list-loading,
.dev-list-empty,
.dev-list-error {
  padding: 24px 16px;
  text-align: center;
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.dev-list-error { color: #f87171; }

/* Workspace Editor */
.dev-editor-workspace {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 24px 32px;
  box-sizing: border-box;
  background: #0b1329;
}

.dev-editor-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: #64748b;
  gap: 12px;
}

.empty-icon-circle {
  font-size: 2.8rem;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111e38;
  border-radius: 50%;
  color: #38bdf8;
  border: 1px solid #1e293b;
}

.dev-editor-empty h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #cbd5e1;
}

.dev-editor-empty p {
  margin: 0;
  font-size: 0.82rem;
  max-width: 420px;
}

.dev-editor-card {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dev-editor-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #111e38;
  padding: 16px 20px;
  border-radius: 10px;
  border: 1px solid #1e293b;
}

.dev-editor-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.editor-icon-preview {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e293b;
  border-radius: 8px;
  border: 1px solid #334155;
}

.dev-editor-title-group h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #f8fafc;
}

.highlight-name {
  color: #38bdf8;
}

.dev-key-tag {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 3px;
}

.dev-key-tag code {
  font-family: 'Fira Code', monospace;
  color: #facc15;
}

.dev-editor-btn-group {
  display: flex;
  gap: 10px;
}

/* Sections & Form Grid */
.dev-editor-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dev-section-group {
  background: #111e38;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 18px 20px;
}

.dev-section-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.dev-section-title {
  margin: 0 0 14px 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dev-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

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

.dev-form-field label {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dev-form-field input,
.dev-form-field select,
.dev-section-group textarea {
  width: 100%;
  padding: 8px 12px;
  background: #0b1329;
  border: 1px solid #1e293b;
  border-radius: 6px;
  color: #f1f5f9;
  font-size: 0.82rem;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.dev-form-field input:focus,
.dev-form-field select:focus,
.dev-section-group textarea:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.dev-section-group textarea {
  resize: vertical;
  min-height: 80px;
}

.dev-empty-text {
  font-size: 0.78rem;
  color: #64748b;
  font-style: italic;
  margin: 0;
  grid-column: 1 / -1;
}

/* Dynamic Builders (Recipe & Yields) */
.dev-recipe-builder-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.dev-recipe-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: #0b1329;
  padding: 10px 14px;
  border: 1px solid #1e293b;
  border-radius: 6px;
  flex-wrap: wrap;
}

.dev-recipe-select-col {
  flex: 3;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dev-recipe-qty-col {
  flex: 1;
  min-width: 70px;
  max-width: 90px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dev-recipe-name-col {
  flex: 2;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dev-recipe-mini-col {
  flex: 1;
  min-width: 75px;
  max-width: 95px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dev-recipe-row label {
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
}

.dev-recipe-row select,
.dev-recipe-row input {
  padding: 6px 10px;
  background: #111e38;
  border: 1px solid #334155;
  color: #f1f5f9;
  border-radius: 4px;
  font-size: 0.78rem;
  box-sizing: border-box;
}

.dev-recipe-row select:focus,
.dev-recipe-row input:focus {
  outline: none;
  border-color: #38bdf8;
}

.dev-btn-remove-row {
  background: transparent;
  color: #ef4444;
  border: none;
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  height: 32px;
  margin-left: auto;
}

.dev-btn-remove-row:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.dev-empty-subrow {
  font-size: 0.78rem;
  color: #64748b;
  font-style: italic;
  padding: 10px 0;
}

/* Raw Code / JSON Inspector */
.dev-code-preview-group {
  background: #09101f;
  border: 1px solid #1e293b;
}

.dev-code-viewer {
  margin: 0;
  padding: 14px 16px;
  background: #050a14;
  border: 1px solid #162033;
  border-radius: 8px;
  max-height: 260px;
  overflow-y: auto;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #38bdf8;
  box-sizing: border-box;
}

.dev-code-viewer code {
  color: #7dd3fc;
  white-space: pre;
}

@media (max-width: 900px) {
  .dev-main-layout {
    flex-direction: column;
  }
  .dev-sidebar-pane {
    width: 100%;
    max-width: none;
    height: 220px;
    border-right: none;
    border-bottom: 1px solid #1e293b;
  }
}
