/*
 * Promtek Mail — warm compose-screen colour correction.
 *
 * This file is deliberately limited to Roundcube's mail composer. It changes
 * colours and focus states only; editor, recipient, attachment, and sending
 * behaviour remain owned by Roundcube.
 */

html:not(.iframe) body.task-mail.action-compose {
  --promtek-compose-addon: var(--promtek-selection);
  --promtek-compose-canvas: var(--promtek-content);
  --promtek-compose-drop: var(--promtek-content);
  --promtek-compose-knob: var(--promtek-faint);
}

/* Recipient, identity, and subject controls. */
html:not(.iframe) body.task-mail.action-compose #compose-headers .form-control,
html:not(.iframe) body.task-mail.action-compose #compose-headers .custom-select,
html:not(.iframe) body.task-mail.action-compose #compose-headers .recipient-input {
  color: var(--promtek-text) !important;
  background-color: var(--promtek-control) !important;
  border-color: var(--promtek-border) !important;
}

html:not(.iframe) body.task-mail.action-compose #compose-headers .recipient-input input {
  color: var(--promtek-text) !important;
  background: transparent !important;
}

html:not(.iframe) body.task-mail.action-compose #compose-headers .recipient-input.focus,
html:not(.iframe) body.task-mail.action-compose #compose-headers .form-control:focus,
html:not(.iframe) body.task-mail.action-compose #compose-headers .custom-select:focus {
  border-color: var(--promtek-accent) !important;
  outline: 0 !important;
  box-shadow: 0 0 0 .2rem var(--promtek-focus-ring) !important;
}

html:not(.iframe) body.task-mail.action-compose #compose-headers .recipient-input li.recipient {
  color: var(--promtek-text) !important;
  background-color: var(--promtek-selection) !important;
  border-color: var(--promtek-border) !important;
}

html:not(.iframe) body.task-mail.action-compose #compose-headers .input-group-text {
  color: var(--promtek-text) !important;
  background-color: var(--promtek-compose-addon) !important;
  border-color: var(--promtek-border) !important;
}

html:not(.iframe) body.task-mail.action-compose #compose-headers a.input-group-text:hover,
html:not(.iframe) body.task-mail.action-compose #compose-headers a.input-group-text:focus-visible {
  color: var(--promtek-accent-ink) !important;
  background-color: var(--promtek-accent) !important;
  border-color: var(--promtek-accent) !important;
  outline-color: var(--promtek-accent) !important;
}

/* Plain-text editor: neutralize Elastic's blue-gray canvas and toolbar. */
html:not(.iframe) body.task-mail.action-compose #composebodycontainer,
html:not(.iframe) body.task-mail.action-compose #composebodycontainer.html-editor,
html:not(.iframe) body.task-mail.action-compose #composebodycontainer > textarea,
html:not(.iframe) body.task-mail.action-compose #composebody,
html:not(.iframe) body.task-mail.action-compose #composebodycontainer .googie_edit_layer {
  color: var(--promtek-text) !important;
  background-color: var(--promtek-compose-canvas) !important;
  border-color: var(--promtek-border) !important;
}

html:not(.iframe) body.task-mail.action-compose #composebodycontainer .editor-toolbar {
  color: var(--promtek-text) !important;
  background-color: var(--promtek-compose-addon) !important;
  border-color: var(--promtek-border) !important;
}

html:not(.iframe) body.task-mail.action-compose #composebodycontainer .editor-toolbar .mce-i-html,
html:not(.iframe) body.task-mail.action-compose #composebodycontainer .editor-toolbar .mce-i-html::before {
  color: var(--promtek-text) !important;
}

html:not(.iframe) body.task-mail.action-compose #composebodycontainer .editor-toolbar .mce-i-html:hover,
html:not(.iframe) body.task-mail.action-compose #composebodycontainer .editor-toolbar .mce-i-html:focus-visible {
  color: var(--promtek-accent-ink) !important;
  background-color: var(--promtek-accent) !important;
  border-color: var(--promtek-accent) !important;
  outline-color: var(--promtek-accent) !important;
}

/* HTML editor (TinyMCE): use the same warm controls and focus ring. */
html:not(.iframe) body.task-mail.action-compose div.tox.tox-tinymce,
html:not(.iframe) body.task-mail.action-compose div.tox .tox-edit-area,
html:not(.iframe) body.task-mail.action-compose div.tox .tox-edit-area__iframe {
  color: var(--promtek-text) !important;
  background-color: var(--promtek-compose-canvas) !important;
  border-color: var(--promtek-border) !important;
}

html:not(.iframe) body.task-mail.action-compose div.tox.focused {
  border-color: var(--promtek-accent) !important;
  box-shadow: 0 0 0 .2rem var(--promtek-focus-ring) !important;
}

html:not(.iframe) body.task-mail.action-compose div.tox .tox-toolbar-overlord > div,
html:not(.iframe) body.task-mail.action-compose div.tox .tox-toolbar,
html:not(.iframe) body.task-mail.action-compose div.tox .tox-toolbar__primary,
html:not(.iframe) body.task-mail.action-compose div.tox .tox-toolbar__overflow {
  color: var(--promtek-text) !important;
  background-color: var(--promtek-compose-addon) !important;
  border-color: var(--promtek-border) !important;
}

html:not(.iframe) body.task-mail.action-compose div.tox .tox-tbtn:hover,
html:not(.iframe) body.task-mail.action-compose div.tox .tox-tbtn:focus,
html:not(.iframe) body.task-mail.action-compose div.tox .tox-tbtn--enabled {
  color: var(--promtek-selection-ink) !important;
  background-color: var(--promtek-selection) !important;
}

/* Attachment drop area and its secondary action button. */
html:not(.iframe) body.task-mail.action-compose #compose-attachments.file-upload {
  color: var(--promtek-text) !important;
  background-color: var(--promtek-compose-drop) !important;
  border-color: var(--promtek-border) !important;
}

html:not(.iframe) body.task-mail.action-compose #compose-attachments.file-upload.droptarget::after {
  filter: grayscale(1) sepia(.18) saturate(.55);
  opacity: .62;
}

html:not(.iframe) body.task-mail.action-compose #compose-attachments.file-upload.droptarget.active,
html:not(.iframe) body.task-mail.action-compose #compose-attachments.file-upload.droptarget.hover {
  background-color: var(--promtek-selection) !important;
  border-color: var(--promtek-accent) !important;
}

html:not(.iframe) body.task-mail.action-compose #compose-attachments .btn-secondary.attach {
  color: var(--promtek-text) !important;
  background-color: var(--promtek-compose-addon) !important;
  border-color: var(--promtek-border) !important;
}

html:not(.iframe) body.task-mail.action-compose #compose-attachments .btn-secondary.attach:hover,
html:not(.iframe) body.task-mail.action-compose #compose-attachments .btn-secondary.attach:focus-visible {
  color: var(--promtek-accent-ink) !important;
  background-color: var(--promtek-accent) !important;
  border-color: var(--promtek-accent) !important;
  box-shadow: 0 0 0 .2rem var(--promtek-focus-ring) !important;
}

/* Compose options, including the three switch controls. */
html:not(.iframe) body.task-mail.action-compose #compose-options .custom-select {
  color: var(--promtek-text) !important;
  background-color: var(--promtek-control) !important;
  border-color: var(--promtek-border) !important;
}

html:not(.iframe) body.task-mail.action-compose #compose-options .custom-select:focus {
  border-color: var(--promtek-accent) !important;
  box-shadow: 0 0 0 .2rem var(--promtek-focus-ring) !important;
}

html:not(.iframe) body.task-mail.action-compose #compose-options input[type="checkbox"] {
  accent-color: var(--promtek-accent);
}

html:not(.iframe) body.task-mail.action-compose #compose-options .custom-control-label::before {
  background-color: var(--promtek-control) !important;
  border-color: var(--promtek-border) !important;
}

html:not(.iframe) body.task-mail.action-compose #compose-options .custom-control-label::after {
  background-color: var(--promtek-compose-knob) !important;
}

html:not(.iframe) body.task-mail.action-compose #compose-options .custom-control-input:checked ~ .custom-control-label::before {
  background-color: var(--promtek-accent) !important;
  border-color: var(--promtek-accent) !important;
}

html:not(.iframe) body.task-mail.action-compose #compose-options .custom-control-input:focus ~ .custom-control-label::before {
  border-color: var(--promtek-accent) !important;
  box-shadow: 0 0 0 .2rem var(--promtek-focus-ring) !important;
}

/* Bottom utility link and compose scrollbars. */
html:not(.iframe) body.task-mail.action-compose .formbuttons .extwin,
html:not(.iframe) body.task-mail.action-compose .formbuttons .extwin::before {
  color: var(--promtek-link) !important;
}

html:not(.iframe) body.task-mail.action-compose .formbuttons .extwin:hover,
html:not(.iframe) body.task-mail.action-compose .formbuttons .extwin:hover::before,
html:not(.iframe) body.task-mail.action-compose .formbuttons .extwin:focus-visible,
html:not(.iframe) body.task-mail.action-compose .formbuttons .extwin:focus-visible::before {
  color: var(--promtek-link-hover) !important;
}

html:not(.iframe) body.task-mail.action-compose #layout-content .scroller,
html:not(.iframe) body.task-mail.action-compose #layout-sidebar .scroller,
html:not(.iframe) body.task-mail.action-compose #composebody,
html:not(.iframe) body.task-mail.action-compose #composebodycontainer textarea {
  scrollbar-color: var(--promtek-muted) var(--promtek-compose-canvas);
}

html:not(.iframe) body.task-mail.action-compose #layout-content .scroller::-webkit-scrollbar-track,
html:not(.iframe) body.task-mail.action-compose #layout-sidebar .scroller::-webkit-scrollbar-track,
html:not(.iframe) body.task-mail.action-compose #composebody::-webkit-scrollbar-track,
html:not(.iframe) body.task-mail.action-compose #composebodycontainer textarea::-webkit-scrollbar-track {
  background-color: var(--promtek-compose-canvas);
}

html:not(.iframe) body.task-mail.action-compose #layout-content .scroller::-webkit-scrollbar-thumb,
html:not(.iframe) body.task-mail.action-compose #layout-sidebar .scroller::-webkit-scrollbar-thumb,
html:not(.iframe) body.task-mail.action-compose #composebody::-webkit-scrollbar-thumb,
html:not(.iframe) body.task-mail.action-compose #composebodycontainer textarea::-webkit-scrollbar-thumb {
  background-color: var(--promtek-muted);
  border-color: var(--promtek-compose-canvas);
}
