/* ============================================================
   mint_task_templates.css
   Material Design — consistent with mint plugin ecosystem
   ============================================================ */

/* ── Variables ────────────────────────────────────────────── */
:root {
  --mtt-primary:        #1565c0; /* Blue 800 */
  --mtt-primary-light:  #e3f2fd; /* Blue 50  */
  --mtt-danger:         #c62828; /* Red 800  */
  --mtt-danger-light:   #ffebee;
  --mtt-success:        #2e7d32; /* Green 800 */
  --mtt-border:         #e0e0e0;
  --mtt-bg:             #fafafa;
  --mtt-text:           #212121;
  --mtt-text-muted:     #757575;
  --mtt-radius:         4px;
  --mtt-shadow:         0 1px 3px rgba(0,0,0,.12);
}

/* ── Admin header ─────────────────────────────────────────── */
.mtt-admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.mtt-admin-header h2 {
  margin: 0;
}

/* ── Buttons ──────────────────────────────────────────────── */
.mtt-btn {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: var(--mtt-radius);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, box-shadow .15s;
}
.mtt-btn-primary {
  background: var(--mtt-primary);
  color: #fff !important;
  border-color: var(--mtt-primary);
}
.mtt-btn-primary:hover {
  background: #0d47a1;
  color: #fff !important;
}
.mtt-btn-ghost {
  background: #fff;
  color: var(--mtt-primary);
  border-color: var(--mtt-border);
}
.mtt-btn-ghost:hover {
  background: var(--mtt-primary-light);
}
.mtt-btn-danger {
  background: transparent;
  color: var(--mtt-danger);
  border-color: var(--mtt-danger);
}
.mtt-btn-danger:hover {
  background: var(--mtt-danger-light);
}
.mtt-btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ── Table ────────────────────────────────────────────────── */
.mtt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  box-shadow: var(--mtt-shadow);
  border-radius: var(--mtt-radius);
  overflow: hidden;
}
.mtt-table thead tr {
  background: var(--mtt-primary);
  color: #fff;
}
.mtt-table thead th {
  padding: 10px 14px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
.mtt-table tbody tr {
  border-bottom: 1px solid var(--mtt-border);
  transition: background .1s;
}
.mtt-table tbody tr:last-child {
  border-bottom: none;
}
.mtt-table tbody tr:hover {
  background: var(--mtt-primary-light);
}
.mtt-table td {
  padding: 9px 14px;
  vertical-align: middle;
}
.mtt-row-inactive td {
  opacity: .55;
}
.mtt-col-name {
  min-width: 180px;
}
.mtt-col-actions {
  white-space: nowrap;
  text-align: right;
  min-width: 120px;
}
.mtt-col-actions .mtt-btn + .mtt-btn {
  margin-left: 6px;
}

/* ── Badges ───────────────────────────────────────────────── */
.mtt-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  background: var(--mtt-primary-light);
  color: var(--mtt-primary);
  border: 1px solid #bbdefb;
  margin: 2px 2px 2px 0;
  white-space: nowrap;
}
.mtt-badge-all {
  background: #f3e5f5;
  color: #6a1b9a;
  border-color: #ce93d8;
}

/* ── Status dot ───────────────────────────────────────────── */
.mtt-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.mtt-dot-active   { background: var(--mtt-success); }
.mtt-dot-inactive { background: #bdbdbd; }

/* ── Empty state ──────────────────────────────────────────── */
.mtt-empty-state {
  padding: 40px;
  text-align: center;
  color: var(--mtt-text-muted);
  background: #fff;
  border: 1px dashed var(--mtt-border);
  border-radius: var(--mtt-radius);
}

/* ── Form ─────────────────────────────────────────────────── */
.mtt-form {
  max-width: 720px;
}
.mtt-field {
  margin-bottom: 20px;
}
.mtt-field label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--mtt-text);
}
.mtt-hint {
  font-weight: 400;
  color: var(--mtt-text-muted);
  font-size: 12px;
}
.mtt-input,
.mtt-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--mtt-border);
  border-radius: var(--mtt-radius);
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.mtt-input:focus,
.mtt-textarea:focus {
  outline: none;
  border-color: var(--mtt-primary);
  box-shadow: 0 0 0 3px rgba(21,101,192,.15);
}
.mtt-textarea {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}

/* ── Checkboxes grid ──────────────────────────────────────── */
.mtt-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 10px 12px;
  background: var(--mtt-bg);
  border: 1px solid var(--mtt-border);
  border-radius: var(--mtt-radius);
}
.mtt-checkboxes-single-col {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 6px 0;
}
.mtt-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
}

/* inline active checkbox */
.mtt-field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mtt-field-inline label {
  margin: 0;
}

/* ── Project tree ─────────────────────────────────────────── */
.mtt-tree-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}
.mtt-tree-ctrl-btn {
  font-size: 11px;
  padding: 3px 10px;
  border: 1px solid var(--mtt-border);
  border-radius: var(--mtt-radius);
  background: #fff;
  color: var(--mtt-text-muted);
  cursor: pointer;
}
.mtt-tree-ctrl-btn:hover {
  background: var(--mtt-bg);
  color: var(--mtt-text);
}
.mtt-project-tree {
  background: #fff;
  border: 1px solid var(--mtt-border);
  border-radius: var(--mtt-radius);
  max-height: 300px;
  overflow-y: auto;
}
.mtt-tree-item {
  user-select: none;
}
.mtt-tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  transition: background .1s;
}
.mtt-tree-row:hover {
  background: var(--mtt-primary-light);
}
.mtt-tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 10px;
  cursor: pointer;
  color: var(--mtt-text-muted);
  flex-shrink: 0;
  transition: transform .15s;
}
.mtt-tree-toggle.mtt-expanded {
  transform: rotate(90deg);
}
.mtt-tree-toggle-placeholder {
  display: inline-block;
  width: 16px;
  flex-shrink: 0;
}
.mtt-tree-checkbox {
  flex-shrink: 0;
  cursor: pointer;
}
.mtt-tree-label {
  font-size: 13px;
  cursor: pointer;
  flex: 1;
}
.mtt-tree-children {
  /* shown/hidden via JS */
}
.mtt-subtree-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 1px 8px;
  border: 1px solid var(--mtt-border);
  border-radius: 10px;
  background: var(--mtt-bg);
  cursor: pointer;
  white-space: nowrap;
}
.mtt-subtree-label:hover {
  background: var(--mtt-primary-light);
  border-color: #bbdefb;
}
.mtt-subtree-text {
  font-size: 11px;
  color: var(--mtt-text-muted);
}
.mtt-subtree-checkbox {
  cursor: pointer;
}

/* ── Form actions ─────────────────────────────────────────── */
.mtt-form-actions {
  display: flex;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--mtt-border);
  margin-top: 24px;
}
/* Override Redmine's input[type=submit] styles */
.mtt-form-actions .mtt-btn-primary,
.mtt-form-actions button.mtt-btn-primary {
  background: var(--mtt-primary) !important;
  color: #fff !important;
  border: 1px solid var(--mtt-primary) !important;
  box-shadow: none !important;
  text-shadow: none !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  padding: 7px 16px !important;
  border-radius: var(--mtt-radius) !important;
  cursor: pointer !important;
}
.mtt-form-actions .mtt-btn-primary:hover,
.mtt-form-actions button.mtt-btn-primary:hover {
  background: #0d47a1 !important;
  border-color: #0d47a1 !important;
}

/* ── Errors ───────────────────────────────────────────────── */
.mtt-errors {
  background: var(--mtt-danger-light);
  border: 1px solid #ef9a9a;
  border-radius: var(--mtt-radius);
  padding: 10px 14px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--mtt-danger);
}
.mtt-errors ul {
  margin: 0;
  padding-left: 18px;
}

/* ── Simple markdown toolbar ──────────────────────────────── */
.mtt-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  background: #f5f5f5;
  border: 1px solid var(--mtt-border);
  border-bottom: none;
  border-radius: var(--mtt-radius) var(--mtt-radius) 0 0;
}
.mtt-tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  color: var(--mtt-text);
  transition: background .1s, border-color .1s;
}
.mtt-tb-btn:hover {
  background: #fff;
  border-color: var(--mtt-border);
}
.mtt-tb-btn:active {
  background: var(--mtt-primary-light);
  border-color: #bbdefb;
}
.mtt-tb-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--mtt-border);
  margin: 0 4px;
}
/* attach toolbar to textarea visually */
.mtt-toolbar + .mtt-textarea {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
#mtt-selector-wrap {
  margin-bottom: 4px;
}
.mtt-form-row {
  display: block;
  margin: 0 0 6px 0;
  padding: 0;
}
.mtt-select-label {
  display: inline-block;
  font-size: 13px;
  font-weight: bold;
  color: #505050;
  text-align: right;
  padding-right: 10px;
  width: 140px;
  vertical-align: middle;
}
.mtt-select {
  display: inline-block;
  padding: 2px 4px;
  border: 1px solid #c8c8c8;
  border-radius: 2px;
  font-size: 13px;
  min-width: 200px;
  background: #fff;
  cursor: pointer;
  vertical-align: middle;
  height: 24px;
  -webkit-appearance: auto;
  appearance: auto;
}
.mtt-select:focus {
  outline: none;
  border-color: var(--mtt-primary);
}
