/**
 * Deployment task output styling for Drupal development module.
 */

/* Verbose toggle controls */
.deployment-verbose-toggle {
  margin-bottom: 16px;
  padding: 12px;
  background-color: var(--color-gray-100);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-gray-200);
}

.verbose-toggle-input {
  margin-right: 8px;
  cursor: pointer;
}

.verbose-toggle-label {
  cursor: pointer;
  font-size: 14px;
  user-select: none;
  display: inline-flex;
  align-items: center;
}

/* Main container */
.deployment-output {
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  background-color: var(--color-gray-50);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-gray-200);
}

/* Individual task container (div or details) */
.deployment-task {
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-gray-200);
  padding-bottom: 12px;
  opacity: 1;
}

.deployment-task:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Details element specifics */
details.deployment-task {
  cursor: pointer;
}

details.deployment-task[open] {
  padding-bottom: 0;
}

/* Verbose tasks styling */
.deployment-task.task-verbose {
  opacity: 0.6;
  display: none;
}

/* Show verbose tasks when checkbox is checked */
.fieldset__wrapper .verbose-toggle-input:checked ~ .deployment-output .deployment-task.task-verbose {
  display: block;
}

.fieldset__wrapper:has(.verbose-toggle-input:checked) .deployment-output .deployment-task.task-verbose {
  display: block;
}

.deployment-task.task-verbose .task-title strong::before {
  content: '[VERBOSE] ';
  color: var(--color-gray-400);
  font-size: 11px;
  font-style: italic;
  margin-right: 4px;
}

/* Task title row */
.task-title {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

summary.task-title {
  list-style: none;
  user-select: none;
  margin-bottom: 0;
  padding: 5px 0 5px 0;
}
summary.task-title:focus {
  outline: none;
  box-shadow: none;
}

/* Task toggle icon (chevron) - only on summary */
summary.task-title::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="%23666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><polyline points="6 9 12 15 18 9"></polyline></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.2s ease;
  margin-right: 4px;
}

details.deployment-task[open] summary.task-title::before {
  transform: rotate(180deg);
}

.task-title strong {
  color: var(--color-gray-800);
  font-weight: 600;
  flex: 1;
  word-break: break-word;
}

.task-title span {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Status badge colors */
.task-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
  flex-shrink: 0;
}

.task-status.ok {
  background-color: var(--color-success-bg);
  color: var(--color-success-text);
}

.task-status-failed,
.task-status.failed {
  background-color: var(--color-error-bg);
  color: var(--color-error-text);
}

/* Task content/body */
.task-content {
  background-color: var(--color-white);
  padding: 10px 12px;
  border-left: 3px solid var(--color-info-text);
  border-radius: 2px;
  color: var(--color-gray-600);
  margin-left: 0;
  margin-top: 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    margin-top: 0;
  }
  to {
    opacity: 1;
    margin-top: 8px;
  }
}

.task-content::-webkit-scrollbar {
  height: 6px;
}

.task-content::-webkit-scrollbar-track {
  background: var(--color-gray-100);
  border-radius: 3px;
}

.task-content::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: 3px;
}

.task-content::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-400);
}

/* When task body is just "OK" */
.task-content:only-of-type {
  padding: 8px 12px;
  background-color: transparent;
  border-left: none;
  /*color: #999;*/
  font-size: 12px;
  font-style: italic;
}

/* Responsive for smaller screens */
@media (max-width: 768px) {
  .deployment-output {
    padding: 12px;
    font-size: 12px;
  }

  .task-title {
    flex-direction: column;
    align-items: flex-start;
  }

  .task-title span {
    flex-shrink: 0;
  }
}
