/* src/modules/EdrawPrintDialog.css */

/* Dialog Overlay - UPDATED */
.edraw-dlg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(107, 114, 128, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 2rem;
  font-family: sans-serif;
  overflow-y: auto;
  /* Allow scrolling for tall dialogs */
}

.edraw-dlg-container,
.edraw-dlg-container button,
.edraw-dlg-container input,
.edraw-dlg-container select,
.edraw-dlg-container legend {
  font-family: sans-serif;
}

/* Dialog Main Container - UPDATED */
.edraw-dlg-container {
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 100%;
  max-width: 46rem;
  /* REMOVED max-height and overflow-y to allow container to grow */
  transform: scale(1);
  display: flex;
  flex-direction: column;
  margin: auto;
  text-align: center;
  /* Ensures spacing and centering */
}

/* Dialog Body */
.edraw-dlg-body {
  padding: 1rem;
}

.edraw-dlg-body>*:not(:last-child) {
  margin-bottom: 1.5rem;
}

/* Fieldset styles */
.edraw-dlg-fieldset {
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
}

.edraw-dlg-fieldset legend {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.edraw-dlg-fieldset-flex-col {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.edraw-dlg-fieldset-flex-col>*:not(:last-child) {
  /* margin-bottom: 1.5rem; */
}

/* Printer Select and Print to File */
.edraw-dlg-printer-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.edraw-dlg-select {
  display: block;
  width: 100%;
  flex-grow: 1;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
}

.edraw-dlg-select:focus {
  border-color: #6366f1;
  outline: 1px solid #6366f1;
}

.edraw-dlg-checkbox-group {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.edraw-dlg-checkbox {
  height: 1rem;
  width: 1rem;
  border-radius: 0.25rem;
  border: 1px solid #d1d5db;
  color: #4f46e5;
  accent-color: #4f46e5;
}

.edraw-dlg-checkbox-label {
  margin-left: 0.5rem;
  display: block;
  font-size: 0.875rem;
  color: #111827;
}

/* Grid Layout */
.edraw-dlg-grid-cols-container {
  display: grid;
}

@media (min-width: 768px) {
  .edraw-dlg-grid-cols-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.edraw-dlg-grid-col-span-1>*:not(:last-child) {
  margin-bottom: 0.5rem;
}

/* Starting Label Grid Area - UPDATED */
.edraw-dlg-starting-label-area {
  margin-top: 0.5rem;
  background-color: #e5e7eb;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  padding: 0.5rem;
  /* REMOVED flex-grow: 1 to prevent vertical squishing */
  /* width: 100%; */
  min-height: 350px;
  /* Increased min-height for better default appearance */
}

#starting-label-grid {
  display: grid;
  gap: 0.25rem;
  width: 95%;
  height: 95%;
  aspect-ratio: 1/1;
}

.grid-cell {
  background-color: #cbd5e1;
  cursor: pointer;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.grid-cell:hover {
  background-color: #94a3b8;
}

.grid-cell.selected {
  background-color: #0ea5e9;
}

.grid-cell.rounded-sm {
  border-radius: 0.125rem;
}

.grid-cell.rounded-md {
  border-radius: 0.375rem;
}

.grid-cell.rounded-full {
  border-radius: 9999px;
  aspect-ratio: 1/1;
}

/* Labels & Inputs (general) */
.edraw-dlg-label-block {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
}

.edraw-dlg-label-inline {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}

.edraw-dlg-input-number,
.edraw-dlg-input-text {
  display: block;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  font-size: 0.875rem;
  padding: 0.375rem 0.5rem;
}

.edraw-dlg-input-number:focus,
.edraw-dlg-input-text:focus {
  border-color: #6366f1;
  outline: 1px solid #6366f1;
}

.edraw-dlg-input-number:disabled,
.edraw-dlg-input-text:disabled {
  background-color: #f3f4f6;
  cursor: not-allowed;
}

.edraw-dlg-input-number,
.edraw-dlg-input-text {
  /* Styles from .edraw-dlg-input-number */
  display: block;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  font-size: 0.875rem;
  padding: 0.375rem 0.5rem;
  /* Common disabled styles */
}

.edraw-dlg-input-number:disabled,
.edraw-dlg-input-text:disabled {
  background-color: #f3f4f6;
  cursor: not-allowed;
}

/* Radio button groups */
.edraw-dlg-radio-group {
  display: flex;
  gap: 1rem;
}

.edraw-dlg-radio-item {
  display: flex;
  align-items: center;
}

.edraw-dlg-radio-input {
  height: 1rem;
  width: 1rem;
  border: 1px solid #d1d5db;
  color: #4f46e5;
  accent-color: #4f46e5;
}

.edraw-dlg-radio-label {
  margin-left: 0.5rem;
  display: block;
  font-size: 0.875rem;
  color: #111827;
}

input[type=radio]:disabled+.edraw-dlg-radio-label {
  color: #9ca3af;
  cursor: not-allowed;
}

/* Vertical Item Group */
.edraw-dlg-vertical-item-group {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

/* Copies section specific layouts */
.edraw-dlg-copies-options>*:not(:last-child) {
  margin-bottom: 0.75rem;
}

.edraw-dlg-flex-items-center-spaced {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.edraw-dlg-flex-items-center-spaced.pl-2 {
  padding-left: 0.5rem;
}

/* Options section (print all/custom) */
.edraw-dlg-print-method-options {
  display: flex;
  align-items: center;
}

.edraw-dlg-print-method-options .edraw-dlg-radio-input:not(:first-of-type) {
  margin-left: 1rem;
}

.edraw-dlg-print-method-options .edraw-dlg-radio-label {
  /* padding: 0.5rem; */
}

.edraw-dlg-num-labels-container,
.edraw-dlg-custom-pages-container {
  display: flex;
  align-items: center;
}

.edraw-dlg-num-labels-container .edraw-dlg-label-inline,
.edraw-dlg-custom-pages-container .edraw-dlg-label-inline {
  margin-right: 0.5rem;
}

.edraw-dlg-custom-pages-container.hidden {
  display: none !important;
}

.edraw-dlg-custom-pages-container {
  /* margin-left: 1rem; */
}

/* Layers Dropdown */
.edraw-dlg-layers-dropdown-trigger {
  position: relative;
  width: 100%;
  cursor: pointer;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  background-color: white;
  padding: 0.5rem 2.5rem 0.5rem 0.75rem;
  text-align: left;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  font-size: 0.875rem;
  color: #111827;
}

.edraw-dlg-layers-dropdown-trigger:focus {
  border-color: #6366f1;
  outline: 1px solid #6366f1;
}

.edraw-dlg-layers-dropdown-trigger .truncate {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edraw-dlg-layers-dropdown-arrow {
  pointer-events: none;
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  display: flex;
  align-items: center;
  padding-right: 0.5rem;
}

.edraw-dlg-layers-dropdown-arrow .lucide {
  color: #9ca3af;
}

.edraw-dlg-layers-dropdown-panel {
  position: absolute;
  z-index: 20;
  margin-top: 0.25rem;
  width: 100%;
  max-height: 10rem;
  overflow-y: auto;
  border-radius: 0.375rem;
  background-color: white;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  font-size: 0.875rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.edraw-dlg-layers-dropdown-panel.hidden {
  display: none;
}

.edraw-dlg-layers-option-item {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
}

.edraw-dlg-layers-option-item:hover {
  background-color: #f3f4f6;
}

/* Dialog Footer */
.edraw-dlg-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.5rem;
  border-top: 1px solid #e5e7eb;
  background-color: #f9fafb;
  flex-shrink: 0;
  border-radius: 0.375rem;
}

.edraw-dlg-footer-buttons {
  display: flex;
  gap: 0.75rem;
}

.edraw-dlg-button {
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease-in-out;
}

.edraw-dlg-button-cancel {
  border-color: #d1d5db;
  color: #374151;
  background-color: white;
}

.edraw-dlg-button-cancel:hover {
  background-color: #f9fafb;
}

.edraw-dlg-button-save {
  border-color: #d1d5db;
  color: #374151;
  background-color: white;
}

.edraw-dlg-button-save:hover {
  background-color: #f9fafb;
}

.edraw-dlg-button-print {
  color: white;
  background-color: #4f46e5;
}

.edraw-dlg-button-print:hover {
  background-color: #4338ca;
}

/* Input number arrows */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  opacity: 1;
}

.edraw-dlg-layers-dropdown-arrow {
  margin-right: 10px;
  display: inline-block;
}

.edraw-dlg-error-text {
  color: #ef4444; /* red-500 */
  font-size: 0.75rem;
  margin-top: 0.25rem;
  text-align: left;
}
