/* ── Invoice Generator — scoped under .app-invoice ──────────────────────── */

.app-invoice {
  font-family: "Google Sans", system-ui, sans-serif;
  background-color: #e8e8e8;
  color: #333;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Action Toolbar */
.app-invoice .action-toolbar {
  position: sticky;
  top: 0;
  background-color: white;
  border-radius: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 12px 20px;
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 10;
  flex-shrink: 0;
}

.app-invoice .toolbar-title {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  margin-right: auto;
}

/* Invoice Tabs */
.app-invoice .invoice-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 20px 0;
  background: #f0f0f0;
  overflow-x: auto;
  flex-shrink: 0;
}

.app-invoice .invoice-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px 6px 12px;
  background: #ddd;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 13px;
  color: #555;
  transition: background 0.15s;
  white-space: nowrap;
  min-width: 80px;
  max-width: 160px;
}

.app-invoice .invoice-tab:hover {
  background: #ccc;
}

.app-invoice .invoice-tab.active {
  background: white;
  color: #1a1a1a;
  font-weight: 500;
}

.app-invoice .tab-name-input {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: inherit;
  font-weight: inherit;
  padding: 0;
  flex: 1;
  min-width: 40px;
  outline: none;
}

.app-invoice .tab-name-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-invoice .btn-delete-tab {
  background: transparent;
  border: none;
  color: #999;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  border-radius: 3px;
  flex-shrink: 0;
}

.app-invoice .btn-delete-tab:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #f44336;
  transform: none;
  box-shadow: none;
}

.app-invoice .btn-new-invoice {
  background: transparent;
  border: 1px dashed #aaa;
  color: #666;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.app-invoice .btn-new-invoice:hover {
  background: #e8f5e9;
  border-color: #4CAF50;
  color: #4CAF50;
  transform: none;
  box-shadow: none;
}

/* Meta label for separator settings */
.app-invoice .meta-label {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  min-width: 80px;
  text-align: left;
}

/* Scrollable content area */
.app-invoice .invoice-container {
  background-color: white;
  padding: 40px;
  max-width: 860px;
  width: 100%;
  margin: 20px auto 40px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  flex: 1;
}

/* Inline Editable Inputs */
.app-invoice .inline-input,
.app-invoice .inline-textarea {
  border: 1px solid transparent;
  background-color: transparent;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  padding: 4px 8px;
  margin: -4px -8px;
  border-radius: 4px;
  transition: all 0.2s;
  width: 100%;
}

.app-invoice .inline-input:hover,
.app-invoice .inline-textarea:hover {
  background-color: #f9f9f9;
  border-color: #e0e0e0;
}

.app-invoice .inline-input:focus,
.app-invoice .inline-textarea:focus {
  outline: none;
  background-color: #fff;
  border-color: #4CAF50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.app-invoice .inline-input::placeholder,
.app-invoice .inline-textarea::placeholder {
  color: #bbb;
  font-style: italic;
}

.app-invoice .inline-textarea {
  resize: none;
  min-height: 60px;
}

/* Editable Label Inputs — smaller, muted style */
.app-invoice .label-input {
  border: 1px solid transparent;
  background-color: transparent;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  font-weight: inherit;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: 3px;
  transition: all 0.2s;
  width: auto;
  min-width: 60px;
}

.app-invoice .label-input:hover {
  background-color: rgba(0, 0, 0, 0.04);
  border-color: #ddd;
}

.app-invoice .label-input:focus {
  outline: none;
  background-color: #fff;
  border-color: #9C27B0;
  box-shadow: 0 0 0 2px rgba(156, 39, 176, 0.1);
}

.app-invoice .label-input--th {
  color: white;
  width: 100%;
}

.app-invoice .label-input--th:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
}

.app-invoice .label-input--th:focus {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: white;
  box-shadow: none;
}

.app-invoice .label-input--section {
  width: 100%;
}

.app-invoice select {
  padding: 4px 8px;
  margin: -4px -8px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: inherit;
  font-family: inherit;
  background-color: transparent;
  transition: all 0.2s;
}

.app-invoice select:hover {
  background-color: #f9f9f9;
  border-color: #e0e0e0;
}

.app-invoice select:focus {
  outline: none;
  background-color: #fff;
  border-color: #4CAF50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

/* Buttons */
.app-invoice button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.app-invoice button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-invoice button:active {
  transform: translateY(0);
}

.app-invoice .btn-add {
  background-color: #4CAF50;
  color: white;
  margin-top: 10px;
  padding: 8px 20px;
}

.app-invoice .btn-add:hover { background-color: #45a049; }

.app-invoice .btn-remove {
  background-color: transparent;
  color: #f44336;
  padding: 5px;
  font-size: 18px;
  line-height: 1;
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.app-invoice .btn-remove:hover {
  background-color: #ffebee;
  color: #c62828;
}

.app-invoice .btn-save,
.app-invoice .btn-download-pdf {
  padding: 8px 18px;
  font-size: 14px;
}

.app-invoice .btn-save { background-color: #2196F3; color: white; }
.app-invoice .btn-save:hover { background-color: #1976D2; }

.app-invoice .btn-download-pdf { background-color: #FF9800; color: white; }
.app-invoice .btn-download-pdf:hover { background-color: #F57C00; }

/* Logo Upload */
.app-invoice .logo-upload-container {
  position: relative;
  display: inline-block;
  margin-bottom: 15px;
}

.app-invoice .logo-upload-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 150px;
  height: 80px;
  border: 2px dashed #bbb;
  border-radius: 8px;
  background-color: #fafafa;
  color: #888;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 15px;
}

.app-invoice .logo-upload-placeholder:hover {
  border-color: #9C27B0;
  background-color: #f3e5f5;
  color: #9C27B0;
}

.app-invoice .company-logo-editable {
  max-width: 150px;
  max-height: 80px;
  object-fit: contain;
  cursor: pointer;
  border: 2px dashed transparent;
  border-radius: 4px;
  padding: 5px;
  transition: all 0.2s;
  display: block;
}

.app-invoice .company-logo-editable:hover {
  border-color: #9C27B0;
  background-color: #f3e5f5;
}

.app-invoice .btn-remove-logo-inline {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: #f44336;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-invoice .btn-remove-logo-inline:hover {
  background-color: #c62828;
  transform: scale(1.1);
}

/* Invoice layout */
.app-invoice .invoice-title {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 16px 0;
  letter-spacing: 2px;
  text-align: right;
}

.app-invoice .invoice-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e0e0e0;
}

.app-invoice .company-info h2 {
  font-size: 20px;
  margin-bottom: 10px;
  color: #1a1a1a;
}

.app-invoice .company-info p,
.app-invoice .customer-section p,
.app-invoice .shipping-section p {
  margin: 5px 0;
  color: #555;
  line-height: 1.6;
}

.app-invoice .company-info .address,
.app-invoice .customer-section .address,
.app-invoice .shipping-section .address {
  margin-top: 10px;
  color: #777;
  font-size: 14px;
}

.app-invoice .invoice-meta { text-align: right; }

.app-invoice .invoice-meta div {
  margin: 8px 0;
  font-size: 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  justify-items: end;
}

.app-invoice .invoice-meta div strong { justify-self: start; }

.app-invoice .customer-shipping-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 20px;
}

.app-invoice .customer-section h3,
.app-invoice .shipping-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  color: #000;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

/* Invoice Table */
.app-invoice .invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.app-invoice .invoice-table th {
  background-color: #000;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: #fff;
  border-bottom: none;
}

.app-invoice .invoice-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e8e8e8;
  color: #333;
  font-size: 13px;
}

.app-invoice .invoice-table th:nth-child(2),
.app-invoice .invoice-table th:nth-child(3),
.app-invoice .invoice-table td:nth-child(2),
.app-invoice .invoice-table td:nth-child(3) {
  text-align: center;
}

.app-invoice .invoice-table th:nth-child(4),
.app-invoice .invoice-table td:nth-child(4) {
  text-align: right;
  padding-right: 5px;
}

.app-invoice .invoice-table th:last-child,
.app-invoice .invoice-table td:last-child {
  text-align: right;
}

/* Totals */
.app-invoice .invoice-totals {
  margin-left: auto;
  width: 300px;
  margin-bottom: 20px;
  margin-top: 30px;
}

.app-invoice .total-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

.app-invoice .total-row.total-final {
  border-top: 2px solid #333;
  margin-top: 8px;
  padding-top: 12px;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
}

/* Notes */
.app-invoice .invoice-notes {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
}

.app-invoice .invoice-notes h3 {
  font-size: 13px;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 8px;
}

.app-invoice .invoice-notes p {
  color: #555;
  line-height: 1.5;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 640px) {
  .app-invoice .invoice-container { padding: 20px 15px; }
  .app-invoice .invoice-header { grid-template-columns: 1fr; }
  .app-invoice .customer-shipping-section { grid-template-columns: 1fr; gap: 20px; }
}
