/* ===== ch_support_new_ticket_html (HTML form, scoped) =====
   The New Ticket / Follow-up slide-in panel. Loaded eagerly from anvil.yaml
   native_deps.head_html.

   SCOPE. Every rule is :where(.ch-new-ticket-panel), the form's root class,
   which adds no specificity. The root rule itself stays bare. The
   .ch-form-group family is scoped to the panel, so it never restyles the
   Service Requests cards.

   quill.snow.css is appended to <head> on first use by ch_support_tickets.mjs,
   after every head link, so it comes after these rules and wins the .ql-* ties
   below.

   .nt-hidden hides the file input. */

.ch-new-ticket-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px;
  background: var(--ch-bg-card);
  overflow-y: auto;
}

:where(.ch-new-ticket-panel) .ch-new-ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ch-border);
}

:where(.ch-new-ticket-panel) .ch-new-ticket-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--ch-text-primary);
}

:where(.ch-new-ticket-panel) .ch-new-ticket-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--ch-text-secondary);
  padding: 4px 8px;
  border-radius: var(--ch-radius-sm);
}

:where(.ch-new-ticket-panel) .ch-new-ticket-close:hover {
  background: var(--ch-bg-hover);
}

:where(.ch-new-ticket-panel) .ch-new-ticket-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

:where(.ch-new-ticket-panel) .ch-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

:where(.ch-new-ticket-panel) .ch-form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ch-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

:where(.ch-new-ticket-panel) .ch-form-group select,
:where(.ch-new-ticket-panel) .ch-form-group input[type="text"] {
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--ch-font-primary);
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius-md);
  background: #fff;
  color: var(--ch-text-primary);
  min-height: 40px;
}

:where(.ch-new-ticket-panel) .ch-form-group select:focus,
:where(.ch-new-ticket-panel) .ch-form-group input:focus {
  outline: 2px solid var(--ch-border-focus);
  outline-offset: -1px;
}

:where(.ch-new-ticket-panel) .ch-form-group input:read-only {
  background: var(--ch-bg-hover);
  color: var(--ch-text-secondary);
  cursor: not-allowed;
}

:where(.ch-new-ticket-panel) .ch-priority-group {
  display: flex;
  gap: 16px;
  align-items: center;
}

:where(.ch-new-ticket-panel) .ch-priority-group label.ch-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  color: var(--ch-text-primary);
}

:where(.ch-new-ticket-panel) .ch-char-count {
  font-size: 12px;
  color: var(--ch-text-secondary);
  text-align: right;
}

:where(.ch-new-ticket-panel) .ch-char-count.ch-over-limit {
  color: var(--ch-status-complaint);
  font-weight: 600;
}

/* Quill editor area */
:where(.ch-new-ticket-panel) .ch-editor-wrapper {
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius-md);
  overflow: hidden;
}

:where(.ch-new-ticket-panel) .ch-editor-wrapper .ql-toolbar {
  border: none;
  border-bottom: 1px solid var(--ch-border);
}

:where(.ch-new-ticket-panel) .ch-editor-wrapper .ql-container {
  border: none;
  min-height: 150px;
  font-size: 14px;
}

:where(.ch-new-ticket-panel) .ch-editor-wrapper .ql-editor {
  min-height: 150px;
}

:where(.ch-new-ticket-panel) .ch-editor-wrapper .ql-editor.ql-blank::before {
  color: var(--ch-text-secondary);
  font-style: normal;
}

/* Drop zone */
:where(.ch-new-ticket-panel) .ch-drop-zone {
  border: 2px dashed var(--ch-border);
  border-radius: var(--ch-radius-md);
  padding: 16px;
  text-align: center;
  color: var(--ch-text-secondary);
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

:where(.ch-new-ticket-panel) .ch-drop-zone.ch-dragover {
  border-color: var(--ch-accent-primary);
  background: rgba(2, 1, 52, 0.08);
}

:where(.ch-new-ticket-panel) .ch-drop-zone-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 14px;
  font-size: 13px;
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius-sm);
  background: #fff;
  cursor: pointer;
  color: var(--ch-text-primary);
}

:where(.ch-new-ticket-panel) .ch-drop-zone-btn:hover {
  background: var(--ch-bg-hover);
}

:where(.ch-new-ticket-panel) .ch-file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

:where(.ch-new-ticket-panel) .ch-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--ch-bg-hover);
  border-radius: var(--ch-radius-sm);
  font-size: 13px;
}

:where(.ch-new-ticket-panel) .ch-file-item .ch-file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:where(.ch-new-ticket-panel) .ch-file-item .ch-file-status {
  font-size: 12px;
  color: var(--ch-text-secondary);
}

:where(.ch-new-ticket-panel) .ch-file-item .ch-file-status.ch-file-error {
  color: var(--ch-status-complaint);
}

:where(.ch-new-ticket-panel) .ch-file-item .ch-file-status.ch-file-success {
  color: var(--ch-status-feedback);
}

:where(.ch-new-ticket-panel) .ch-file-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ch-text-secondary);
  font-size: 16px;
  padding: 2px 4px;
}

:where(.ch-new-ticket-panel) .ch-file-remove:hover {
  color: var(--ch-status-complaint);
}



/* Submit area */
:where(.ch-new-ticket-panel) .ch-new-ticket-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--ch-border);
}

:where(.ch-new-ticket-panel) .ch-btn-cancel {
  padding: 10px 20px;
  font-size: 14px;
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius-md);
  background: #fff;
  cursor: pointer;
  color: var(--ch-text-primary);
}

:where(.ch-new-ticket-panel) .ch-btn-cancel:hover {
  background: var(--ch-bg-hover);
}

:where(.ch-new-ticket-panel) .ch-btn-submit-ticket {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--ch-radius-md);
  background: var(--ch-accent-primary);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

:where(.ch-new-ticket-panel) .ch-btn-submit-ticket:hover:not(:disabled) {
  background: var(--ch-accent-primary-hover);
}

:where(.ch-new-ticket-panel) .ch-btn-submit-ticket:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

:where(.ch-new-ticket-panel) .ch-new-ticket-error {
  display: none;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--ch-radius-md);
  color: var(--ch-status-complaint);
  font-size: 13px;
}

:where(.ch-new-ticket-panel) .ch-new-ticket-error.visible {
  display: block;
}

:where(.ch-new-ticket-panel) .ch-draft-warning {
  display: none;
  padding: 8px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--ch-radius-sm);
  color: #92400e;
  font-size: 12px;
}

:where(.ch-new-ticket-panel) .ch-draft-warning.visible {
  display: block;
}

:where(.ch-new-ticket-panel) .nt-hidden {
  display: none;
}
