/* ==========================================================================
   2. EDITOR SIDEBAR & CONTROL PANEL STYLES
   ========================================================================== */
.editor {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 28px 22px 24px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 16px;
}

.brand-mark {
  width: 27px;
  height: 27px;
  background: var(--accent);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 14px;
}

.eyebrow {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.editor h1 {
  font-size: 20px;
  letter-spacing: -0.035em;
  margin: 0 0 25px;
}

.section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.section:last-of-type {
  border-bottom: 0;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

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

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

.field.full {
  grid-column: 1 / -1;
}

label {
  font-size: 11px;
  font-weight: 600;
  color: #334155;
}

input,
textarea,
select {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
  font-family: inherit;
  background: var(--input-bg);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: var(--accent);
  transition: all 120ms ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #e9eef5;
}

/* Currency, Language, Tax, Template & Document Type Toggle */
.currency-toggle,
.lang-toggle,
.tax-toggle,
.template-toggle,
.doctype-toggle {
  display: flex;
  background: var(--bg);
  padding: 3px;
  border-radius: 8px;
  height: 38px;
}

.currency-toggle button,
.lang-toggle button,
.tax-toggle button,
.template-toggle button,
.doctype-toggle button {
  border: 0;
  background: transparent;
  border-radius: 6px;
  flex: 1;
  font-size: 11px;
  color: var(--muted);
  transition: all 150ms ease-out;
  cursor: pointer;
}

.currency-toggle button.active,
.lang-toggle button.active,
.tax-toggle button.active,
.template-toggle button.active,
.doctype-toggle button.active {
  background: #ffffff;
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 1px 2px #00000010;
}

.tax-toggle button.off {
  background: var(--redbg);
  color: var(--red);
  font-weight: 700;
}

/* Logo Dropzone */
.dropzone {
  position: relative;
  border: 1px dashed #b9c0cb;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  background: var(--bg);
  cursor: pointer;
  transition: background 150ms;
}

.dropzone:hover {
  background: #f1f5f9;
}

.dropzone input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone img {
  max-height: 50px;
  max-width: 180px;
  margin: 0 auto;
  display: none;
}

.remove-logo {
  font-size: 11px;
  color: var(--red);
  background: none;
  border: 0;
  cursor: pointer;
  margin-top: 6px;
  display: none;
}

.remove-logo.show {
  display: inline-block;
}

/* Line Items Editor Rows */
.items-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-edit {
  display: grid;
  grid-template-columns: 2fr 0.8fr 1fr 0.8fr 24px;
  gap: 6px;
  align-items: end;
  background: var(--bg);
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.item-edit textarea[data-prop="description"] {
  min-height: 32px;
  height: 32px;
  line-height: 16px;
  resize: none;
  overflow: hidden;
}

.icon-btn {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  height: 32px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.icon-btn:hover {
  color: var(--red);
  background: var(--redbg);
}

.add-item {
  width: 100%;
  padding: 8px;
  border: 1px dashed #cbd5e1;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 120ms;
}

.add-item:hover {
  background: var(--bg);
  border-color: var(--accent);
}

/* Status Select Buttons */
.status-toggle {
  display: flex;
  gap: 8px;
}

.status-toggle button {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;

}

.status-toggle button.paid.active {
  background: var(--greenbg);
  color: var(--green);
  border-color: var(--green);
}

.status-toggle button.unpaid.active {
  background: var(--amberbg);
  color: var(--amber);
  border-color: var(--amber);
}

/* Customer Quick Actions */
.customer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.text-button {
  border: 0;
  background: none;
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.text-button:hover {
  text-decoration: underline;
}

.feedback {
  font-size: 11px;
  color: var(--green);
  opacity: 0;
  transition: opacity 200ms;
}

.feedback.show {
  opacity: 1;
}

/* Primary Action Button (PDF Download) */
.download {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 4px #00000015;
  transition: background 120ms;
  margin-top: 16px;
}

.download:hover {
  background: var(--accent-hover);
}

/* Database History Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #00000060;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 820px;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px #00000020;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.history-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.history-table th {
  background: #f8fafc;
  color: #475569;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

.history-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

.history-table tr:hover td {
  background: #f8fafc;
}

.code-box {
  background: #1e293b;
  color: #f1f5f9;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: monospace;
  font-size: 11px;
}
