/**
 * Error Modal Styling
 * Red banner modal for server errors shown to admin/debug users
 */

.error-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.error-modal.visible {
  display: flex;
}

.error-modal-content {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  max-width: 700px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  animation: errorModalSlideIn 0.2s ease-out;
}

@keyframes errorModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.error-modal-header {
  background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 8px 8px 0 0;
}

.error-modal-status {
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.error-modal-queue-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  margin-left: auto;
  margin-right: 12px;
}

.error-modal-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.error-modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Body */
.error-modal-body {
  padding: 24px 20px;
}

.error-modal-message {
  margin: 0 0 20px 0;
  font-size: 18px;
  font-weight: 500;
  color: #212121;
  line-height: 1.4;
}

.error-modal-details {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 16px;
  background: #fafafa;
  margin-bottom: 16px;
}

.error-modal-field {
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.error-modal-field:last-child {
  margin-bottom: 0;
}

.error-modal-field strong {
  color: #616161;
  font-size: 14px;
  min-width: 100px;
  font-weight: 600;
}

.error-modal-field span {
  color: #212121;
  font-size: 14px;
  font-family: 'Courier New', monospace;
  flex: 1;
  word-break: break-word;
}

.error-modal-copy-btn {
  background: #1976d2;
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-weight: 500;
  margin-left: 8px;
}

.error-modal-copy-btn:hover {
  background: #1565c0;
}

.error-modal-copy-btn:active {
  background: #0d47a1;
}

/* Stack Trace */
.error-modal-stack-container {
  margin-top: 16px;
}

.error-modal-stack-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.error-modal-stack-header strong {
  color: #616161;
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}

.error-modal-toggle-btn {
  background: #757575;
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-weight: 500;
}

.error-modal-toggle-btn:hover {
  background: #616161;
}

.error-modal-stack {
  background: #263238;
  color: #aed581;
  padding: 16px;
  border-radius: 6px;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
  transition: max-height 0.3s ease;
}

.error-modal-stack.collapsed {
  max-height: 80px;
  overflow: hidden;
  position: relative;
}

.error-modal-stack.collapsed::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to bottom, transparent, #263238);
}

/* Footer */
.error-modal-footer {
  padding: 16px 20px;
  background: #f5f5f5;
  border-radius: 0 0 8px 8px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.error-modal-dismiss-btn {
  background: #757575;
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.error-modal-dismiss-btn:hover {
  background: #616161;
}

.error-modal-dismiss-btn:active {
  background: #424242;
}

/* Scrollbar styling for stack trace */
.error-modal-stack::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.error-modal-stack::-webkit-scrollbar-track {
  background: #37474f;
  border-radius: 4px;
}

.error-modal-stack::-webkit-scrollbar-thumb {
  background: #546e7a;
  border-radius: 4px;
}

.error-modal-stack::-webkit-scrollbar-thumb:hover {
  background: #607d8b;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .error-modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .error-modal-header {
    padding: 12px 16px;
  }

  .error-modal-body {
    padding: 16px;
  }

  .error-modal-message {
    font-size: 16px;
  }

  .error-modal-field {
    flex-direction: column;
    gap: 4px;
  }

  .error-modal-field strong {
    min-width: auto;
  }

  .error-modal-copy-btn {
    margin-left: 0;
    align-self: flex-start;
  }
}
