* { box-sizing: border-box; }

/* ══════════════════
   LAYOUT
══════════════════ */
#main-section {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}
.np-right-col { display: flex; flex-direction: column; gap: 16px; }
.np-examples-outer { display: none; }
.np-examples-inner { display: block; }

/* ══════════════════
   EDITOR SECTION
══════════════════ */
.np-editor-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(99,102,241,0.07);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ══════════════════
   TOOLBAR
══════════════════ */
.np-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f8f9ff;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 6px;
}
.np-toolbar-left,
.np-toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}
.np-tool-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
}
.np-tool-btn:hover {
  background: #ede9fe;
  border-color: #c7d2fe;
  color: #4338ca;
}
.np-clear-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}
.np-divider {
  width: 1px; height: 22px;
  background: #e2e8f0;
  margin: 0 4px;
}
.np-font-size,
.np-select {
  padding: 5px 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
.np-font-size:focus,
.np-select:focus { border-color: #818cf8; }

/* ══════════════════
   EDITOR AREA
══════════════════ */
.np-editor {
  min-height: 460px;
  padding: 20px 24px;
  font-size: 16px;
  line-height: 1.8;
  color: #1e293b;
  outline: none;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
  font-family: sans-serif;
}
.np-editor:empty::before {
  content: attr(data-placeholder);
  color: #cbd5e1;
  pointer-events: none;
  white-space: pre-wrap;
}
.np-editor ul { padding-left: 24px; list-style: disc; margin: 8px 0; }
.np-editor ol { padding-left: 24px; list-style: decimal; margin: 8px 0; }
.np-editor li { margin-bottom: 4px; }

/* Focus Mode */
#main-section.np-focus .np-right-col { display: none; }
#main-section.np-focus { grid-template-columns: 1fr; }
.np-editor-section.np-focus .np-editor { min-height: 600px; }

/* ══════════════════
   STATUS BAR
══════════════════ */
.np-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #f8f9ff;
  border-top: 1px solid #e2e8f0;
  font-size: 0.76rem;
  color: #94a3b8;
  flex-wrap: wrap;
  gap: 4px;
}
.np-status-left { display: flex; align-items: center; gap: 6px; }
.np-status-dot { color: #cbd5e1; }
.np-save-status {
  font-size: 0.75rem;
  font-weight: 600;
  color: #22c55e;
  display: flex;
  align-items: center;
  gap: 4px;
}
.np-save-status::before {
  content: '';
  width: 6px; height: 6px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
}
.np-save-status.saving { color: #f59e0b; }
.np-save-status.saving::before { background: #f59e0b; }

/* ══════════════════
   ACTION CARD
══════════════════ */
.np-action-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(99,102,241,0.05);
}
.np-section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.np-section-title svg { stroke: #6366f1; flex-shrink: 0; }

/* Action buttons */
.np-action-btns { display: flex; flex-direction: column; gap: 8px; }
.np-download-btn {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none; border-radius: 9px;
  font-size: 0.84rem; font-weight: 700;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.12s;
}
.np-download-btn:hover { opacity: 0.88; transform: scale(1.01); }
.np-download-html {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
}
.np-copy-btn-all {
  background: linear-gradient(135deg, #10b981, #059669);
}
.np-print-btn {
  background: #f1f5f9;
  color: #475569;
  border: 1.5px solid #e2e8f0;
}
.np-print-btn svg { stroke: #6366f1; }
.np-print-btn:hover { background: #ede9fe; color: #4338ca; opacity: 1; }

/* ══════════════════
   SETTINGS
══════════════════ */
.np-settings { display: flex; flex-direction: column; gap: 10px; }
.np-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
}
.np-select { font-size: 0.78rem; padding: 4px 8px; }

/* Toggle Switch */
.np-toggle {
  position: relative;
  width: 40px; height: 22px;
  cursor: pointer;
}
.np-toggle input { display: none; }
.np-toggle-slider {
  position: absolute; inset: 0;
  background: #e2e8f0;
  border-radius: 22px;
  transition: background 0.2s;
}
.np-toggle-slider::after {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.np-toggle input:checked + .np-toggle-slider { background: #6366f1; }
.np-toggle input:checked + .np-toggle-slider::after { transform: translateX(18px); }

/* Template buttons */
.np-template-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* ══════════════════
   PRINT STYLE
══════════════════ */
@media print {
  body > *:not(#main-section) { display: none !important; }
  .np-right-col,
  .np-toolbar,
  .np-status-bar,
  header, footer,
  .tool-heading { display: none !important; }
  .np-editor-section { box-shadow: none; border: none; }
  .np-editor { min-height: unset; padding: 0; }
  #main-section { display: block; }
}

/* ══════════════════
   DARK MODE
══════════════════ */
body.dark-mode .np-editor-section,
body.dark-mode .np-action-card { background: #0f172a; border-color: #1e293b; }
body.dark-mode .np-toolbar { background: #1e293b; border-color: #334155; }
body.dark-mode .np-tool-btn { color: #94a3b8; }
body.dark-mode .np-tool-btn:hover { background: #312e81; border-color: #4338ca; color: #a5b4fc; }
body.dark-mode .np-clear-btn:hover { background: #2d1515; border-color: #7f1d1d; color: #fca5a5; }
body.dark-mode .np-divider { background: #334155; }
body.dark-mode .np-font-size,
body.dark-mode .np-select { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.dark-mode .np-editor { color: #e2e8f0; }
body.dark-mode .np-editor:empty::before { color: #334155; }
body.dark-mode .np-status-bar { background: #1e293b; border-color: #334155; color: #475569; }
body.dark-mode .np-section-title { color: #e2e8f0; }
body.dark-mode .np-setting-row { color: #94a3b8; }
body.dark-mode .np-toggle-slider { background: #334155; }
body.dark-mode .np-print-btn { background: #1e293b; border-color: #334155; color: #94a3b8; }
body.dark-mode .np-print-btn:hover { background: #1e1b4b; color: #a5b4fc; }

/* ══════════════════
   RESPONSIVE
══════════════════ */
@media (max-width: 900px) {
  #main-section { grid-template-columns: 1fr; }
  .np-examples-inner { display: none !important; }
  .np-examples-outer { display: block; }
  .np-right-col { flex-direction: row; flex-wrap: wrap; }
  .np-right-col > * { flex: 1 1 260px; }
}
@media (max-width: 500px) {
  .np-editor { min-height: 300px; padding: 14px; }
  .np-right-col { flex-direction: column; }
  .np-toolbar { padding: 8px 10px; }
}